Class: TesoteSdk::V2::Accounts
- Inherits:
-
Object
- Object
- TesoteSdk::V2::Accounts
- Defined in:
- lib/tesote_sdk/v2/accounts.rb
Constant Summary collapse
- INDEX_CACHE_TTL =
60- SHOW_CACHE_TTL =
300
Instance Method Summary collapse
-
#get(id, opts: {}) ⇒ Object
GET /v2/accounts/id.
-
#initialize(transport) ⇒ Accounts
constructor
A new instance of Accounts.
-
#list(query = {}, opts: {}) ⇒ Object
GET /v2/accounts.
-
#sync(id, opts: {}) ⇒ Object
POST /v2/accounts/id/sync Triggers an async sync; returns SyncStartResult (status: pending).
Constructor Details
#initialize(transport) ⇒ Accounts
Returns a new instance of Accounts.
7 8 9 |
# File 'lib/tesote_sdk/v2/accounts.rb', line 7 def initialize(transport) @transport = transport end |
Instance Method Details
#get(id, opts: {}) ⇒ Object
GET /v2/accounts/id
18 19 20 21 22 23 |
# File 'lib/tesote_sdk/v2/accounts.rb', line 18 def get(id, opts: {}) raise ArgumentError, 'id is required' if id.nil? || id.to_s.empty? body = @transport.request('GET', "accounts/#{id}", opts: with_cache(opts, SHOW_CACHE_TTL)) Models::Account.from_hash(body) end |
#list(query = {}, opts: {}) ⇒ Object
GET /v2/accounts
12 13 14 15 |
# File 'lib/tesote_sdk/v2/accounts.rb', line 12 def list(query = {}, opts: {}) body = @transport.request('GET', 'accounts', query: query, opts: with_cache(opts, INDEX_CACHE_TTL)) Models::AccountList.from_hash(body) end |
#sync(id, opts: {}) ⇒ Object
POST /v2/accounts/id/sync Triggers an async sync; returns SyncStartResult (status: pending).
27 28 29 30 31 32 |
# File 'lib/tesote_sdk/v2/accounts.rb', line 27 def sync(id, opts: {}) raise ArgumentError, 'id is required' if id.nil? || id.to_s.empty? body = @transport.request('POST', "accounts/#{id}/sync", body: {}, opts: opts) Models::SyncStartResult.from_hash(body) end |