Class: BridgeBankin::Account

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

Overview

Account resource

Constant Summary collapse

RESOURCE_TYPE =
"account"

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

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

Retrieve a single account 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:



38
39
40
41
42
43
# File 'lib/bridge_bankin/account.rb', line 38

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

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

List all logged in user accounts

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<Account>)

    the user accounts



21
22
23
24
25
26
27
# File 'lib/bridge_bankin/account.rb', line 21

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