Class: BridgeBankin::Item

Inherits:
BridgeObject show all
Extended by:
API::Resource
Defined in:
lib/bridge_bankin/item.rb

Overview

Item resource (bank connector)

Constant Summary collapse

RESOURCE_TYPE =
"item"

Constants inherited from BridgeObject

BridgeObject::HIDDEN_ATTRIBUTES

Class Method Summary collapse

Methods inherited from BridgeObject

#==, convert_to_bridge_object, #initialize, #to_hash, #to_json

Constructor Details

This class inherits a constructor from BridgeBankin::BridgeObject

Class Method Details

.delete(id:, access_token:, **params) ⇒ Boolean

Delete a specific item

Parameters:

  • id (Integer)

    the id of the requested resource

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Boolean)

    the request success status



87
88
89
90
91
92
# File 'lib/bridge_bankin/item.rb', line 87

def delete(id:, access_token:, **params)
  protected_resource(access_token) do
    api_client.delete("/v2/items/#{id}", **params)
    true
  end
end

.find(id:, access_token:, **params) ⇒ Account

Retrieve a single item for logged in user

Parameters:

  • id (Integer)

    the id of the requested resource

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Account)

    the requested user item



39
40
41
42
43
44
# File 'lib/bridge_bankin/item.rb', line 39

def find(id:, access_token:, **params)
  protected_resource(access_token) do
    data = api_client.get("/v2/items/#{id}", **params)
    convert_to_bridge_object(**data)
  end
end

.list(access_token:, **params) ⇒ Array<Item>

List all logged in user items

Parameters:

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Array<Item>)

    the user items



23
24
25
26
27
28
# File 'lib/bridge_bankin/item.rb', line 23

def list(access_token:, **params)
  protected_resource(access_token) do
    data = api_client.get("/v2/items", **params)
    convert_to_bridge_object(**data)
  end
end

.refresh(id:, access_token:, **params) ⇒ BridgeObject

Trigger a refresh for a specific item

Parameters:

  • id (Integer)

    the id of the requested resource

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:



55
56
57
58
59
60
# File 'lib/bridge_bankin/item.rb', line 55

def refresh(id:, access_token:, **params)
  protected_resource(access_token) do
    data = api_client.post("/v2/items/#{id}/refresh", **params)
    convert_to_bridge_object(**data)
  end
end

.refresh_status(id:, access_token:, **params) ⇒ BridgeObject

Request the refresh status of a specific item

Parameters:

  • id (Integer)

    the id of the requested resource

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:



71
72
73
74
75
76
# File 'lib/bridge_bankin/item.rb', line 71

def refresh_status(id:, access_token:, **params)
  protected_resource(access_token) do
    data = api_client.get("/v2/items/#{id}/refresh/status", **params)
    convert_to_bridge_object(**data)
  end
end