Class: Coinbase::Withdrawals
- Defined in:
- lib/coinbase/withdrawals.rb
Overview
Withdrawl coinbase APIs
Constant Summary collapse
- WITHDRAWAL_API =
'/transfers'
- DEFAULT_TYPE =
'withdraw'
Instance Method Summary collapse
-
#by_account(withdraw_details = {}) ⇒ Hash
Withdraw funds to a coinbase account.
-
#by_crypto(withdraw_details = {}) ⇒ Hash
Withdraw funds to a crypto address.
-
#by_method(withdraw_details) ⇒ Hash
Withdraw funds to a payment method.
-
#fee_estimate(params = {}) ⇒ Hash
Fetch the network fee estimate when sending to the given address.
-
#list(options = {}) ⇒ Hash
Fetch the list of Withdrawals from the profile of the API key, in descending order by created time.
Methods inherited from Transfers
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(withdraw_details = {}) ⇒ Hash
Withdraw funds to a coinbase account.
amount [Float] The amount to withdraw. currency [String] The type of currency. coinbase_account_id [String] ID of coinbase account.
52 53 54 55 56 57 58 59 |
# File 'lib/coinbase/withdrawals.rb', line 52 def by_account(withdraw_details = {}) format_response( post( '/withdrawals/coinbase-account', body: withdraw_details ) ) end |
#by_crypto(withdraw_details = {}) ⇒ Hash
Withdraw funds to a crypto address.
amount [Float] The amount to withdraw. currency [String] The type of currency. crypto_address [String] A crypto address of the recipient. destination_tag [String] A destination tag for currencies
that support one.
no_destination_tag [Boolean] A boolean flag to opt out of
using a destination tag for currencies that support one.
This is required when not providing a destination tag.
add_network_fee_to_total [Boolean] A boolean flag to add the network fee
on top of the amount.
36 37 38 39 40 41 42 43 |
# File 'lib/coinbase/withdrawals.rb', line 36 def by_crypto(withdraw_details = {}) format_response( post( '/withdrawals/crypto', body: withdraw_details ) ) end |
#by_method(withdraw_details) ⇒ Hash
Withdraw funds to a payment method.
amount [Float] The amount to withdraw. currency [String] The type of currency. payment_method_id [String] ID of the payment method.
68 69 70 71 72 73 74 75 |
# File 'lib/coinbase/withdrawals.rb', line 68 def by_method(withdraw_details) format_response( post( '/withdrawals/payment-method', body: withdraw_details ) ) end |
#fee_estimate(params = {}) ⇒ Hash
Fetch the network fee estimate when sending to the given address.
14 15 16 17 18 19 20 |
# File 'lib/coinbase/withdrawals.rb', line 14 def fee_estimate(params = {}) operational_url = '/withdrawals/fee-estimate' query_params = build_query_params(params) operational_url += '/?' + query_params unless query_params.empty? response = get(operational_url) format_response(response) end |
#list(options = {}) ⇒ Hash
Fetch the list of Withdrawals from the profile of the API key, in descending order by created time.
before [String] If before is set,then it returns withdrawals created after
the before timestamp, sorted by oldest creation date(optional).
after [String] If after is set, then it returns withdrawals created before
the after timestamp, sorted by newest (optional).
limit [Integer] Truncate list to this many withdrawals, capped at 100.
Default is 100. (optional).
91 92 93 94 |
# File 'lib/coinbase/withdrawals.rb', line 91 def list( = {}) [:type] = [:type].blank? ? DEFAULT_TYPE : [:type] super() end |