Class: Cryptopay::Accounts
- Inherits:
-
Object
- Object
- Cryptopay::Accounts
- Defined in:
- lib/cryptopay/api/accounts.rb
Instance Method Summary collapse
-
#initialize(connection) ⇒ Accounts
constructor
A new instance of Accounts.
-
#list(_opts = {}) ⇒ AccountListResult
List accounts.
-
#list_transactions(account_id, opts = {}) ⇒ TransactionListResult
List account transactions.
Constructor Details
#initialize(connection) ⇒ Accounts
Returns a new instance of Accounts.
8 9 10 |
# File 'lib/cryptopay/api/accounts.rb', line 8 def initialize(connection) @connection = connection end |
Instance Method Details
#list(_opts = {}) ⇒ AccountListResult
List accounts
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cryptopay/api/accounts.rb', line 15 def list(_opts = {}) path = '/api/accounts' req = Request.new( method: :get, path: path ) connection.call(req, return_type: AccountListResult) end |
#list_transactions(account_id, opts = {}) ⇒ TransactionListResult
List account transactions
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cryptopay/api/accounts.rb', line 31 def list_transactions(account_id, opts = {}) path = '/api/accounts/{account_id}/transactions' path = path.sub('{account_id}', CGI.escape(account_id.to_s)) query_params = {} query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil? req = Request.new( method: :get, path: path, query_params: query_params ) connection.call(req, return_type: TransactionListResult) end |