Class: ModernTreasury::RoutingNumberLookupRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/routing_number_lookup_request.rb

Overview

RoutingNumberLookupRequest 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(routing_number: SKIP, routing_number_type: SKIP, supported_payment_types: SKIP, bank_name: SKIP, bank_address: SKIP, sanctions: SKIP) ⇒ RoutingNumberLookupRequest

Returns a new instance of RoutingNumberLookupRequest.



72
73
74
75
76
77
78
79
80
81
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 72

def initialize(routing_number: SKIP, routing_number_type: SKIP,
               supported_payment_types: SKIP, bank_name: SKIP,
               bank_address: SKIP, sanctions: SKIP)
  @routing_number = routing_number unless routing_number == SKIP
  @routing_number_type = routing_number_type unless routing_number_type == SKIP
  @supported_payment_types = supported_payment_types unless supported_payment_types == SKIP
  @bank_name = bank_name unless bank_name == SKIP
  @bank_address = bank_address unless bank_address == SKIP
  @sanctions = sanctions unless sanctions == SKIP
end

Instance Attribute Details

#bank_addressAddressRequest

The name of the bank.

Returns:



34
35
36
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 34

def bank_address
  @bank_address
end

#bank_nameString

The name of the bank.

Returns:

  • (String)


30
31
32
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 30

def bank_name
  @bank_name
end

#routing_numberString

The routing number of the bank.

Returns:

  • (String)


14
15
16
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 14

def routing_number
  @routing_number
end

#routing_number_typeRoutingNumberType7

One of ‘aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`, `in_ifsc`, `my_branch_code`, or `swift`. In sandbox mode we currently only support `aba` and `swift` with routing numbers ’123456789’ and ‘GRINUST0XXX’ respectively.

Returns:



21
22
23
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 21

def routing_number_type
  @routing_number_type
end

#sanctionsObject

An object containing key-value pairs, each with a sanctions list as the key and a boolean value representing whether the bank is on that particular sanctions list. Currently, this includes eu_con, uk_hmt, us_ofac, and un sanctions lists.

Returns:

  • (Object)


41
42
43
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 41

def sanctions
  @sanctions
end

#supported_payment_typesArray[SupportedPaymentType]

An array of payment types that are supported for this routing number. This can include ‘ach`, `wire`, `rtp`, `sepa`, `bacs`, `au_becs` currently.

Returns:



26
27
28
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 26

def supported_payment_types
  @supported_payment_types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  routing_number =
    hash.key?('routing_number') ? hash['routing_number'] : SKIP
  routing_number_type =
    hash.key?('routing_number_type') ? hash['routing_number_type'] : SKIP
  supported_payment_types =
    hash.key?('supported_payment_types') ? hash['supported_payment_types'] : SKIP
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
  bank_address = AddressRequest.from_hash(hash['bank_address']) if hash['bank_address']
  sanctions = hash.key?('sanctions') ? hash['sanctions'] : SKIP

  # Create object from extracted values.
  RoutingNumberLookupRequest.new(routing_number: routing_number,
                                 routing_number_type: routing_number_type,
                                 supported_payment_types: supported_payment_types,
                                 bank_name: bank_name,
                                 bank_address: bank_address,
                                 sanctions: sanctions)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['routing_number'] = 'routing_number'
  @_hash['routing_number_type'] = 'routing_number_type'
  @_hash['supported_payment_types'] = 'supported_payment_types'
  @_hash['bank_name'] = 'bank_name'
  @_hash['bank_address'] = 'bank_address'
  @_hash['sanctions'] = 'sanctions'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 56

def self.optionals
  %w[
    routing_number
    routing_number_type
    supported_payment_types
    bank_name
    bank_address
    sanctions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
# File 'lib/modern_treasury/models/routing_number_lookup_request.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} routing_number: #{@routing_number.inspect}, routing_number_type:"\
  " #{@routing_number_type.inspect}, supported_payment_types:"\
  " #{@supported_payment_types.inspect}, bank_name: #{@bank_name.inspect}, bank_address:"\
  " #{@bank_address.inspect}, sanctions: #{@sanctions.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} routing_number: #{@routing_number}, routing_number_type:"\
  " #{@routing_number_type}, supported_payment_types: #{@supported_payment_types}, bank_name:"\
  " #{@bank_name}, bank_address: #{@bank_address}, sanctions: #{@sanctions}>"
end