Class: UnivapayClientSdk::TokenCreatePaidyData

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

Overview

Token Create 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:, shipping_address:, phone_number: SKIP, additional_properties: nil) ⇒ TokenCreatePaidyData

Returns a new instance of TokenCreatePaidyData.



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

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

  @paidy_token = paidy_token
  @shipping_address = shipping_address
  @phone_number = phone_number unless phone_number == 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_create_paidy_data.rb', line 14

def paidy_token
  @paidy_token
end

#phone_numberString

Consumer phone number in Japanese format (e.g., '08012341234').

Returns:

  • (String)


24
25
26
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 24

def phone_number
  @phone_number
end

#shipping_addressTokenCreatePaidyDataShippingAddress

Shipping address for a Paidy token. zip is required; the server additionally requires at least one of line1, line2, city, or state to be present (not enforceable at the schema level).



20
21
22
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 20

def shipping_address
  @shipping_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # 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.
  TokenCreatePaidyData.new(paidy_token: paidy_token,
                           shipping_address: shipping_address,
                           phone_number: phone_number,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 27

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

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 36

def self.optionals
  %w[
    phone_number
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 84

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.paidy_token,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.shipping_address,
                              ->(val) { TokenCreatePaidyDataShippingAddress.validate(val) },
                              is_model_hash: true)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['paidy_token'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['shipping_address'],
                            ->(val) { TokenCreatePaidyDataShippingAddress.validate(val) },
                            is_model_hash: true)
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
# File 'lib/univapay_client_sdk/models/token_create_paidy_data.rb', line 114

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

#to_sObject

Provides a human-readable string representation of the object.



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

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