Class: PaymentsApi::Bank

Inherits:
BaseModel show all
Defined in:
lib/payments_api/models/bank.rb

Overview

Bank Information Object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name = nil, address = nil, routing_code = nil, swift_code = nil) ⇒ Bank



36
37
38
39
40
41
42
43
44
# File 'lib/payments_api/models/bank.rb', line 36

def initialize(name = nil,
               address = nil,
               routing_code = nil,
               swift_code = nil)
  @name = name
  @address = address
  @routing_code = routing_code
  @swift_code = swift_code
end

Instance Attribute Details

#addressAddress

Address Information



15
16
17
# File 'lib/payments_api/models/bank.rb', line 15

def address
  @address
end

#nameString

Bank Name



11
12
13
# File 'lib/payments_api/models/bank.rb', line 11

def name
  @name
end

#routing_codeString

Routing Code. Currently only supported for USD wires. When using, please only provide SWIFT code OR routing code (not both)



20
21
22
# File 'lib/payments_api/models/bank.rb', line 20

def routing_code
  @routing_code
end

#swift_codeString

SWIFT BIC



24
25
26
# File 'lib/payments_api/models/bank.rb', line 24

def swift_code
  @swift_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/payments_api/models/bank.rb', line 47

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  name = hash['name']
  address = Address.from_hash(hash['address']) if hash['address']
  routing_code = hash['routingCode']
  swift_code = hash['swiftCode']

  # Create object from extracted values.

  Bank.new(name,
           address,
           routing_code,
           swift_code)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
34
# File 'lib/payments_api/models/bank.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['routing_code'] = 'routingCode'
  @_hash['swift_code'] = 'swiftCode'
  @_hash
end