Class: CyberSourceMergedSpec::Method

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

Overview

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

Returns a new instance of Method.



59
60
61
62
63
64
65
66
# File 'lib/cyber_source_merged_spec/models/method.rb', line 59

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

  @name = name unless name == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#nameString

A Payment Type is enabled through a Method. Examples: Visa, Master Card, ApplePay, iDeal, 7Eleven, alfamart, bofaPayByBank, payToPayByBank, etc For Japan Payment Processing Valid Values:

  • 1 Banking Data
  • 2 Authorization Data

Via KCP

  • KCP : Local Card, Bank Transfer and Carrier Billing.
  • PAYCO
  • KAKAOPAY
  • NAVERPAY

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/method.rb', line 23

def name
  @name
end

#typeString

The payment channel that facilitates the transactions. This parameter can be used if the payment channels are listed on the merchant’s site, and the payment channel is known. Possible Values:

Via PPRO

  • alfaVa
  • kredivo
  • consumerBarCode
  • merchantQrCode
  • dokuWallet

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/method.rb', line 36

def type
  @type
end

Class Method Details

.from_element(root) ⇒ Object



89
90
91
92
93
94
95
96
# File 'lib/cyber_source_merged_spec/models/method.rb', line 89

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

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cyber_source_merged_spec/models/method.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  Method.new(name: name,
             type: type,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/method.rb', line 47

def self.optionals
  %w[
    name
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/method.rb', line 117

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

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/method.rb', line 110

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

#to_xml_element(doc, root_name) ⇒ Object



98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/models/method.rb', line 98

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

  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end