class Cryptopay::CoinWithdrawals

Attributes

connection[R]

Public Class Methods

new(connection) click to toggle source
# File lib/cryptopay/api/coin_withdrawals.rb, line 8
def initialize(connection)
  @connection = connection
end

Public Instance Methods

commit(coin_withdrawal_id, _opts = {}) click to toggle source

Commit a withdrawal @param coin_withdrawal_id [String] Coin withdrawal ID @param [Hash] opts the optional parameters @return [CoinWithdrawalResult]

# 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 = {}) click to toggle source

Create a withdrawal @param coin_withdrawal_params [CoinWithdrawalParams] @param [Hash] opts the optional parameters @return [CoinWithdrawalResult]

# File lib/cryptopay/api/coin_withdrawals.rb, line 32
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 = {}) click to toggle source

List withdrawals @param [Hash] opts the optional parameters @option opts [String] :customer_id The internal ID of your customer that the transaction relates to @option opts [String] :starting_after Pagination parameter. ID to start after @return [CoinWithdrawalListResult]

# File lib/cryptopay/api/coin_withdrawals.rb, line 49
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 = {}) click to toggle source

List network fees @param [Hash] opts the optional parameters @return [NetworkFeeListResult]

# File lib/cryptopay/api/coin_withdrawals.rb, line 68
def list_network_fees(_opts = {})
  path = '/api/coin_withdrawals/network_fees'

  req = Request.new(
    method: :get,
    path: path
  )

  connection.call(req, return_type: NetworkFeeListResult)
end
retrieve(coin_withdrawal_id, _opts = {}) click to toggle source

Retrieve a withdrawal @param coin_withdrawal_id [String] Coin withdrawal ID @param [Hash] opts the optional parameters @return [CoinWithdrawalResult]

# File lib/cryptopay/api/coin_withdrawals.rb, line 83
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 = {}) click to toggle source

Retrieve a withdrawal by custom id @param custom_id [String] @param [Hash] opts the optional parameters @return [CoinWithdrawalResult]

# File lib/cryptopay/api/coin_withdrawals.rb, line 99
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