Class: CyberSourceMergedSpec::Bank
- Defined in:
- lib/cyber_source_merged_spec/models/bank.rb
Overview
Bank Model.
Instance Attribute Summary collapse
-
#account ⇒ Account
TODO: Write general description for this method.
-
#account_alias ⇒ AccountAlias
Bank code of the consumer’s account.
-
#code ⇒ String
Bank code of the consumer’s account.
-
#iban ⇒ String
International Bank Account Number (IBAN) for the bank account.
-
#routing_number ⇒ String
Bank routing number.
-
#swift_code ⇒ String
Bank’s SWIFT code.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account: SKIP, routing_number: SKIP, iban: SKIP, swift_code: SKIP, code: SKIP, account_alias: SKIP, additional_properties: nil) ⇒ Bank
constructor
A new instance of Bank.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
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, account_alias: SKIP, additional_properties: nil) ⇒ Bank
Returns a new instance of Bank.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 70 def initialize(account: SKIP, routing_number: SKIP, iban: SKIP, swift_code: SKIP, code: SKIP, account_alias: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account = account unless account == 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 @account_alias = account_alias unless account_alias == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account ⇒ Account
TODO: Write general description for this method
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 14 def account @account end |
#account_alias ⇒ AccountAlias
Bank code of the consumer’s account
39 40 41 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 39 def account_alias @account_alias end |
#code ⇒ String
Bank code of the consumer’s account
35 36 37 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 35 def code @code end |
#iban ⇒ String
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.
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 25 def iban @iban end |
#routing_number ⇒ String
Bank routing number. This is also called the transit number.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 18 def routing_number @routing_number end |
#swift_code ⇒ String
Bank’s SWIFT code. You can use this field only when scoring a direct debit transaction. Required only for crossborder transactions.
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 31 def swift_code @swift_code end |
Class Method Details
.from_element(root) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 114 def self.from_element(root) account = XmlUtilities.from_element(root, 'Account', Account) routing_number = XmlUtilities.from_element(root, 'routingNumber', String) iban = XmlUtilities.from_element(root, 'iban', String) swift_code = XmlUtilities.from_element(root, 'swiftCode', String) code = XmlUtilities.from_element(root, 'code', String) account_alias = XmlUtilities.from_element(root, 'AccountAlias', AccountAlias) new(account: account, routing_number: routing_number, iban: iban, swift_code: swift_code, code: code, account_alias: account_alias, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account = 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 account_alias = AccountAlias.from_hash(hash['accountAlias']) if hash['accountAlias'] # 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: account, routing_number: routing_number, iban: iban, swift_code: swift_code, code: code, account_alias: account_alias, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 42 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['account_alias'] = 'accountAlias' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 54 def self.optionals %w[ account routing_number iban swift_code code account_alias ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
156 157 158 159 160 161 162 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 156 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},"\ " account_alias: #{@account_alias.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
148 149 150 151 152 153 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 148 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}, account_alias: #{@account_alias},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/cyber_source_merged_spec/models/bank.rb', line 132 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'Account', account) XmlUtilities.add_as_subelement(doc, root, 'routingNumber', routing_number) XmlUtilities.add_as_subelement(doc, root, 'iban', iban) XmlUtilities.add_as_subelement(doc, root, 'swiftCode', swift_code) XmlUtilities.add_as_subelement(doc, root, 'code', code) XmlUtilities.add_as_subelement(doc, root, 'AccountAlias', account_alias) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |