xrbp 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/account.rb +8 -0
- data/examples/ledger.rb +2 -1
- data/lib/xrbp/model/account.rb +2 -2
- data/lib/xrbp/model/ledger.rb +1 -1
- data/lib/xrbp/nodestore/sqldb.rb +12 -8
- data/lib/xrbp/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cb7731c4dfc85c9e12a7c35c715b7a28395c359ec0326462b8e2ec0fbd6d855
|
4
|
+
data.tar.gz: 82c20e0f661da1898bf6bd3e7d46525e2526164911e0577a7afe8d39fe00a4c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 931fd9af61649eb6463d78327f195aae74be46aa557287d72fb6ed7513df6e7fe7e61ed86846d752d116f404deea9922c923347b7d0cfb61183d0cb786a15432
|
7
|
+
data.tar.gz: 17ebc6c52070b89b551cd836ecb224f56b493dc4b5ce5383cd14eeb1af9e875e623322f6ff69dcfb6314a156bb88c7d8de9bdc3093bd1eb11d1fcaf1cc6c2e66
|
data/examples/account.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
$: << File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'xrbp'
|
3
|
+
|
4
|
+
ws = XRBP::WebSocket::Connection.new "wss://s2.ripple.com:443"
|
5
|
+
ws.add_plugin :command_dispatcher
|
6
|
+
ws.connect
|
7
|
+
|
8
|
+
puts XRBP::Model::Account.new(:id => "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv").info(:connection => ws)
|
data/examples/ledger.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
$: << File.expand_path('../../lib', __FILE__)
|
2
2
|
require 'xrbp'
|
3
3
|
|
4
|
-
ws = XRBP::WebSocket::Connection.new "wss://
|
4
|
+
ws = XRBP::WebSocket::Connection.new "wss://s2.ripple.com:443"
|
5
5
|
ws.add_plugin :command_dispatcher
|
6
6
|
ws.connect
|
7
7
|
|
8
8
|
puts XRBP::Model::Ledger.new.sync(:connection => ws)
|
9
|
+
puts XRBP::Model::Ledger.new(:id => 32750).sync(:connection => ws)
|
9
10
|
|
10
11
|
XRBP::Model::Ledger.new.sync(:connection => ws) do |l|
|
11
12
|
puts l
|
data/lib/xrbp/model/account.rb
CHANGED
@@ -155,7 +155,7 @@ module XRBP
|
|
155
155
|
# to use to retrieve account info
|
156
156
|
def info(opts={}, &bl)
|
157
157
|
set_opts(opts)
|
158
|
-
connection.cmd(WebSocket::Cmds::AccountInfo.new(id, full_opts), &bl)
|
158
|
+
connection.cmd(WebSocket::Cmds::AccountInfo.new(id, full_opts.except(:id)), &bl)
|
159
159
|
end
|
160
160
|
|
161
161
|
# Retrieve account objects via WebSocket::Connection
|
@@ -165,7 +165,7 @@ module XRBP
|
|
165
165
|
# to use to retrieve account objects
|
166
166
|
def objects(opts={}, &bl)
|
167
167
|
set_opts(opts)
|
168
|
-
connection.cmd(WebSocket::Cmds::AccountObjects.new(id, full_opts), &bl)
|
168
|
+
connection.cmd(WebSocket::Cmds::AccountObjects.new(id, full_opts.except(:id)), &bl)
|
169
169
|
end
|
170
170
|
|
171
171
|
# Retrieve account username via WebClient::Connection
|
data/lib/xrbp/model/ledger.rb
CHANGED
@@ -17,7 +17,7 @@ module XRBP
|
|
17
17
|
# to use to retrieve ledger
|
18
18
|
def sync(opts={}, &bl)
|
19
19
|
set_opts(opts)
|
20
|
-
connection.cmd(WebSocket::Cmds::Ledger.new(id, full_opts), &bl)
|
20
|
+
connection.cmd(WebSocket::Cmds::Ledger.new(id, full_opts.except(:id)), &bl)
|
21
21
|
end
|
22
22
|
|
23
23
|
# Subscribe to ledger stream via WebSocket::Connection
|
data/lib/xrbp/nodestore/sqldb.rb
CHANGED
@@ -36,18 +36,26 @@ module XRBP
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def between(before, after)
|
39
|
-
@sql_db.ledger_db.execute("select * from
|
39
|
+
@sql_db.ledger_db.execute("select * from Ledgers where ClosingTime >= ? and ClosingTime <= ?",
|
40
40
|
before.to_xrp_time,
|
41
41
|
after.to_xrp_time)
|
42
42
|
.collect { |row| from_db(row) }
|
43
43
|
end
|
44
44
|
|
45
45
|
def hash_for_seq(seq)
|
46
|
-
@sql_db.ledger_db.execute("select LedgerHash from
|
46
|
+
@sql_db.ledger_db.execute("select LedgerHash from Ledgers where LedgerSeq = ?", seq).first.first
|
47
47
|
end
|
48
48
|
|
49
49
|
def size
|
50
|
-
@sql_db.ledger_db.execute("select count(
|
50
|
+
@sql_db.ledger_db.execute("select count(ROWID) from Ledgers").first.first
|
51
|
+
end
|
52
|
+
|
53
|
+
def first
|
54
|
+
@sql_db.ledger_db.execute("select LedgerSeq from Ledgers order by LedgerSeq asc limit 1").first.first
|
55
|
+
end
|
56
|
+
|
57
|
+
def last
|
58
|
+
@sql_db.ledger_db.execute("select LedgerSeq from Ledgers order by LedgerSeq desc limit 1").first.first
|
51
59
|
end
|
52
60
|
|
53
61
|
alias :count :size
|
@@ -58,13 +66,9 @@ module XRBP
|
|
58
66
|
end
|
59
67
|
end
|
60
68
|
|
61
|
-
def last
|
62
|
-
all.last
|
63
|
-
end
|
64
|
-
|
65
69
|
# TODO: remove memoization, define first(n), last(n) methods
|
66
70
|
def all
|
67
|
-
@all ||= @sql_db.ledger_db.execute("select * from
|
71
|
+
@all ||= @sql_db.ledger_db.execute("select * from Ledgers order by LedgerSeq asc")
|
68
72
|
.collect { |row| from_db(row) }
|
69
73
|
end
|
70
74
|
|
data/lib/xrbp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xrbp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dev Null Productions
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- ".yardopts"
|
175
175
|
- LICENSE.txt
|
176
176
|
- README.md
|
177
|
+
- examples/account.rb
|
177
178
|
- examples/accounts.rb
|
178
179
|
- examples/autoconnect_timeout.rb
|
179
180
|
- examples/autorety.rb
|