Class: UnivapayClientSdk::TokenResponsePaidyData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/token_response_paidy_data.rb

Overview

Token Response Paidy Data schema.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(paidy_token:, phone_number: SKIP, shipping_address: SKIP, additional_properties: nil) ⇒ TokenResponsePaidyData

Returns a new instance of TokenResponsePaidyData.



48
49
50
51
52
53
54
55
56
57
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 48

def initialize(paidy_token:, phone_number: SKIP, shipping_address: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @paidy_token = paidy_token
  @phone_number = phone_number unless phone_number == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#paidy_tokenString

One-time token issued by the Paidy SDK/widget on the client side.

Returns:

  • (String)


14
15
16
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 14

def paidy_token
  @paidy_token
end

#phone_numberString

Consumer phone number in Japanese format.

Returns:

  • (String)


18
19
20
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 18

def phone_number
  @phone_number
end

#shipping_addressTokenResponsePaidyDataShippingAddress

Shipping address returned for a Paidy token.



22
23
24
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 22

def shipping_address
  @shipping_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  paidy_token = hash.key?('paidy_token') ? hash['paidy_token'] : nil
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP
  if hash['shipping_address']
    shipping_address = TokenResponsePaidyDataShippingAddress.from_hash(hash['shipping_address'])
  end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TokenResponsePaidyData.new(paidy_token: paidy_token,
                             phone_number: phone_number,
                             shipping_address: shipping_address,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['paidy_token'] = 'paidy_token'
  @_hash['phone_number'] = 'phone_number'
  @_hash['shipping_address'] = 'shipping_address'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
45
46
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 42

def self.nullables
  %w[
    phone_number
  ]
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 34

def self.optionals
  %w[
    phone_number
    shipping_address
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 86

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.paidy_token,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['paidy_token'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



106
107
108
109
110
111
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 106

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} paidy_token: #{@paidy_token.inspect}, phone_number:"\
  " #{@phone_number.inspect}, shipping_address: #{@shipping_address.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
# File 'lib/univapay_client_sdk/models/token_response_paidy_data.rb', line 99

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} paidy_token: #{@paidy_token}, phone_number: #{@phone_number},"\
  " shipping_address: #{@shipping_address}, additional_properties: #{@additional_properties}>"
end