Class: Cryptopay::ExchangeTransfers

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptopay/api/exchange_transfers.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ ExchangeTransfers

Returns a new instance of ExchangeTransfers.



8
9
10
# File 'lib/cryptopay/api/exchange_transfers.rb', line 8

def initialize(connection)
  @connection = connection
end

Instance Method Details

#commit(exchange_transfer_id, _opts = {}) ⇒ ExchangeTransferResult

Commit an exchange transfer

Parameters:

  • exchange_transfer_id (String)

    Exchange transfer ID

  • opts (Hash)

    the optional parameters

Returns:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cryptopay/api/exchange_transfers.rb', line 16

def commit(exchange_transfer_id, _opts = {})
  path = '/api/exchange_transfers/{exchange_transfer_id}/commit'
  path = path.sub('{exchange_transfer_id}', CGI.escape(exchange_transfer_id.to_s))

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

  connection.call(req, return_type: ExchangeTransferResult)
end

#create(exchange_transfer_params, _opts = {}) ⇒ ExchangeTransferResult

Create an exchange transfer

Parameters:

Returns:



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cryptopay/api/exchange_transfers.rb', line 32

def create(exchange_transfer_params, _opts = {})
  path = '/api/exchange_transfers'

  req = Request.new(
    method: :post,
    path: path,
    body_params: exchange_transfer_params
  )

  connection.call(req, return_type: ExchangeTransferResult)
end

#retrieve(exchange_transfer_id, _opts = {}) ⇒ ExchangeTransferResult

Retrieve an exchange transfer

Parameters:

  • exchange_transfer_id (String)

    Exchange transfer ID

  • opts (Hash)

    the optional parameters

Returns:



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cryptopay/api/exchange_transfers.rb', line 48

def retrieve(exchange_transfer_id, _opts = {})
  path = '/api/exchange_transfers/{exchange_transfer_id}'
  path = path.sub('{exchange_transfer_id}', CGI.escape(exchange_transfer_id.to_s))

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

  connection.call(req, return_type: ExchangeTransferResult)
end