Class: VisaAcceptanceMergedSpec::PaymentType13

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_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/visa_acceptance_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

#method ⇒ Method13

TODO: Write general description for this method

Returns:



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

def method
  @method
end

#name ⇒ String

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/visa_acceptance_merged_spec/models/payment_type13.rb', line 28

def name
  @name
end

Class Method Details

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

.names ⇒ Object

A mapping from model property names to API property names.



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

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

.nullables ⇒ Object

An array for nullable fields



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

def self.nullables
  []
end

.optionals ⇒ Object

An array for optional fields



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

def self.optionals
  %w[
    method
    name
  ]
end

Instance Method Details

#inspect ⇒ Object

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
# File 'lib/visa_acceptance_merged_spec/models/payment_type13.rb', line 89

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

#to_s ⇒ Object

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/visa_acceptance_merged_spec/models/payment_type13.rb', line 82

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