class Cryptopay::Accounts

Attributes

connection[R]

Public Class Methods

new(connection) click to toggle source
# File lib/cryptopay/api/accounts.rb, line 8
def initialize(connection)
  @connection = connection
end

Public Instance Methods

list(_opts = {}) click to toggle source

List accounts @param [Hash] opts the optional parameters @return [AccountListResult]

# 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 = {}) click to toggle source

List account transactions @param account_id [String] Account ID @param [Hash] opts the optional parameters @option opts [String] :starting_after Pagination parameter. ID to start after @return [TransactionListResult]

# 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