Class: Plaid::Numbers

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/numbers.rb

Overview

Account and bank identifier number data used to configure the test account. All values are optional.

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, ach_routing: SKIP, ach_wire_routing: SKIP, eft_institution: SKIP, eft_branch: SKIP, international_bic: SKIP, international_iban: SKIP, bacs_sort_code: SKIP, additional_properties: nil) ⇒ Numbers

Returns a new instance of Numbers.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/plaid/models/numbers.rb', line 81

def initialize(account: SKIP, ach_routing: SKIP, ach_wire_routing: SKIP,
               eft_institution: SKIP, eft_branch: SKIP,
               international_bic: SKIP, international_iban: SKIP,
               bacs_sort_code: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account =  unless  == SKIP
  @ach_routing = ach_routing unless ach_routing == SKIP
  @ach_wire_routing = ach_wire_routing unless ach_wire_routing == SKIP
  @eft_institution = eft_institution unless eft_institution == SKIP
  @eft_branch = eft_branch unless eft_branch == SKIP
  @international_bic = international_bic unless international_bic == SKIP
  @international_iban = international_iban unless international_iban == SKIP
  @bacs_sort_code = bacs_sort_code unless bacs_sort_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountString

Will be used for the account number.

Returns:

  • (String)


15
16
17
# File 'lib/plaid/models/numbers.rb', line 15

def 
  @account
end

#ach_routingString

Must be a valid ACH routing number.

Returns:

  • (String)


19
20
21
# File 'lib/plaid/models/numbers.rb', line 19

def ach_routing
  @ach_routing
end

#ach_wire_routingString

Must be a valid wire transfer routing number.

Returns:

  • (String)


23
24
25
# File 'lib/plaid/models/numbers.rb', line 23

def ach_wire_routing
  @ach_wire_routing
end

#bacs_sort_codeString

BACS sort code

Returns:

  • (String)


46
47
48
# File 'lib/plaid/models/numbers.rb', line 46

def bacs_sort_code
  @bacs_sort_code
end

#eft_branchString

EFT branch number. Must be specified alongside ‘eft_institution`.

Returns:

  • (String)


31
32
33
# File 'lib/plaid/models/numbers.rb', line 31

def eft_branch
  @eft_branch
end

#eft_institutionString

EFT institution number. Must be specified alongside ‘eft_branch`.

Returns:

  • (String)


27
28
29
# File 'lib/plaid/models/numbers.rb', line 27

def eft_institution
  @eft_institution
end

#international_bicString

Bank identifier code (BIC). Must be specified alongside ‘international_iban`.

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/numbers.rb', line 36

def international_bic
  @international_bic
end

#international_ibanString

International bank account number (IBAN). If no account number is specified via ‘account`, will also be used as the account number by default. Must be specified alongside `international_bic`.

Returns:

  • (String)


42
43
44
# File 'lib/plaid/models/numbers.rb', line 42

def international_iban
  @international_iban
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/plaid/models/numbers.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account') ? hash['account'] : SKIP
  ach_routing = hash.key?('ach_routing') ? hash['ach_routing'] : SKIP
  ach_wire_routing =
    hash.key?('ach_wire_routing') ? hash['ach_wire_routing'] : SKIP
  eft_institution =
    hash.key?('eft_institution') ? hash['eft_institution'] : SKIP
  eft_branch = hash.key?('eft_branch') ? hash['eft_branch'] : SKIP
  international_bic =
    hash.key?('international_bic') ? hash['international_bic'] : SKIP
  international_iban =
    hash.key?('international_iban') ? hash['international_iban'] : SKIP
  bacs_sort_code =
    hash.key?('bacs_sort_code') ? hash['bacs_sort_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.
  Numbers.new(account: ,
              ach_routing: ach_routing,
              ach_wire_routing: ach_wire_routing,
              eft_institution: eft_institution,
              eft_branch: eft_branch,
              international_bic: international_bic,
              international_iban: international_iban,
              bacs_sort_code: bacs_sort_code,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/plaid/models/numbers.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account'] = 'account'
  @_hash['ach_routing'] = 'ach_routing'
  @_hash['ach_wire_routing'] = 'ach_wire_routing'
  @_hash['eft_institution'] = 'eft_institution'
  @_hash['eft_branch'] = 'eft_branch'
  @_hash['international_bic'] = 'international_bic'
  @_hash['international_iban'] = 'international_iban'
  @_hash['bacs_sort_code'] = 'bacs_sort_code'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
# File 'lib/plaid/models/numbers.rb', line 77

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    account
    ach_routing
    ach_wire_routing
    eft_institution
    eft_branch
    international_bic
    international_iban
    bacs_sort_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



147
148
149
150
151
152
153
154
155
# File 'lib/plaid/models/numbers.rb', line 147

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account.inspect}, ach_routing: #{@ach_routing.inspect},"\
  " ach_wire_routing: #{@ach_wire_routing.inspect}, eft_institution:"\
  " #{@eft_institution.inspect}, eft_branch: #{@eft_branch.inspect}, international_bic:"\
  " #{@international_bic.inspect}, international_iban: #{@international_iban.inspect},"\
  " bacs_sort_code: #{@bacs_sort_code.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
144
# File 'lib/plaid/models/numbers.rb', line 138

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account}, ach_routing: #{@ach_routing}, ach_wire_routing:"\
  " #{@ach_wire_routing}, eft_institution: #{@eft_institution}, eft_branch: #{@eft_branch},"\
  " international_bic: #{@international_bic}, international_iban: #{@international_iban},"\
  " bacs_sort_code: #{@bacs_sort_code}, additional_properties: #{@additional_properties}>"
end