Class: CyberSourceMergedSpec::TokenInformation1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/token_information1.rb

Overview

TokenInformation1 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(instrumentidentifier_new: SKIP, customer: SKIP, payment_instrument: SKIP, shipping_address: SKIP, instrument_identifier: SKIP, third_party_token: SKIP, additional_properties: nil) ⇒ TokenInformation1

Returns a new instance of TokenInformation1.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 89

def initialize(instrumentidentifier_new: SKIP, customer: SKIP,
               payment_instrument: SKIP, shipping_address: SKIP,
               instrument_identifier: SKIP, third_party_token: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @instrumentidentifier_new = instrumentidentifier_new unless instrumentidentifier_new == SKIP
  @customer = customer unless customer == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @third_party_token = third_party_token unless third_party_token == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#customerCustomer4

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.

Returns:



26
27
28
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 26

def customer
  @customer
end

#instrument_identifierInstrumentIdentifier3

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.



50
51
52
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 50

def instrument_identifier
  @instrument_identifier
end

#instrumentidentifier_newTrueClass | FalseClass

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 18

def instrumentidentifier_new
  @instrumentidentifier_new
end

#payment_instrumentPaymentInstrument4

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.

Returns:



34
35
36
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 34

def payment_instrument
  @payment_instrument
end

#shipping_addressShippingAddress4

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.

Returns:



42
43
44
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 42

def shipping_address
  @shipping_address
end

#third_party_tokenThirdPartyToken1

A value of true means the card number or bank account used to create an Instrument Identifier was new and did not already exist in the token vault. A value of false means the card number or bank account used to create an Instrument Identifier already existed in the token vault.

Returns:



58
59
60
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 58

def third_party_token
  @third_party_token
end

Class Method Details

.from_element(root) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 139

def self.from_element(root)
  instrumentidentifier_new = XmlUtilities.from_element(
    root, 'instrumentidentifierNew', TrueClass
  )
  customer = XmlUtilities.from_element(root, 'Customer4', Customer4)
  payment_instrument = XmlUtilities.from_element(root, 'PaymentInstrument4',
                                                 PaymentInstrument4)
  shipping_address = XmlUtilities.from_element(root, 'ShippingAddress4',
                                               ShippingAddress4)
  instrument_identifier = XmlUtilities.from_element(root,
                                                    'InstrumentIdentifier3',
                                                    InstrumentIdentifier3)
  third_party_token = XmlUtilities.from_element(root, 'ThirdPartyToken1',
                                                ThirdPartyToken1)

  new(instrumentidentifier_new: instrumentidentifier_new,
      customer: customer,
      payment_instrument: payment_instrument,
      shipping_address: shipping_address,
      instrument_identifier: instrument_identifier,
      third_party_token: third_party_token,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  instrumentidentifier_new =
    hash.key?('instrumentidentifierNew') ? hash['instrumentidentifierNew'] : SKIP
  customer = Customer4.from_hash(hash['customer']) if hash['customer']
  payment_instrument = PaymentInstrument4.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  shipping_address = ShippingAddress4.from_hash(hash['shippingAddress']) if
    hash['shippingAddress']
  instrument_identifier = InstrumentIdentifier3.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']
  third_party_token = ThirdPartyToken1.from_hash(hash['thirdPartyToken']) if
    hash['thirdPartyToken']

  # 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.
  TokenInformation1.new(instrumentidentifier_new: instrumentidentifier_new,
                        customer: customer,
                        payment_instrument: payment_instrument,
                        shipping_address: shipping_address,
                        instrument_identifier: instrument_identifier,
                        third_party_token: third_party_token,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['instrumentidentifier_new'] = 'instrumentidentifierNew'
  @_hash['customer'] = 'customer'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['shipping_address'] = 'shippingAddress'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash['third_party_token'] = 'thirdPartyToken'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
80
81
82
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 73

def self.optionals
  %w[
    instrumentidentifier_new
    customer
    payment_instrument
    shipping_address
    instrument_identifier
    third_party_token
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



193
194
195
196
197
198
199
200
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 193

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} instrumentidentifier_new: #{@instrumentidentifier_new.inspect}, customer:"\
  " #{@customer.inspect}, payment_instrument: #{@payment_instrument.inspect},"\
  " shipping_address: #{@shipping_address.inspect}, instrument_identifier:"\
  " #{@instrument_identifier.inspect}, third_party_token: #{@third_party_token.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



184
185
186
187
188
189
190
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 184

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} instrumentidentifier_new: #{@instrumentidentifier_new}, customer:"\
  " #{@customer}, payment_instrument: #{@payment_instrument}, shipping_address:"\
  " #{@shipping_address}, instrument_identifier: #{@instrument_identifier}, third_party_token:"\
  " #{@third_party_token}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/cyber_source_merged_spec/models/token_information1.rb', line 163

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'instrumentidentifierNew',
                                 instrumentidentifier_new)
  XmlUtilities.add_as_subelement(doc, root, 'Customer4', customer)
  XmlUtilities.add_as_subelement(doc, root, 'PaymentInstrument4',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'ShippingAddress4',
                                 shipping_address)
  XmlUtilities.add_as_subelement(doc, root, 'InstrumentIdentifier3',
                                 instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'ThirdPartyToken1',
                                 third_party_token)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end