xrbp 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90939e974e72207bd282c52c6b65e2ee3e6ceb6bd8564bf53b1b421aa0589b53
4
- data.tar.gz: 86d68aefb3a468bf8d767dbf355e1499f0ff849d8833efea0069aa3c537aea2a
3
+ metadata.gz: 7cb7731c4dfc85c9e12a7c35c715b7a28395c359ec0326462b8e2ec0fbd6d855
4
+ data.tar.gz: 82c20e0f661da1898bf6bd3e7d46525e2526164911e0577a7afe8d39fe00a4c4
5
5
  SHA512:
6
- metadata.gz: b105e3cddae3ee759b16434ef94571d861abb56d9c7008d3a3041dcdb9092262edf26bda522350b1d2c80bd92a29b3150b1d6f7407876242fe3e85650655a0b5
7
- data.tar.gz: 1ad2b1d9c6ab0201cbccda42b18290b33cfc091ccae98944dcf80a2d2f5c616d6ea02111e7552d0fd14ceb5d21d689b7543ad41718c785e6d709203a6cae2658
6
+ metadata.gz: 931fd9af61649eb6463d78327f195aae74be46aa557287d72fb6ed7513df6e7fe7e61ed86846d752d116f404deea9922c923347b7d0cfb61183d0cb786a15432
7
+ data.tar.gz: 17ebc6c52070b89b551cd836ecb224f56b493dc4b5ce5383cd14eeb1af9e875e623322f6ff69dcfb6314a156bb88c7d8de9bdc3093bd1eb11d1fcaf1cc6c2e66
@@ -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://s1.ripple.com:443"
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
@@ -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
@@ -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
@@ -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 ledgers where ClosingTime >= ? and ClosingTime <= ?",
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 ledgers where LedgerSeq = ?", seq).first.first
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(*) from ledgers").first.first
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 ledgers order by LedgerSeq asc")
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
@@ -1,3 +1,3 @@
1
1
  module XRBP
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end # module XRBP
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.5
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-01-03 00:00:00.000000000 Z
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