Module: Bibox::Rest::Private::Transfers

Included in:
Client
Defined in:
lib/bibox/rest/private/transfers.rb

Instance Method Summary collapse

Instance Method Details

#deposit_address(symbol = "BTC", options: {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/bibox/rest/private/transfers.rb', line 6

def deposit_address(symbol = "BTC", options: {})
  payload     =   [
    {
      cmd:  "transfer/transferIn",
      body: {coin_symbol: symbol}
    }
  ]
  
  response    =   parse(post("/transfer", data: payload, options: options))&.fetch("result", [])&.first&.fetch("result", {})
end

#deposits(page: 1, size: 10, filter_type: :all, search: nil, options: {}) ⇒ Object



17
18
19
# File 'lib/bibox/rest/private/transfers.rb', line 17

def deposits(page: 1, size: 10, filter_type: :all, search: nil, options: {})
  transfers(command: "transfer/transferInList", page: page, size: size, filter_type: filter_type, search: search, options: options)
end

#transfers(command:, page: 1, size: 10, filter_type: :all, search: nil, options: {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bibox/rest/private/transfers.rb', line 25

def transfers(command:, page: 1, size: 10, filter_type: :all, search: nil, options: {})
  params      =   {
    page:         page,
    size:         size,
    filter_type:  ::Bibox::Models::Transfer::STATUSES[filter_type],
    search:       search,
  }
  
  params.delete_if { |key, value| value.nil? }
  
  payload     =   [
    {
      cmd:  command,
      body: params
    }
  ]
  
  response    =   parse(post("/transfer", data: payload, options: options))&.fetch("result", [])&.first&.fetch("result", {})&.fetch("items", [])
  ::Bibox::Models::Transfer.parse(response) if response
end

#withdrawals(page: 1, size: 10, filter_type: :all, search: nil, options: {}) ⇒ Object



21
22
23
# File 'lib/bibox/rest/private/transfers.rb', line 21

def withdrawals(page: 1, size: 10, filter_type: :all, search: nil, options: {})
  transfers(command: "transfer/transferOutList", page: page, size: size, filter_type: filter_type, search: search, options: options)
end