Class: VisaAcceptanceMergedSpec::GetCustomerResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/get_customer_response.rb

Overview

GetCustomerResponse Model.

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(links: SKIP, id: SKIP, object_information: SKIP, buyer_information: SKIP, client_reference_information: SKIP, merchant_defined_information: SKIP, default_payment_instrument: SKIP, default_shipping_address: SKIP, metadata: SKIP, embedded: SKIP, additional_properties: nil) ⇒ GetCustomerResponse

Returns a new instance of GetCustomerResponse.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 89

def initialize(links: SKIP, id: SKIP, object_information: SKIP,
               buyer_information: SKIP, client_reference_information: SKIP,
               merchant_defined_information: SKIP,
               default_payment_instrument: SKIP,
               default_shipping_address: SKIP, metadata: SKIP,
               embedded: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @links = links unless links == SKIP
  @id = id unless id == SKIP
  @object_information = object_information unless object_information == SKIP
  @buyer_information = buyer_information unless buyer_information == SKIP
  unless client_reference_information == SKIP
    @client_reference_information =
      client_reference_information
  end
  unless merchant_defined_information == SKIP
    @merchant_defined_information =
      merchant_defined_information
  end
  unless default_payment_instrument == SKIP
    @default_payment_instrument =
      default_payment_instrument
  end
  @default_shipping_address = default_shipping_address unless default_shipping_address == SKIP
  @metadata =  unless  == SKIP
  @embedded = embedded unless embedded == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#buyer_informationBuyerInformation12

The Id of the Customer Token.

Returns:



26
27
28
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 26

def buyer_information
  @buyer_information
end

#client_reference_informationClientReferenceInformation42

The Id of the Customer Token.



30
31
32
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 30

def client_reference_information
  @client_reference_information
end

#default_payment_instrumentDefaultPaymentInstrument

Object containing the custom data that the merchant defines.



38
39
40
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 38

def default_payment_instrument
  @default_payment_instrument
end

#default_shipping_addressDefaultShippingAddress

Object containing the custom data that the merchant defines.



42
43
44
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 42

def default_shipping_address
  @default_shipping_address
end

#embeddedEmbedded4

Object containing the custom data that the merchant defines.

Returns:



50
51
52
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 50

def embedded
  @embedded
end

#idString

The Id of the Customer Token.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 18

def id
  @id
end

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 14

def links
  @links
end

#merchant_defined_informationArray[MerchantDefinedInformation7]

Object containing the custom data that the merchant defines.

Returns:



34
35
36
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 34

def merchant_defined_information
  @merchant_defined_information
end

#metadataMetadata

Object containing the custom data that the merchant defines.

Returns:



46
47
48
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 46

def 
  @metadata
end

#object_informationObjectInformation

The Id of the Customer Token.

Returns:



22
23
24
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 22

def object_information
  @object_information
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 121

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  links = Links19.from_hash(hash['_links']) if hash['_links']
  id = hash.key?('id') ? hash['id'] : SKIP
  object_information = ObjectInformation.from_hash(hash['objectInformation']) if
    hash['objectInformation']
  buyer_information = BuyerInformation12.from_hash(hash['buyerInformation']) if
    hash['buyerInformation']
  if hash['clientReferenceInformation']
    client_reference_information = ClientReferenceInformation42.from_hash(hash['clientReferenceInformation'])
  end
  # Parameter is an array, so we need to iterate through it
  merchant_defined_information = nil
  unless hash['merchantDefinedInformation'].nil?
    merchant_defined_information = []
    hash['merchantDefinedInformation'].each do |structure|
      merchant_defined_information << (MerchantDefinedInformation7.from_hash(structure) if structure)
    end
  end

  merchant_defined_information = SKIP unless hash.key?('merchantDefinedInformation')
  if hash['defaultPaymentInstrument']
    default_payment_instrument = DefaultPaymentInstrument.from_hash(hash['defaultPaymentInstrument'])
  end
  default_shipping_address = DefaultShippingAddress.from_hash(hash['defaultShippingAddress']) if
    hash['defaultShippingAddress']
   = Metadata.from_hash(hash['metadata']) if hash['metadata']
  embedded = Embedded4.from_hash(hash['_embedded']) if hash['_embedded']

  # 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.
  GetCustomerResponse.new(links: links,
                          id: id,
                          object_information: object_information,
                          buyer_information: buyer_information,
                          client_reference_information: client_reference_information,
                          merchant_defined_information: merchant_defined_information,
                          default_payment_instrument: default_payment_instrument,
                          default_shipping_address: default_shipping_address,
                          metadata: ,
                          embedded: embedded,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['links'] = '_links'
  @_hash['id'] = 'id'
  @_hash['object_information'] = 'objectInformation'
  @_hash['buyer_information'] = 'buyerInformation'
  @_hash['client_reference_information'] = 'clientReferenceInformation'
  @_hash['merchant_defined_information'] = 'merchantDefinedInformation'
  @_hash['default_payment_instrument'] = 'defaultPaymentInstrument'
  @_hash['default_shipping_address'] = 'defaultShippingAddress'
  @_hash['metadata'] = 'metadata'
  @_hash['embedded'] = '_embedded'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 69

def self.optionals
  %w[
    links
    id
    object_information
    buyer_information
    client_reference_information
    merchant_defined_information
    default_payment_instrument
    default_shipping_address
    metadata
    embedded
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



186
187
188
189
190
191
192
193
194
195
196
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 186

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links.inspect}, id: #{@id.inspect}, object_information:"\
  " #{@object_information.inspect}, buyer_information: #{@buyer_information.inspect},"\
  " client_reference_information: #{@client_reference_information.inspect},"\
  " merchant_defined_information: #{@merchant_defined_information.inspect},"\
  " default_payment_instrument: #{@default_payment_instrument.inspect},"\
  " default_shipping_address: #{@default_shipping_address.inspect}, metadata:"\
  " #{@metadata.inspect}, embedded: #{@embedded.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



174
175
176
177
178
179
180
181
182
183
# File 'lib/visa_acceptance_merged_spec/models/get_customer_response.rb', line 174

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links}, id: #{@id}, object_information: #{@object_information},"\
  " buyer_information: #{@buyer_information}, client_reference_information:"\
  " #{@client_reference_information}, merchant_defined_information:"\
  " #{@merchant_defined_information}, default_payment_instrument:"\
  " #{@default_payment_instrument}, default_shipping_address: #{@default_shipping_address},"\
  " metadata: #{@metadata}, embedded: #{@embedded}, additional_properties:"\
  " #{@additional_properties}>"
end