Class: XRBP::WebSocket::Cmds::BookOffers

Inherits:
XRBP::WebSocket::Command show all
Defined in:
lib/xrbp/websocket/cmds/book_offers.rb

Overview

The book_offers method retrieves a list of offers, also known as the order book , between two currencies

developers.ripple.com/book_offers.html

Instance Attribute Summary collapse

Attributes inherited from XRBP::WebSocket::Command

#id, #json

Attributes inherited from Message

#bl, #connection, #result, #time

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XRBP::WebSocket::Command

#requesting, #requesting?

Methods inherited from Message

#signal, #to_s, #wait

Constructor Details

#initialize(args = {}) ⇒ BookOffers

Returns a new instance of BookOffers.



17
18
19
20
21
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 17

def initialize(args={})
  @args = args
  parse_paginate(args)
  super(to_h)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



15
16
17
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 15

def args
  @args
end

Class Method Details

.from_h(h) ⇒ Object



23
24
25
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 23

def self.from_h(h)
   new Hash[h]
end

Instance Method Details

#page_titleObject



11
12
13
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 11

def page_title
  "offers"
end

#sanitized_argsObject



27
28
29
30
31
32
33
34
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 27

def sanitized_args
  sa = Hash[args_without_paginate]

  sa[:taker_gets].delete(:issuer) if sa[:taker_gets][:currency] == "XRP"
  sa[:taker_pays].delete(:issuer) if sa[:taker_pays][:currency] == "XRP"

  sa
end

#to_hObject



36
37
38
# File 'lib/xrbp/websocket/cmds/book_offers.rb', line 36

def to_h
  sanitized_args.merge(:command => :book_offers)
end