Class: Coinbase::Deposits

Inherits:
Transfers show all
Defined in:
lib/coinbase/deposits.rb

Overview

Deposite coinbase APIs

Constant Summary collapse

DEFAULT_TYPE =
'deposit'

Instance Method Summary collapse

Methods inherited from Transfers

#fetch, #payment_methods

Methods inherited from Client

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

Methods included from Util

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

Constructor Details

This class inherits a constructor from Coinbase::Client

Instance Method Details

#by_account(deposit_details) ⇒ Hash

Deposit funds from a coinbase account.

amount [Float] The amount to deposit. currency [String] The type of currency. coinbase_account_id [String] ID of coinbase account.

Parameters:

  • deposit_details (Hash)

    with following fields

Returns:

  • (Hash)

    a hash with status code and deposit details.



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

def (deposit_details)
  response = post(
    '/deposits/coinbase-account', body: deposit_details
  )
  format_response(response)
end

#by_method(deposit_details) ⇒ Hash

Deposit funds from a payment method.

amount [Float] The amount to deposit. currency [String] The type of currency. payment_method_id [String] ID of the payment method.

Parameters:

  • deposit_details (Hash)

    with following fields

Returns:

  • (Hash)

    a hash with status code and deposit details.



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

def by_method(deposit_details)
  response = post(
    '/deposits/payment-method',
    body: deposit_details
  )
  format_response(response)
end

#generate_address(coinbase_account_id) ⇒ Hash

Generate a crypto deposit address.

Parameters:

  • coinbase_account_id (String)

    ID of coinbase account.

Returns:

  • (Hash)

    a hash with status code and deposit address details.



11
12
13
14
15
16
# File 'lib/coinbase/deposits.rb', line 11

def generate_address()
  response = post(
    "/coinbase-accounts/#{}/addresses"
  )
  format_response(response)
end

#list(options = {}) ⇒ Hash

Fetch the list of deposits from the profile of the API key, in descending order by created time.

before [String] If before is set, then it returns deposits created after

the before timestamp, sorted by oldest creation date (optional).

after [String] If after is set, then it returns deposits created before

the after timestamp, sorted by newest (optional).

limit [Integer] Truncate list to this many deposits, capped at 100.

Default is 100. (optional).

Parameters:

  • profile_id (String)

    Limit list of deposits to this profile_id. By default, it retrieves deposits using default profile (optional).

  • type (String)

    Set to deposit or internal_deposit (optional). By default will fetch deposits.

  • paginate_options (Hash)

    an hash with the following parameters

Returns:

  • (Hash)

    a hash with status code and deposit list.



62
63
64
65
# File 'lib/coinbase/deposits.rb', line 62

def list(options = {})
  options[:type] = options[:type].blank? ? DEFAULT_TYPE : options[:type]
  super(options)
end