Class: CyberSourceMergedSpec::PaymentType13

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

Overview

PaymentType13 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(method: SKIP, name: SKIP, additional_properties: nil) ⇒ PaymentType13

Returns a new instance of PaymentType13.



51
52
53
54
55
56
57
58
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 51

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

  @method = method unless method == SKIP
  @name = name unless name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#methodMethod13

TODO: Write general description for this method

Returns:



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

def method
  @method
end

#nameString

A Payment Type is an agreed means for a payee to receive legal tender from a payer. The way one pays for a commercial financial transaction. Examples: Card, Bank Transfer, Digital, Direct Debit. Possible values:

  • EWALLET
  • directDebitSepa
  • directDebitBacs

SEPA/BACS

Required for mandates services

Paypal

Required for billing agreements

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 28

def name
  @name
end

Class Method Details

.from_element(root) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 81

def self.from_element(root)
  method = XmlUtilities.from_element(root, 'Method13', Method13)
  name = XmlUtilities.from_element(root, 'name', String)

  new(method: method,
      name: name,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  method = Method13.from_hash(hash['method']) if hash['method']
  name = hash.key?('name') ? hash['name'] : 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.
  PaymentType13.new(method: method,
                    name: name,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['method'] = 'method'
  @_hash['name'] = 'name'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 39

def self.optionals
  %w[
    method
    name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 109

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

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 102

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

#to_xml_element(doc, root_name) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/cyber_source_merged_spec/models/payment_type13.rb', line 90

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

  XmlUtilities.add_as_subelement(doc, root, 'Method13', method)
  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end