Module: Cryptomus::Client

Defined in:
lib/cryptomus/client.rb

Class Method Summary collapse

Class Method Details

.balanceHash

Examples:

Cryptomus::Client.balance

Raises:



70
71
72
# File 'lib/cryptomus/client.rb', line 70

def balance
  connection.post('/v1/balance')
end

.connectionObject



74
75
76
# File 'lib/cryptomus/client.rb', line 74

def connection
  @connection ||= Connection.new
end

.create_payment(attributes) ⇒ Hash

Examples:

Cryptomus::Client.create_invoice(
  order_id: '123',
  currency: 'USD',
  amount: '100'
)

Options Hash (attributes):

  • :order_id (String)

    required

  • :currency (String)

    required

  • :amount (String)

    required

Raises:



20
21
22
# File 'lib/cryptomus/client.rb', line 20

def create_payment(attributes)
  connection.post('/v1/payment', body: attributes)
end

.create_wallet(attributes) ⇒ Hash

Examples:

Cryptomus::Client.create_wallet(
  order_id: '123',
  currency: 'USDT',
  network: 'tron'
)

Options Hash (attributes):

  • :order_id (String)

    required

  • :currency (String)

    required

  • :network (String)

    required

Raises:



61
62
63
# File 'lib/cryptomus/client.rb', line 61

def create_wallet(attributes)
  connection.post('/v1/wallet', body: attributes)
end

.list_payments(cursor: nil, date_from: nil, date_to: nil) ⇒ Hash



30
31
32
33
34
35
36
# File 'lib/cryptomus/client.rb', line 30

def list_payments(cursor: nil, date_from: nil, date_to: nil)
  attributes = { date_from:, date_to: }.compact
  attributes = nil if attributes.empty?
  query = { cursor: }.compact
  query = nil if query.empty?
  connection.post('/v1/payment/list', body: attributes, query:)
end

.payment(uuid: nil, order_id: nil) ⇒ Hash



43
44
45
46
# File 'lib/cryptomus/client.rb', line 43

def payment(uuid: nil, order_id: nil)
  attributes = { uuid:, order_id: }.compact
  connection.get('/v1/payment/info', body: attributes)
end