Class: VisaAcceptanceMergedSpec::Bank

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/bank.rb

Overview

Bank 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(account: SKIP, routing_number: SKIP, iban: SKIP, swift_code: SKIP, code: SKIP, additional_properties: nil) ⇒ Bank

Returns a new instance of Bank.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 64

def initialize(account: SKIP, routing_number: SKIP, iban: SKIP,
               swift_code: SKIP, code: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account =  unless  == SKIP
  @routing_number = routing_number unless routing_number == SKIP
  @iban = iban unless iban == SKIP
  @swift_code = swift_code unless swift_code == SKIP
  @code = code unless code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountAccount

TODO: Write general description for this method

Returns:



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

def 
  @account
end

#codeString

Bank code of the consumer’s account

Returns:

  • (String)


35
36
37
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 35

def code
  @code
end

#ibanString

International Bank Account Number (IBAN) for the bank account. For some countries you can provide this number instead of the traditional bank account information. You can use this field only when scoring a direct debit transaction.

Returns:

  • (String)


25
26
27
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 25

def iban
  @iban
end

#routing_numberString

Bank routing number. This is also called the transit number.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 18

def routing_number
  @routing_number
end

#swift_codeString

Bank’s SWIFT code. You can use this field only when scoring a direct debit transaction. Required only for crossborder transactions.

Returns:

  • (String)


31
32
33
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 31

def swift_code
  @swift_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = Account.from_hash(hash['account']) if hash['account']
  routing_number = hash.key?('routingNumber') ? hash['routingNumber'] : SKIP
  iban = hash.key?('iban') ? hash['iban'] : SKIP
  swift_code = hash.key?('swiftCode') ? hash['swiftCode'] : SKIP
  code = hash.key?('code') ? hash['code'] : 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.
  Bank.new(account: ,
           routing_number: routing_number,
           iban: iban,
           swift_code: swift_code,
           code: code,
           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account'] = 'account'
  @_hash['routing_number'] = 'routingNumber'
  @_hash['iban'] = 'iban'
  @_hash['swift_code'] = 'swiftCode'
  @_hash['code'] = 'code'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 49

def self.optionals
  %w[
    account
    routing_number
    iban
    swift_code
    code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
# File 'lib/visa_acceptance_merged_spec/models/bank.rb', line 105

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