Class: ThePlaidApi::Item
- Defined in:
- lib/the_plaid_api/models/item.rb
Overview
Metadata about the Item.
Instance Attribute Summary collapse
-
#auth_method ⇒ ItemAuthMethod
The method used to populate Auth data for the Item.
-
#available_products ⇒ Array[Products]
A list of products available for the Item that have not yet been accessed.
-
#billed_products ⇒ Array[Products]
A list of products that have been billed for the Item.
-
#consent_expiration_time ⇒ DateTime
The date and time at which the Item’s access consent will expire, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
-
#consented_products ⇒ Array[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).
-
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`.
-
#institution_id ⇒ String
The Plaid Institution ID associated with the Item.
-
#institution_name ⇒ String
The name of the institution associated with the Item.
-
#item_id ⇒ String
The Plaid Item ID.
-
#products ⇒ Array[Products]
A list of products added to the Item.
-
#update_type ⇒ UpdateType
Indicates whether an Item requires user interaction to be updated, which can be the case for Items with some forms of two-factor authentication.
-
#webhook ⇒ String
The URL registered to receive webhooks for the Item.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#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, additional_properties: nil) ⇒ Item
constructor
A new instance of Item.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_consent_expiration_time ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, additional_properties: nil) ⇒ Item
Returns a new instance of Item.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/the_plaid_api/models/item.rb', line 168 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, 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 = unless == SKIP @consent_expiration_time = @update_type = update_type @additional_properties = additional_properties end |
Instance Attribute Details
#auth_method ⇒ ItemAuthMethod
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).
62 63 64 |
# File 'lib/the_plaid_api/models/item.rb', line 62 def auth_method @auth_method end |
#available_products ⇒ Array[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`.
80 81 82 |
# File 'lib/the_plaid_api/models/item.rb', line 80 def available_products @available_products end |
#billed_products ⇒ Array[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.
89 90 91 |
# File 'lib/the_plaid_api/models/item.rb', line 89 def billed_products @billed_products end |
#consent_expiration_time ⇒ DateTime
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).
118 119 120 |
# File 'lib/the_plaid_api/models/item.rb', line 118 def @consent_expiration_time end |
#consented_products ⇒ Array[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.
108 109 110 |
# File 'lib/the_plaid_api/models/item.rb', line 108 def @consented_products end |
#error ⇒ Error
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.
74 75 76 |
# File 'lib/the_plaid_api/models/item.rb', line 74 def error @error end |
#institution_id ⇒ String
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.
24 25 26 |
# File 'lib/the_plaid_api/models/item.rb', line 24 def institution_id @institution_id end |
#institution_name ⇒ String
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.
30 31 32 |
# File 'lib/the_plaid_api/models/item.rb', line 30 def institution_name @institution_name end |
#item_id ⇒ String
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.
18 19 20 |
# File 'lib/the_plaid_api/models/item.rb', line 18 def item_id @item_id end |
#products ⇒ Array[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`.
99 100 101 |
# File 'lib/the_plaid_api/models/item.rb', line 99 def products @products end |
#update_type ⇒ UpdateType
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
125 126 127 |
# File 'lib/the_plaid_api/models/item.rb', line 125 def update_type @update_type end |
#webhook ⇒ String
The URL registered to receive webhooks for the Item.
34 35 36 |
# File 'lib/the_plaid_api/models/item.rb', line 34 def webhook @webhook end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/the_plaid_api/models/item.rb', line 192 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 = 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 = hash.key?('consented_products') ? hash['consented_products'] : 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. Item.new(item_id: item_id, webhook: webhook, error: error, available_products: available_products, billed_products: billed_products, consent_expiration_time: , update_type: update_type, institution_id: institution_id, institution_name: institution_name, auth_method: auth_method, products: products, consented_products: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/the_plaid_api/models/item.rb', line 128 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 end |
.nullables ⇒ Object
An array for nullable fields
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/the_plaid_api/models/item.rb', line 157 def self.nullables %w[ institution_id institution_name webhook auth_method error consent_expiration_time ] end |
.optionals ⇒ Object
An array for optional fields
146 147 148 149 150 151 152 153 154 |
# File 'lib/the_plaid_api/models/item.rb', line 146 def self.optionals %w[ institution_id institution_name auth_method products consented_products ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
255 256 257 258 259 260 261 262 263 264 |
# File 'lib/the_plaid_api/models/item.rb', line 255 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}, additional_properties: #{@additional_properties}>" end |
#to_custom_consent_expiration_time ⇒ Object
239 240 241 |
# File 'lib/the_plaid_api/models/item.rb', line 239 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
244 245 246 247 248 249 250 251 252 |
# File 'lib/the_plaid_api/models/item.rb', line 244 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},"\ " additional_properties: #{@additional_properties}>" end |