Class: TesoteSdk::V1::Transactions
- Inherits:
-
Object
- Object
- TesoteSdk::V1::Transactions
- Defined in:
- lib/tesote_sdk/v1/transactions.rb
Constant Summary collapse
- SHOW_CACHE_TTL =
300
Instance Method Summary collapse
-
#get(id, opts: {}) ⇒ Object
GET /v1/transactions/id.
-
#initialize(transport) ⇒ Transactions
constructor
A new instance of Transactions.
-
#list_for_account(account_id, query = {}, opts: {}) ⇒ Object
GET /v1/accounts/id/transactions — convenience pass-through to V1::Accounts#list_transactions for callers that prefer to start from the transactions client.
Constructor Details
#initialize(transport) ⇒ Transactions
Returns a new instance of Transactions.
6 7 8 |
# File 'lib/tesote_sdk/v1/transactions.rb', line 6 def initialize(transport) @transport = transport end |
Instance Method Details
#get(id, opts: {}) ⇒ Object
GET /v1/transactions/id
21 22 23 24 25 26 27 |
# File 'lib/tesote_sdk/v1/transactions.rb', line 21 def get(id, opts: {}) raise ArgumentError, 'id is required' if id.nil? || id.to_s.empty? merged = opts.key?(:cache) ? opts : opts.merge(cache: { ttl: SHOW_CACHE_TTL }) body = @transport.request('GET', "transactions/#{id}", opts: merged) Models::Transaction.from_hash(body) end |
#list_for_account(account_id, query = {}, opts: {}) ⇒ Object
GET /v1/accounts/id/transactions — convenience pass-through to V1::Accounts#list_transactions for callers that prefer to start from the transactions client.
13 14 15 16 17 18 |
# File 'lib/tesote_sdk/v1/transactions.rb', line 13 def list_for_account(account_id, query = {}, opts: {}) raise ArgumentError, 'account_id is required' if account_id.nil? || account_id.to_s.empty? body = @transport.request('GET', "accounts/#{account_id}/transactions", query: query, opts: opts) Models::TransactionList.from_hash(body) end |