Module: Bibox::Rest::Private::Bills

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

Instance Method Summary collapse

Instance Method Details

#bills(coin_id: 0, type: :all, days: 30, page: 1, size: 50, options: {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bibox/rest/private/bills.rb', line 6

def bills(coin_id: 0, type: :all, days: 30, page: 1, size: 50, options: {})
  params      =   {
    coin_id:  coin_id,
    type:     ::Bibox::Models::Bill::BILL_TYPES[type],
    days:     days,  
    page:     page,
    size:     size
  }
  
  params.delete_if { |key, value| value.nil? }
  
  payload     =   [
    {
      cmd:  "transfer/bills",
      body: params
    }
  ]
  
  response    =   parse(post("/transfer", data: payload, options: options))&.fetch("result", [])&.first&.fetch("result", {})&.fetch("items", [])
  ::Bibox::Models::Bill.parse(response) if response&.any?
end