Class: ThePlaidApi::ItemWithConsentFields

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

Overview

Metadata about the Item

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(item_id:, webhook:, error:, available_products:, billed_products:, consent_expiration_time:, update_type:, institution_id: SKIP, institution_name: SKIP, auth_method: SKIP, products: SKIP, consented_products: SKIP, created_at: SKIP, consented_use_cases: SKIP, consented_data_scopes: SKIP, additional_properties: nil) ⇒ ItemWithConsentFields

Returns a new instance of ItemWithConsentFields.



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 198

def initialize(item_id:, webhook:, error:, available_products:,
               billed_products:, consent_expiration_time:, update_type:,
               institution_id: SKIP, institution_name: SKIP,
               auth_method: SKIP, products: SKIP, consented_products: SKIP,
               created_at: SKIP, consented_use_cases: SKIP,
               consented_data_scopes: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_id = item_id
  @institution_id = institution_id unless institution_id == SKIP
  @institution_name = institution_name unless institution_name == SKIP
  @webhook = webhook
  @auth_method = auth_method unless auth_method == SKIP
  @error = error
  @available_products = available_products
  @billed_products = billed_products
  @products = products unless products == SKIP
  @consented_products = consented_products unless consented_products == SKIP
  @consent_expiration_time = consent_expiration_time
  @update_type = update_type
  @created_at = created_at unless created_at == SKIP
  @consented_use_cases = consented_use_cases unless consented_use_cases == SKIP
  @consented_data_scopes = consented_data_scopes unless consented_data_scopes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auth_methodItemAuthMethod

The method used to populate Auth data for the Item. This field is only populated for Items that have had Auth numbers data set on at least one of its accounts, and will be ‘null` otherwise. For info about the various flows, see our [Auth coverage documentation](plaid.com/docs/auth/coverage/). `INSTANT_AUTH`: The Item’s Auth data was provided directly by the user’s institution connection. ‘INSTANT_MATCH`: The Item’s Auth data was provided via the Instant Match fallback flow. ‘AUTOMATED_MICRODEPOSITS`: The Item’s Auth data was provided via the Automated Micro-deposits flow. ‘SAME_DAY_MICRODEPOSITS`: The Item’s Auth data was provided via the Same Day Micro-deposits flow. ‘INSTANT_MICRODEPOSITS`: The Item’s Auth data was provided via the Instant Micro-deposits flow. ‘DATABASE_MATCH`: The Item’s Auth data was provided via the Database Match flow. ‘DATABASE_INSIGHTS`: The Item’s Auth data was provided via the Database Insights flow. ‘TRANSFER_MIGRATED`: The Item’s Auth data was provided via [‘/transfer/migrate_account`](plaid.com/docs/api/products/transfer /account-linking/#migrate-account-into-transfers). `INVESTMENTS_FALLBACK`: The Item’s Auth data for Investments Move was provided via a [fallback flow](plaid.com/docs/investments-move/#fallback-flows).

Returns:



62
63
64
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 62

def auth_method
  @auth_method
end

#available_productsArray[Products]

A list of products available for the Item that have not yet been accessed. The contents of this array will be mutually exclusive with ‘billed_products`.

Returns:



80
81
82
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 80

def available_products
  @available_products
end

#billed_productsArray[Products]

A list of products that have been billed for the Item. The contents of this array will be mutually exclusive with ‘available_products`. Note - `billed_products` is populated in all environments but only requests in Production are billed. Also note that products that are billed on a pay-per-call basis rather than a pay-per-Item basis, such as `balance`, will not appear here.

Returns:



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

def billed_products
  @billed_products
end

The date and time at which the Item’s access consent will expire, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format. If the Item does not have consent expiration scheduled, this field will be ‘null`. Currently, only institutions in Europe and a small number of institutions in the US have expiring consent. For a list of US institutions that currently expire consent, see the [OAuth Guide](plaid.com/docs/link/oauth/#refreshing-item-consent).

Returns:

  • (DateTime)


118
119
120
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 118

def consent_expiration_time
  @consent_expiration_time
end

#consented_data_scopesArray[ConsentedDataScope]

A list of data scopes that the user has consented to for the Item via [Data Transparency Messaging](plaid.com/docs/link/data-transparency-messaging-migrati on-guide). These are based on the ‘consented_products`; see the [full mapping](plaid.com/docs/link/data-transparency-messaging-migration -guide/#data-scopes-by-product) of data scopes and products.

Returns:



149
150
151
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 149

def consented_data_scopes
  @consented_data_scopes
end

#consented_productsArray[Products]

A list of products that the user has consented to for the Item via [Data Transparency Messaging](plaid.com/docs/link/data-transparency-messaging-migrati on-guide). This will consist of all products where both of the following are true: the user has consented to the required data scopes for that product and you have Production access for that product.

Returns:



108
109
110
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 108

def consented_products
  @consented_products
end

#consented_use_casesArray[String]

A list of use cases that the user has consented to for the Item via [Data Transparency Messaging](plaid.com/docs/link/data-transparency-messaging-migrati on-guide). You can see the full list of use cases or update the list of use cases to request at any time via the Link Customization section of the [Plaid Dashboard](dashboard.plaid.com/link/data-transparency-v5).

Returns:

  • (Array[String])


140
141
142
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 140

def consented_use_cases
  @consented_use_cases
end

#created_atDateTime

The date and time when the Item was created, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


130
131
132
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 130

def created_at
  @created_at
end

#errorError

Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.

Returns:



74
75
76
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 74

def error
  @error
end

#institution_idString

The Plaid Institution ID associated with the Item. Field is ‘null` for Items created without an institution connection, such as Items created via Same Day Micro-deposits.

Returns:

  • (String)


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

def institution_id
  @institution_id
end

#institution_nameString

The name of the institution associated with the Item. Field is ‘null` for Items created without an institution connection, such as Items created via Same Day Micro-deposits.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 30

def institution_name
  @institution_name
end

#item_idString

The Plaid Item ID. The ‘item_id` is always unique; linking the same account at the same institution twice will result in two Items with different `item_id` values. Like all Plaid identifiers, the `item_id` is case-sensitive.

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 18

def item_id
  @item_id
end

#productsArray[Products]

A list of products added to the Item. In almost all cases, this will be the same as the ‘billed_products` field. For some products, it is possible for the product to be added to an Item but not yet billed (e.g. Assets, before `/asset_report/create` has been called, or Auth or Identity when added as Optional Products but before their endpoints have been called), in which case the product may appear in `products` but not in `billed_products`.

Returns:



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

def products
  @products
end

#update_typeUpdateType

Indicates whether an Item requires user interaction to be updated, which can be the case for Items with some forms of two-factor authentication. ‘background` - Item can be updated in the background `user_present_required` - Item requires user interaction to be updated

Returns:



125
126
127
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 125

def update_type
  @update_type
end

#webhookString

The URL registered to receive webhooks for the Item.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 34

def webhook
  @webhook
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 226

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  webhook = hash.key?('webhook') ? hash['webhook'] : nil
  error = Error.from_hash(hash['error']) if hash['error']
  available_products =
    hash.key?('available_products') ? hash['available_products'] : nil
  billed_products =
    hash.key?('billed_products') ? hash['billed_products'] : nil
  consent_expiration_time = if hash.key?('consent_expiration_time')
                              (DateTimeHelper.from_rfc3339(hash['consent_expiration_time']) if hash['consent_expiration_time'])
                            end
  update_type = hash.key?('update_type') ? hash['update_type'] : nil
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : SKIP
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : SKIP
  auth_method = hash.key?('auth_method') ? hash['auth_method'] : SKIP
  products = hash.key?('products') ? hash['products'] : SKIP
  consented_products =
    hash.key?('consented_products') ? hash['consented_products'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  consented_use_cases =
    hash.key?('consented_use_cases') ? hash['consented_use_cases'] : SKIP
  consented_data_scopes =
    hash.key?('consented_data_scopes') ? hash['consented_data_scopes'] : 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.
  ItemWithConsentFields.new(item_id: item_id,
                            webhook: webhook,
                            error: error,
                            available_products: available_products,
                            billed_products: billed_products,
                            consent_expiration_time: consent_expiration_time,
                            update_type: update_type,
                            institution_id: institution_id,
                            institution_name: institution_name,
                            auth_method: auth_method,
                            products: products,
                            consented_products: consented_products,
                            created_at: created_at,
                            consented_use_cases: consented_use_cases,
                            consented_data_scopes: consented_data_scopes,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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/item_with_consent_fields.rb', line 152

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_id'] = 'item_id'
  @_hash['institution_id'] = 'institution_id'
  @_hash['institution_name'] = 'institution_name'
  @_hash['webhook'] = 'webhook'
  @_hash['auth_method'] = 'auth_method'
  @_hash['error'] = 'error'
  @_hash['available_products'] = 'available_products'
  @_hash['billed_products'] = 'billed_products'
  @_hash['products'] = 'products'
  @_hash['consented_products'] = 'consented_products'
  @_hash['consent_expiration_time'] = 'consent_expiration_time'
  @_hash['update_type'] = 'update_type'
  @_hash['created_at'] = 'created_at'
  @_hash['consented_use_cases'] = 'consented_use_cases'
  @_hash['consented_data_scopes'] = 'consented_data_scopes'
  @_hash
end

.nullablesObject

An array for nullable fields



187
188
189
190
191
192
193
194
195
196
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 187

def self.nullables
  %w[
    institution_id
    institution_name
    webhook
    auth_method
    error
    consent_expiration_time
  ]
end

.optionalsObject

An array for optional fields



173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 173

def self.optionals
  %w[
    institution_id
    institution_name
    auth_method
    products
    consented_products
    created_at
    consented_use_cases
    consented_data_scopes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 307

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id.inspect}, institution_id: #{@institution_id.inspect},"\
  " institution_name: #{@institution_name.inspect}, webhook: #{@webhook.inspect}, auth_method:"\
  " #{@auth_method.inspect}, error: #{@error.inspect}, available_products:"\
  " #{@available_products.inspect}, billed_products: #{@billed_products.inspect}, products:"\
  " #{@products.inspect}, consented_products: #{@consented_products.inspect},"\
  " consent_expiration_time: #{@consent_expiration_time.inspect}, update_type:"\
  " #{@update_type.inspect}, created_at: #{@created_at.inspect}, consented_use_cases:"\
  " #{@consented_use_cases.inspect}, consented_data_scopes: #{@consented_data_scopes.inspect},"\
  " additional_properties: #{@additional_properties}>"
end


285
286
287
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 285

def to_custom_consent_expiration_time
  DateTimeHelper.to_rfc3339(consent_expiration_time)
end

#to_custom_created_atObject



289
290
291
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 289

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



294
295
296
297
298
299
300
301
302
303
304
# File 'lib/the_plaid_api/models/item_with_consent_fields.rb', line 294

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id}, institution_id: #{@institution_id}, institution_name:"\
  " #{@institution_name}, webhook: #{@webhook}, auth_method: #{@auth_method}, error:"\
  " #{@error}, available_products: #{@available_products}, billed_products:"\
  " #{@billed_products}, products: #{@products}, consented_products: #{@consented_products},"\
  " consent_expiration_time: #{@consent_expiration_time}, update_type: #{@update_type},"\
  " created_at: #{@created_at}, consented_use_cases: #{@consented_use_cases},"\
  " consented_data_scopes: #{@consented_data_scopes}, additional_properties:"\
  " #{@additional_properties}>"
end