Class: Cryptopay::CoinWithdrawals
- Inherits:
-
Object
- Object
- Cryptopay::CoinWithdrawals
- Defined in:
- lib/cryptopay/api/coin_withdrawals.rb
Instance Method Summary collapse
-
#commit(coin_withdrawal_id, _opts = {}) ⇒ CoinWithdrawalResult
Commit a withdrawal.
-
#create(coin_withdrawal_params, _opts = {}) ⇒ CoinWithdrawalResult
Create a withdrawal To create a withdrawal you need to use either `charged_amount`, `charged_amount_to_send` or `received_amount` parameters in your request body.
-
#initialize(connection) ⇒ CoinWithdrawals
constructor
A new instance of CoinWithdrawals.
-
#list(opts = {}) ⇒ CoinWithdrawalListResult
List withdrawals.
-
#list_network_fees(opts = {}) ⇒ NetworkFeeListResult
List network fees.
-
#retrieve(coin_withdrawal_id, _opts = {}) ⇒ CoinWithdrawalResult
Retrieve a withdrawal.
-
#retrieve_by_custom_id(custom_id, _opts = {}) ⇒ CoinWithdrawalResult
Retrieve a withdrawal by custom id.
Constructor Details
#initialize(connection) ⇒ CoinWithdrawals
Returns a new instance of CoinWithdrawals.
8 9 10 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 8 def initialize(connection) @connection = connection end |
Instance Method Details
#commit(coin_withdrawal_id, _opts = {}) ⇒ CoinWithdrawalResult
Commit a withdrawal
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 16 def commit(coin_withdrawal_id, _opts = {}) path = '/api/coin_withdrawals/{coin_withdrawal_id}/commit' path = path.sub('{coin_withdrawal_id}', CGI.escape(coin_withdrawal_id.to_s)) req = Request.new( method: :post, path: path ) connection.call(req, return_type: CoinWithdrawalResult) end |
#create(coin_withdrawal_params, _opts = {}) ⇒ CoinWithdrawalResult
Create a withdrawal To create a withdrawal you need to use either `charged_amount`, `charged_amount_to_send` or `received_amount` parameters in your request body.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 33 def create(coin_withdrawal_params, _opts = {}) path = '/api/coin_withdrawals' req = Request.new( method: :post, path: path, body_params: coin_withdrawal_params ) connection.call(req, return_type: CoinWithdrawalResult) end |
#list(opts = {}) ⇒ CoinWithdrawalListResult
List withdrawals
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 50 def list(opts = {}) path = '/api/coin_withdrawals' query_params = {} query_params[:customer_id] = opts[:customer_id] unless opts[:customer_id].nil? 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: CoinWithdrawalListResult) end |
#list_network_fees(opts = {}) ⇒ NetworkFeeListResult
List network fees
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 70 def list_network_fees(opts = {}) path = '/api/coin_withdrawals/network_fees' query_params = {} query_params[:all_networks] = opts[:all_networks] unless opts[:all_networks].nil? req = Request.new( method: :get, path: path, query_params: query_params ) connection.call(req, return_type: NetworkFeeListResult) end |
#retrieve(coin_withdrawal_id, _opts = {}) ⇒ CoinWithdrawalResult
Retrieve a withdrawal
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 89 def retrieve(coin_withdrawal_id, _opts = {}) path = '/api/coin_withdrawals/{coin_withdrawal_id}' path = path.sub('{coin_withdrawal_id}', CGI.escape(coin_withdrawal_id.to_s)) req = Request.new( method: :get, path: path ) connection.call(req, return_type: CoinWithdrawalResult) end |
#retrieve_by_custom_id(custom_id, _opts = {}) ⇒ CoinWithdrawalResult
Retrieve a withdrawal by custom id
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/cryptopay/api/coin_withdrawals.rb', line 105 def retrieve_by_custom_id(custom_id, _opts = {}) path = '/api/coin_withdrawals/custom_id/{custom_id}' path = path.sub('{custom_id}', CGI.escape(custom_id.to_s)) req = Request.new( method: :get, path: path ) connection.call(req, return_type: CoinWithdrawalResult) end |