Class: VisaAcceptanceMergedSpec::Method

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_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/visa_acceptance_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/visa_acceptance_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/visa_acceptance_merged_spec/models/method.rb', line 36

def type
  @type
end

Class Method Details

.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/visa_acceptance_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/visa_acceptance_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/visa_acceptance_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/visa_acceptance_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.



97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/method.rb', line 97

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.



90
91
92
93
94
# File 'lib/visa_acceptance_merged_spec/models/method.rb', line 90

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