Class: Coinbase::Transactions

Inherits:
Client
  • Object
show all
Defined in:
lib/coinbase/transactions.rb

Overview

Coinbase Transactio APIs

Constant Summary collapse

TRANSACTION_BASE_URL =
'/accounts'

Instance Method Summary collapse

Methods inherited from Client

configuration, configure, #delete, #get, #headers, #http_request, #post, #put, #signature

Methods included from Util

#base_uri, #build_query_params, #format_response, #pagination_params, #send_request

Constructor Details

#initialize(account_id) ⇒ Object

Initializes the API client for transaction.

Parameters:

  • account_id (String)

    The ID of the account.



12
13
14
15
# File 'lib/coinbase/transactions.rb', line 12

def initialize()
  @account_id = 
  super()
end

Instance Method Details

#holds(paginate_options = {}) ⇒ Hash

List holds of an account.

before [String] Request page before (newer) this pagination id (optional). after [String] Request page after (older) this pagination id (optional). limit [Integer] Number of results per request.

Parameters:

  • paginate_options (Hash) (defaults to: {})

    an hash with the following parameters

Returns:

  • (Hash)

    a list of transactions records.



39
40
41
42
43
44
45
# File 'lib/coinbase/transactions.rb', line 39

def holds(paginate_options = {})
  operation_url = "#{TRANSACTION_BASE_URL}/#{@account_id}/holds"
  query_params = build_query_params(paginate_options)
  operation_url += '/?' + query_params if query_params.present?
  response = get(operation_url)
  format_response(response)
end

#ledger(paginate_options = {}) ⇒ Hash

Lists account activity. By default it will return recent 25 transactions.

before [String] Request page before (newer) this pagination id (optional). after [String] Request page after (older) this pagination id (optional). limit [Integer] Number of results per request.

Parameters:

  • paginate_options (Hash) (defaults to: {})

    an hash with the following parameters

Returns:

  • (Hash)

    a list of transactions records.



24
25
26
27
28
29
30
# File 'lib/coinbase/transactions.rb', line 24

def ledger(paginate_options = {})
  operation_url = "#{TRANSACTION_BASE_URL}/#{@account_id}/ledger"
  query_params = build_query_params(paginate_options)
  operation_url += '/?' + query_params if query_params.present?
  response = get(operation_url)
  format_response(response)
end