Class: CyberSourceMergedSpec::OrderInformation45

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

Overview

OrderInformation45 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(amount_details: SKIP, is_crypto_currency_purchase: SKIP, additional_properties: nil) ⇒ OrderInformation45

Returns a new instance of OrderInformation45.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 45

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

  @amount_details = amount_details unless amount_details == SKIP
  unless is_crypto_currency_purchase == SKIP
    @is_crypto_currency_purchase =
      is_crypto_currency_purchase
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_detailsAmountDetails43

TODO: Write general description for this method

Returns:



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

def amount_details
  @amount_details
end

#is_crypto_currency_purchaseString

This indicates that the funds transfer is for a crypto currency transaction. Optional Y/y, true N/n, false

Returns:

  • (String)


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

def is_crypto_currency_purchase
  @is_crypto_currency_purchase
end

Class Method Details

.from_element(root) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 80

def self.from_element(root)
  amount_details = XmlUtilities.from_element(root, 'AmountDetails43',
                                             AmountDetails43)
  is_crypto_currency_purchase = XmlUtilities.from_element(
    root, 'isCryptoCurrencyPurchase', String
  )

  new(amount_details: amount_details,
      is_crypto_currency_purchase: is_crypto_currency_purchase,
      additional_properties: additional_properties)
end

.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
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount_details = AmountDetails43.from_hash(hash['amountDetails']) if hash['amountDetails']
  is_crypto_currency_purchase =
    hash.key?('isCryptoCurrencyPurchase') ? hash['isCryptoCurrencyPurchase'] : 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.
  OrderInformation45.new(amount_details: amount_details,
                         is_crypto_currency_purchase: is_crypto_currency_purchase,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount_details'] = 'amountDetails'
  @_hash['is_crypto_currency_purchase'] = 'isCryptoCurrencyPurchase'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 33

def self.optionals
  %w[
    amount_details
    is_crypto_currency_purchase
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 113

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

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
# File 'lib/cyber_source_merged_spec/models/order_information45.rb', line 106

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

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'AmountDetails43',
                                 amount_details)
  XmlUtilities.add_as_subelement(doc, root, 'isCryptoCurrencyPurchase',
                                 is_crypto_currency_purchase)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end