Class: ThePlaidApi::Institution

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/institution.rb

Overview

Details relating to a specific financial institution

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(institution_id:, name:, products:, country_codes:, routing_numbers:, oauth:, url: SKIP, primary_color: SKIP, logo: SKIP, dtc_numbers: SKIP, status: SKIP, payment_initiation_metadata: SKIP, auth_metadata: SKIP, additional_properties: nil) ⇒ Institution

Returns a new instance of Institution.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/institution.rb', line 145

def initialize(institution_id:, name:, products:, country_codes:,
               routing_numbers:, oauth:, url: SKIP, primary_color: SKIP,
               logo: SKIP, dtc_numbers: SKIP, status: SKIP,
               payment_initiation_metadata: SKIP, auth_metadata: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @institution_id = institution_id
  @name = name
  @products = products
  @country_codes = country_codes
  @url = url unless url == SKIP
  @primary_color = primary_color unless primary_color == SKIP
  @logo =  unless  == SKIP
  @routing_numbers = routing_numbers
  @dtc_numbers = dtc_numbers unless dtc_numbers == SKIP
  @oauth = oauth
  @status = status unless status == SKIP
  unless  == SKIP
    @payment_initiation_metadata =
      
  end
  @auth_metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auth_metadataAuthMetadata

Metadata that captures information about the Auth features of an institution.

Returns:



99
100
101
# File 'lib/the_plaid_api/models/institution.rb', line 99

def 
  @auth_metadata
end

#country_codesArray[CountryCode]

A list of the country codes supported by the institution.

Returns:



43
44
45
# File 'lib/the_plaid_api/models/institution.rb', line 43

def country_codes
  @country_codes
end

#dtc_numbersArray[String]

A partial list of DTC numbers associated with the institution.

Returns:

  • (Array[String])


69
70
71
# File 'lib/the_plaid_api/models/institution.rb', line 69

def dtc_numbers
  @dtc_numbers
end

#institution_idString

Unique identifier for the institution. Note that the same institution may have multiple records, each with different institution IDs; for example, if the institution has migrated to OAuth, there may be separate ‘institution_id`s for the OAuth and non-OAuth versions of the institution. Institutions that operate in different countries or with multiple login portals may also have separate `institution_id`s for each country or portal.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/institution.rb', line 20

def institution_id
  @institution_id
end

#logoString

Base64 encoded representation of the institution’s logo, returned as a base64 encoded 152x152 PNG. Not all institutions’ logos are available.

Returns:

  • (String)


58
59
60
# File 'lib/the_plaid_api/models/institution.rb', line 58

def 
  @logo
end

#nameString

The official name of the institution.

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/institution.rb', line 24

def name
  @name
end

#oauthTrueClass | FalseClass

Indicates that the institution has an OAuth login flow. This will be ‘true` if OAuth is supported for any Items associated with the institution, even if the institution also supports non-OAuth connections.

Returns:

  • (TrueClass | FalseClass)


75
76
77
# File 'lib/the_plaid_api/models/institution.rb', line 75

def oauth
  @oauth
end

#payment_initiation_metadataPaymentInitiationMetadata

Metadata that captures what specific payment configurations an institution supports when making Payment Initiation requests.



94
95
96
# File 'lib/the_plaid_api/models/institution.rb', line 94

def 
  @payment_initiation_metadata
end

#primary_colorString

Hexadecimal representation of the primary color used by the institution. If Plaid does not have primary color data for the institution, this field will be a deterministically generated fallback color.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/institution.rb', line 53

def primary_color
  @primary_color
end

#productsArray[Products]

A list of the Plaid products supported by the institution. Note that only institutions that support Instant Auth will return ‘auth` in the product array; institutions that do not list `auth` may still support other Auth methods such as Instant Match or Automated Micro-deposit Verification. To identify institutions that support those methods, use the `auth_metadata` object. For more details, see [Full Auth coverage](plaid.com/docs/auth/coverage/). The `income_verification` product here indicates support for Bank Income. Note: For Signal Transaction Scores and Transfer, listed institutions may be incomplete or incorrect. Instead, use the following: `balance` support also indicates coverage of Signal Transaction Scores; `auth` support also indicates coverage of Transfer.

Returns:



39
40
41
# File 'lib/the_plaid_api/models/institution.rb', line 39

def products
  @products
end

#routing_numbersArray[String]

A list of routing numbers known to be associated with the institution. This list is provided for the purpose of looking up institutions by routing number. It is generally comprehensive but is not guaranteed to be a complete list of routing numbers for an institution.

Returns:

  • (Array[String])


65
66
67
# File 'lib/the_plaid_api/models/institution.rb', line 65

def routing_numbers
  @routing_numbers
end

#statusInstitutionStatus

The status of an institution is determined by the health of its Item logins, Transactions updates, Investments updates, Liabilities updates, Auth requests, Balance requests, Identity requests, Investments requests, and Liabilities requests. A login attempt is conducted during the initial Item add in Link. If there is not enough traffic to accurately calculate an institution’s status, Plaid will return null rather than potentially inaccurate data. Institution status is accessible in the Dashboard and via the API using the ‘/institutions/get_by_id` endpoint with the `options.include_status` option set to true. Note that institution status is not available in the Sandbox environment.

Returns:



89
90
91
# File 'lib/the_plaid_api/models/institution.rb', line 89

def status
  @status
end

#urlString

The URL for the institution’s website

Returns:

  • (String)


47
48
49
# File 'lib/the_plaid_api/models/institution.rb', line 47

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/the_plaid_api/models/institution.rb', line 173

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  products = hash.key?('products') ? hash['products'] : nil
  country_codes = hash.key?('country_codes') ? hash['country_codes'] : nil
  routing_numbers =
    hash.key?('routing_numbers') ? hash['routing_numbers'] : nil
  oauth = hash.key?('oauth') ? hash['oauth'] : nil
  url = hash.key?('url') ? hash['url'] : SKIP
  primary_color = hash.key?('primary_color') ? hash['primary_color'] : SKIP
   = hash.key?('logo') ? hash['logo'] : SKIP
  dtc_numbers = hash.key?('dtc_numbers') ? hash['dtc_numbers'] : SKIP
  status = InstitutionStatus.from_hash(hash['status']) if hash['status']
  if hash['payment_initiation_metadata']
     = PaymentInitiationMetadata.from_hash(hash['payment_initiation_metadata'])
  end
   = AuthMetadata.from_hash(hash['auth_metadata']) if hash['auth_metadata']

  # 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.
  Institution.new(institution_id: institution_id,
                  name: name,
                  products: products,
                  country_codes: country_codes,
                  routing_numbers: routing_numbers,
                  oauth: oauth,
                  url: url,
                  primary_color: primary_color,
                  logo: ,
                  dtc_numbers: dtc_numbers,
                  status: status,
                  payment_initiation_metadata: ,
                  auth_metadata: ,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/the_plaid_api/models/institution.rb', line 102

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['institution_id'] = 'institution_id'
  @_hash['name'] = 'name'
  @_hash['products'] = 'products'
  @_hash['country_codes'] = 'country_codes'
  @_hash['url'] = 'url'
  @_hash['primary_color'] = 'primary_color'
  @_hash['logo'] = 'logo'
  @_hash['routing_numbers'] = 'routing_numbers'
  @_hash['dtc_numbers'] = 'dtc_numbers'
  @_hash['oauth'] = 'oauth'
  @_hash['status'] = 'status'
  @_hash['payment_initiation_metadata'] = 'payment_initiation_metadata'
  @_hash['auth_metadata'] = 'auth_metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



134
135
136
137
138
139
140
141
142
143
# File 'lib/the_plaid_api/models/institution.rb', line 134

def self.nullables
  %w[
    url
    primary_color
    logo
    status
    payment_initiation_metadata
    auth_metadata
  ]
end

.optionalsObject

An array for optional fields



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/the_plaid_api/models/institution.rb', line 121

def self.optionals
  %w[
    url
    primary_color
    logo
    dtc_numbers
    status
    payment_initiation_metadata
    auth_metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



231
232
233
234
235
236
237
238
239
240
# File 'lib/the_plaid_api/models/institution.rb', line 231

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} institution_id: #{@institution_id.inspect}, name: #{@name.inspect},"\
  " products: #{@products.inspect}, country_codes: #{@country_codes.inspect}, url:"\
  " #{@url.inspect}, primary_color: #{@primary_color.inspect}, logo: #{@logo.inspect},"\
  " routing_numbers: #{@routing_numbers.inspect}, dtc_numbers: #{@dtc_numbers.inspect}, oauth:"\
  " #{@oauth.inspect}, status: #{@status.inspect}, payment_initiation_metadata:"\
  " #{@payment_initiation_metadata.inspect}, auth_metadata: #{@auth_metadata.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



220
221
222
223
224
225
226
227
228
# File 'lib/the_plaid_api/models/institution.rb', line 220

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} institution_id: #{@institution_id}, name: #{@name}, products: #{@products},"\
  " country_codes: #{@country_codes}, url: #{@url}, primary_color: #{@primary_color}, logo:"\
  " #{@logo}, routing_numbers: #{@routing_numbers}, dtc_numbers: #{@dtc_numbers}, oauth:"\
  " #{@oauth}, status: #{@status}, payment_initiation_metadata:"\
  " #{@payment_initiation_metadata}, auth_metadata: #{@auth_metadata}, additional_properties:"\
  " #{@additional_properties}>"
end