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

#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(id = 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(id=nil, args={})
  @id = id
  @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

#idObject

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

#id?Boolean

Returns:

  • (Boolean)


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

def id?
  !!id
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'] = id if id?
  return h
end