Class: BridgeBankin::Stock

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

Overview

Stock resource

Constant Summary collapse

RESOURCE_TYPE =
"stock"

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 stock 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:



52
53
54
55
56
57
# File 'lib/bridge_bankin/stock.rb', line 52

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

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

List all logged in user stocks

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

    the user accounts



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

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

.list_updated(access_token:, **params) ⇒ Array<Stock>

List all logged in user updated stocks

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

    the user accounts



36
37
38
39
40
41
# File 'lib/bridge_bankin/stock.rb', line 36

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