Class: Plaid::Institution

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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, status: SKIP, payment_initiation_metadata: SKIP, auth_metadata: SKIP, additional_properties: nil) ⇒ Institution

Returns a new instance of Institution.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/plaid/models/institution.rb', line 121

def initialize(institution_id:, name:, products:, country_codes:,
               routing_numbers:, oauth:, url: SKIP, primary_color: SKIP,
               logo: 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
  @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:



79
80
81
# File 'lib/plaid/models/institution.rb', line 79

def 
  @auth_metadata
end

#country_codesArray[CountryCode]

A list of the country codes supported by the institution.

Returns:



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

def country_codes
  @country_codes
end

#institution_idString

Unique identifier for the institution

Returns:

  • (String)


14
15
16
# File 'lib/plaid/models/institution.rb', line 14

def institution_id
  @institution_id
end

#logoString

Base64 encoded representation of the institution’s logo

Returns:

  • (String)


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

def 
  @logo
end

#nameString

The official name of the institution

Returns:

  • (String)


18
19
20
# File 'lib/plaid/models/institution.rb', line 18

def name
  @name
end

#oauthTrueClass | FalseClass

Indicates that the institution has an OAuth login flow. This is primarily relevant to institutions with European country codes.

Returns:

  • (TrueClass | FalseClass)


55
56
57
# File 'lib/plaid/models/institution.rb', line 55

def oauth
  @oauth
end

#payment_initiation_metadataPaymentInitiationMetadata

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



74
75
76
# File 'lib/plaid/models/institution.rb', line 74

def 
  @payment_initiation_metadata
end

#primary_colorString

Hexadecimal representation of the primary color used by the institution

Returns:

  • (String)


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

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. For more details, see [Full Auth coverage](plaid.com/docs/auth/coverage/).

Returns:



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

def products
  @products
end

#routing_numbersArray[String]

A partial list of routing numbers associated with the institution. This list is provided for the purpose of looking up institutions by routing number. It is not comprehensive and should never be used as a complete list of routing numbers for an institution.

Returns:

  • (Array[String])


50
51
52
# File 'lib/plaid/models/institution.rb', line 50

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 `include_status` option set to true. Note that institution status is not available in the Sandbox environment.

Returns:



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

def status
  @status
end

#urlString

The URL for the institution’s website

Returns:

  • (String)


35
36
37
# File 'lib/plaid/models/institution.rb', line 35

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/plaid/models/institution.rb', line 147

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
  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: ,
                  status: status,
                  payment_initiation_metadata: ,
                  auth_metadata: ,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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['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



112
113
114
115
116
117
118
119
# File 'lib/plaid/models/institution.rb', line 112

def self.nullables
  %w[
    url
    primary_color
    logo
    routing_numbers
  ]
end

.optionalsObject

An array for optional fields



100
101
102
103
104
105
106
107
108
109
# File 'lib/plaid/models/institution.rb', line 100

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



202
203
204
205
206
207
208
209
210
211
# File 'lib/plaid/models/institution.rb', line 202

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}, 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.



192
193
194
195
196
197
198
199
# File 'lib/plaid/models/institution.rb', line 192

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}, oauth: #{@oauth}, status: #{@status},"\
  " payment_initiation_metadata: #{@payment_initiation_metadata}, auth_metadata:"\
  " #{@auth_metadata}, additional_properties: #{@additional_properties}>"
end