Class: UnivapayClientSdk::TokenCreatePaidyDataShippingAddress

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

Overview

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).

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(zip:, line1: SKIP, line2: SKIP, city: SKIP, state: SKIP, additional_properties: nil) ⇒ TokenCreatePaidyDataShippingAddress

Returns a new instance of TokenCreatePaidyDataShippingAddress.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 60

def initialize(zip:, line1: SKIP, line2: SKIP, city: SKIP, state: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @zip = zip
  @line1 = line1 unless line1 == SKIP
  @line2 = line2 unless line2 == SKIP
  @city = city unless city == SKIP
  @state = state unless state == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

City or locality.

Returns:

  • (String)


28
29
30
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 28

def city
  @city
end

#line1String

Primary street address line.

Returns:

  • (String)


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

def line1
  @line1
end

#line2String

Secondary street address line.

Returns:

  • (String)


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

def line2
  @line2
end

#stateString

State or prefecture.

Returns:

  • (String)


32
33
34
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 32

def state
  @state
end

#zipString

Japanese postal code (e.g., '105-0011').

Returns:

  • (String)


16
17
18
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 16

def zip
  @zip
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  zip = hash.key?('zip') ? hash['zip'] : nil
  line1 = hash.key?('line1') ? hash['line1'] : SKIP
  line2 = hash.key?('line2') ? hash['line2'] : SKIP
  city = hash.key?('city') ? hash['city'] : SKIP
  state = hash.key?('state') ? hash['state'] : 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.
  TokenCreatePaidyDataShippingAddress.new(zip: zip,
                                          line1: line1,
                                          line2: line2,
                                          city: city,
                                          state: state,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['zip'] = 'zip'
  @_hash['line1'] = 'line1'
  @_hash['line2'] = 'line2'
  @_hash['city'] = 'city'
  @_hash['state'] = 'state'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 46

def self.optionals
  %w[
    line1
    line2
    city
    state
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 102

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} zip: #{@zip.inspect}, line1: #{@line1.inspect}, line2: #{@line2.inspect},"\
  " city: #{@city.inspect}, state: #{@state.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} zip: #{@zip}, line1: #{@line1}, line2: #{@line2}, city: #{@city}, state:"\
  " #{@state}, additional_properties: #{@additional_properties}>"
end