Class: XRBP::WebSocket::Cmds::Ledger

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

Overview

Retrieve information about the public ledger

developers.ripple.com/ledger.html

Instance Attribute Summary collapse

Attributes inherited from XRBP::WebSocket::Command

#id, #json

Attributes inherited from Message

#bl, #connection, #result, #time

Instance Method Summary collapse

Methods inherited from XRBP::WebSocket::Command

#requesting, #requesting?

Methods inherited from Message

#signal, #to_s, #wait

Constructor Details

#initialize(ledger_index = nil, args = {}) ⇒ Ledger

Returns a new instance of Ledger.



10
11
12
13
14
# File 'lib/xrbp/websocket/cmds/ledger.rb', line 10

def initialize(ledger_index=nil, args={})
  @ledger_index = ledger_index
  @args = args
  super(to_h)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/xrbp/websocket/cmds/ledger.rb', line 8

def args
  @args
end

#ledger_indexObject

Returns the value of attribute ledger_index.



8
9
10
# File 'lib/xrbp/websocket/cmds/ledger.rb', line 8

def ledger_index
  @ledger_index
end

Instance Method Details

#ledger_index?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/xrbp/websocket/cmds/ledger.rb', line 16

def ledger_index?
  !!ledger_index
end

#to_hObject



20
21
22
23
24
# File 'lib/xrbp/websocket/cmds/ledger.rb', line 20

def to_h
  h = args.merge(:command => :ledger)
  h['ledger_index'] = ledger_index if ledger_index?
  return h
end