Class: VisaAcceptanceMergedSpec::Bank7

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

Overview

Bank7 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, iban: SKIP, swift_code: SKIP, scheme: SKIP, additional_properties: nil) ⇒ Bank7

Returns a new instance of Bank7.



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

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

  @account =  unless  == SKIP
  @iban = iban unless iban == SKIP
  @swift_code = swift_code unless swift_code == SKIP
  @scheme = scheme unless scheme == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountAccount9

TODO: Write general description for this method

Returns:



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

def 
  @account
end

#ibanString

International Bank Account Number (IBAN).

SEPA

Required for mandates services

Returns:

  • (String)


20
21
22
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 20

def iban
  @iban
end

#schemeString

The scheme that sets the rules for the direct debit process. Possible values:

- SEPA
- BACS

SEPA/BACS

Required for mandates services

Returns:

  • (String)


36
37
38
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 36

def scheme
  @scheme
end

#swift_codeString

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

BACS

Required for mandates services

Returns:

  • (String)


27
28
29
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 27

def swift_code
  @swift_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 108

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

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/visa_acceptance_merged_spec/models/bank7.rb', line 101

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