Class: Plaid::ItemApi

Inherits:
BaseApi show all
Defined in:
lib/plaid/apis/item_api.rb

Overview

ItemApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Plaid::BaseApi

Instance Method Details

#item_access_token_invalidate(body) ⇒ ApiResponse

By default, the ‘access_token` associated with an Item does not expire and should be stored in a persistent, secure manner. You can use the `/item/access_token/invalidate` endpoint to rotate the `access_token` associated with an Item. The endpoint returns a new `access_token` and immediately invalidates the previous `access_token`. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/plaid/apis/item_api.rb', line 17

def item_access_token_invalidate(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/access_token/invalidate',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemAccessTokenInvalidateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#item_application_list(body) ⇒ ApiResponse

List a user’s connected applications description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/plaid/apis/item_api.rb', line 72

def item_application_list(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/application/list',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemApplicationListResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#item_application_scopes_update(body) ⇒ ApiResponse

Enable consumers to update product access on selected accounts for an application. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/plaid/apis/item_api.rb', line 189

def item_application_scopes_update(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/application/scopes/update',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemApplicationScopesUpdateResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#item_create_public_token(body) ⇒ ApiResponse

Note: As of July 2020, the ‘/item/public_token/create` endpoint is deprecated. Instead, use `/link/token/create` with an `access_token` to create a Link token for use with [update mode](plaid.com/docs/link/update-mode). If you need your user to take action to restore or resolve an error associated with an Item, generate a public token with the `/item/public_token/create` endpoint and then initialize Link with that `public_token`. A `public_token` is one-time use and expires after 30 minutes. You use a `public_token` to initialize Link in [update mode](plaid.com/docs/link/update-mode) for a particular Item. You can generate a `public_token` for an Item even if you did not use Link to create the Item originally. The `/item/public_token/create` endpoint is not used to create your initial `public_token`. If you have not already received an `access_token` for a specific Item, use Link to obtain your `public_token` instead. See the [Quickstart](plaid.com/docs/quickstart) for more information. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/plaid/apis/item_api.rb', line 166

def item_create_public_token(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/public_token/create',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemPublicTokenCreateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#item_get(body) ⇒ ApiResponse

Returns information about the status of an Item. here

Parameters:

  • body (ItemGetRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/plaid/apis/item_api.rb', line 125

def item_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/get',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemGetResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#item_import(body) ⇒ ApiResponse

‘/item/import` creates an Item via your Plaid Exchange Integration and returns an `access_token`. As part of an `/item/import` request, you will include a User ID (`user_auth.user_id`) and Authentication Token (`user_auth.auth_token`) that enable data aggregation through your Plaid Exchange API endpoints. These authentication principals are to be chosen by you. Upon creating an Item via `/item/import`, Plaid will automatically begin an extraction of that Item through the Plaid Exchange infrastructure you have already integrated. This will automatically generate the Plaid native account ID for the account the user will switch their direct deposit to (`target_account_id`). here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/plaid/apis/item_api.rb', line 249

def item_import(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/import',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemImportResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#item_public_token_exchange(body) ⇒ ApiResponse

Exchange a Link ‘public_token` for an API `access_token`. Link hands off the `public_token` client-side via the `onSuccess` callback once a user has successfully created an Item. The `public_token` is ephemeral and expires after 30 minutes. The response also includes an `item_id` that should be stored with the `access_token`. The `item_id` is used to identify an Item in a webhook. The `item_id` can also be retrieved by making an `/item/get` request. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/plaid/apis/item_api.rb', line 103

def item_public_token_exchange(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/public_token/exchange',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemPublicTokenExchangeResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#item_remove(body) ⇒ ApiResponse

The ‘/item/remove` endpoint allows you to remove an Item. Once removed, the `access_token` associated with the Item is no longer valid and cannot be used to access any data that was associated with the Item. Note that in the Development environment, issuing an `/item/remove` request will not decrement your live credential count. To increase your credential account in Development, contact Support. Also note that for certain OAuth-based institutions, an Item removed via `/item/remove` may still show as an active connection in the institution’s OAuth permission manager. here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/plaid/apis/item_api.rb', line 47

def item_remove(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/remove',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemRemoveResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end

#item_webhook_update(body) ⇒ ApiResponse

The POST ‘/item/webhook/update` allows you to update the webhook URL associated with an Item. This request triggers a [`WEBHOOK_UPDATE_ACKNOWLEDGED`](plaid.com/docs/api/webhooks/#item- webhook-url-updated) webhook to the newly specified webhook URL. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/plaid/apis/item_api.rb', line 217

def item_webhook_update(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/item/webhook/update',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemWebhookUpdateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end