pochette_toshi 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: a7c9bfb71ed94aeeeefab9fb2fedb216159b99fa
4
- data.tar.gz: 185b3e27c051d994ee558ef09c41fa3e4f646ecc
3
+ metadata.gz: 9ad624fefb330cf05888df8551fdb67050950f1a
4
+ data.tar.gz: 445ec4d754a2c48ffb35c0cf90cd5e4d71749a4a
5
5
  SHA512:
6
- metadata.gz: 746d80c8fb958171be301e59be21dd2f009ad5ff38a24042aac6d94a581fe4f1bc6305a10da8a4055a94e996dc6d2b6ae1fb1c0ada8e0689b6c0f199bb7ef963
7
- data.tar.gz: 1d4166804bbd96d16100b76d81018b0c5655ba7b91a1abf1e582e726726e8304017d0233bd47a8c9545907eee849b2b222b2b7ab884f9a779aad1a3e7358d231
6
+ metadata.gz: 3e72a302dad958328e8c96c7ffcf308ead59d98cf1a9a05a53dd4a5fbaccaf42aaf49b73ce95caa9f24d6eaf09d25faebb1033b6e58665681de92a3d38628e88
7
+ data.tar.gz: e02e3eee8a8ea0966e30b64df38e361ea46e8cc4683cb13603fafc77d7f199f0d77db3efb02ec25717653c759b3e2d497de60ce0c46a3f41b0587cd87b2b6da9
@@ -1,3 +1,3 @@
1
1
  module PochetteToshi
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -2,6 +2,7 @@ require "pochette_toshi/version"
2
2
  require "active_support"
3
3
  require "active_support/core_ext"
4
4
  require "pg"
5
+ require 'sequel'
5
6
  require 'pochette'
6
7
  require 'rest-client'
7
8
  require 'uri'
@@ -12,10 +13,10 @@ require 'oj'
12
13
  # you can run and assert your changes with a local copy of
13
14
  # a toshi testnet database.
14
15
  class Pochette::Backends::Toshi
15
- attr_accessor :connection
16
+ cattr_accessor :db
16
17
 
17
18
  def initialize(options)
18
- self.connection = PG.connect(options)
19
+ self.class.db ||= Sequel.connect(options.merge(adapter: 'postgres'))
19
20
  end
20
21
 
21
22
  def incoming_for(addresses, min_date)
@@ -211,7 +212,7 @@ class Pochette::Backends::Toshi
211
212
  end
212
213
 
213
214
  def block_height
214
- connection.exec('select max(height) from blocks where branch = 0').values[0][0].to_i
215
+ query('select max(height) from blocks where branch = 0')[0][0].to_i
215
216
  end
216
217
 
217
218
  def pushtx(hex)
@@ -222,7 +223,9 @@ class Pochette::Backends::Toshi
222
223
  end
223
224
 
224
225
  def query(sql)
225
- connection.exec(sql).values
226
+ self.db.synchronize do |conn|
227
+ conn.exec(sql).values
228
+ end
226
229
  end
227
230
 
228
231
  def sanitize_list(list)
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency "pochette", "~> 0.1.7"
20
20
  spec.add_dependency "pg", "~> 0.17"
21
21
  spec.add_dependency "activesupport", "~> 4.2"
22
+ spec.add_dependency "sequel", "~> 4.27"
22
23
  spec.add_dependency "rest-client", "~> 1.8.0"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.9"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pochette_toshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nubis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pochette
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sequel
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.27'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.27'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rest-client
57
71
  requirement: !ruby/object:Gem::Requirement