Class: CyberSourceMergedSpec::PaymentInformation37

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

Overview

PaymentInformation37 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(card: SKIP, customer: SKIP, payment_instrument: SKIP, instrument_identifier: SKIP, tokenized_card: SKIP, additional_properties: nil) ⇒ PaymentInformation37

Returns a new instance of PaymentInformation37.



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

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

  @card = card unless card == SKIP
  @customer = customer unless customer == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @tokenized_card = tokenized_card unless tokenized_card == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cardCard125

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 14

def card
  @card
end

#customerCustomer

TODO: Write general description for this method

Returns:



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

def customer
  @customer
end

#instrument_identifierInstrumentIdentifier2

TODO: Write general description for this method



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

def instrument_identifier
  @instrument_identifier
end

#payment_instrumentPaymentInstrument

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 22

def payment_instrument
  @payment_instrument
end

#tokenized_cardTokenizedCard

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 30

def tokenized_card
  @tokenized_card
end

Class Method Details

.from_element(root) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 102

def self.from_element(root)
  card = XmlUtilities.from_element(root, 'Card125', Card125)
  customer = XmlUtilities.from_element(root, 'Customer', Customer)
  payment_instrument = XmlUtilities.from_element(root, 'PaymentInstrument',
                                                 PaymentInstrument)
  instrument_identifier = XmlUtilities.from_element(root,
                                                    'InstrumentIdentifier2',
                                                    InstrumentIdentifier2)
  tokenized_card = XmlUtilities.from_element(root, 'TokenizedCard',
                                             TokenizedCard)

  new(card: card,
      customer: customer,
      payment_instrument: payment_instrument,
      instrument_identifier: instrument_identifier,
      tokenized_card: tokenized_card,
      additional_properties: additional_properties)
end

.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
99
100
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = Card125.from_hash(hash['card']) if hash['card']
  customer = Customer.from_hash(hash['customer']) if hash['customer']
  payment_instrument = PaymentInstrument.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  instrument_identifier = InstrumentIdentifier2.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']
  tokenized_card = TokenizedCard.from_hash(hash['tokenizedCard']) if hash['tokenizedCard']

  # 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.
  PaymentInformation37.new(card: card,
                           customer: customer,
                           payment_instrument: payment_instrument,
                           instrument_identifier: instrument_identifier,
                           tokenized_card: tokenized_card,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['customer'] = 'customer'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash['tokenized_card'] = 'tokenizedCard'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 44

def self.optionals
  %w[
    card
    customer
    payment_instrument
    instrument_identifier
    tokenized_card
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



146
147
148
149
150
151
152
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 146

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

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 138

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

#to_xml_element(doc, root_name) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/payment_information37.rb', line 121

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

  XmlUtilities.add_as_subelement(doc, root, 'Card125', card)
  XmlUtilities.add_as_subelement(doc, root, 'Customer', customer)
  XmlUtilities.add_as_subelement(doc, root, 'PaymentInstrument',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'InstrumentIdentifier2',
                                 instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'TokenizedCard', tokenized_card)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end