Class: Coinbase::Accounts

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

Overview

Coinbase Accounts APIs

Constant Summary collapse

ACCOUNT_BASE =
'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

#initializeAccounts



8
9
10
# File 'lib/coinbase/accounts.rb', line 8

def initialize
  super
end

Instance Method Details

#fetch(account_id) ⇒ Hash

Show current user account by account_id.



67
68
69
70
71
72
73
# File 'lib/coinbase/accounts.rb', line 67

def fetch()
  format_response(
    get(
      "/#{ACCOUNT_BASE}/#{account_id}"
    )
  )
end

#history(account_id, options = {}) ⇒ Array of Hashes

History List account activity of the API key’s profile.

from this account id. If set, returns ledger entries before the specified integer. If set, returns ledger entries after the specified integer. the start_date timestamp, sorted by newest creation date. When combined with end_date, returns ledger entries in the specified time range. the end_date timestamp, sorted by newest creation date.



40
41
42
43
44
45
46
47
48
49
# File 'lib/coinbase/accounts.rb', line 40

def history(, options = {})
  operational_url = "/#{ACCOUNT_BASE}/#{account_id}/ledger"
  query_params = build_query_params(options)
  operational_url += '?' + query_params unless query_params.empty?
  format_response(
    get(
      operational_url
    )
  )
end

#holds(account_id) ⇒ Array of Hashes

Holds of an account that belong to the same profile as the API key.



55
56
57
58
59
60
61
# File 'lib/coinbase/accounts.rb', line 55

def holds()
  format_response(
    get(
      "/#{ACCOUNT_BASE}/#{account_id}/holds"
    )
  )
end

#listArray of Hashes

Lists current user accounts.



15
16
17
18
19
20
21
# File 'lib/coinbase/accounts.rb', line 15

def list
  format_response(
    get(
      "/#{ACCOUNT_BASE}"
    )
  )
end