insight_bitpay 0.0.7 → 0.0.8
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/README.md +2 -2
- data/Rakefile +1 -1
- data/lib/insight/api.rb +8 -0
- data/lib/insight/connection.rb +3 -5
- data/lib/insight/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a89a8e78315bb810305eab5183ed778b9908eca
|
4
|
+
data.tar.gz: 02273455201502e2ddc71b6afed2cab1c5d6b970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1384486ec4597a9ec4dc549b54efd69d28d503deb771cdd6e07339049e0484fcdbdbbaa9265b98f5d34737e1e90146c1f61d54a2f6fb25118ef663f5b01587c1
|
7
|
+
data.tar.gz: 3345e134536887a33117a6b6570e3e525c4926736b40709badd051e4707ece5afebd8804dd6c8b8e111857ea8017b00819d40f5b9f245489959c816ddf2c08af
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Ruby SDK for insight.bitpay.com
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
12
|
+
gem 'insight_bitpay'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -18,7 +18,7 @@ And then execute:
|
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
$ gem install
|
21
|
+
$ gem install insight_bitpay
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
data/Rakefile
CHANGED
data/lib/insight/api.rb
CHANGED
@@ -31,6 +31,14 @@ module Insight
|
|
31
31
|
@connection.get("/block/#{hash}")
|
32
32
|
end
|
33
33
|
|
34
|
+
def blocks(params)
|
35
|
+
@connection.get("/blocks#{'?' + params.to_param if params}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def latest_block
|
39
|
+
blocks(limit: 1)[:blocks].first
|
40
|
+
end
|
41
|
+
|
34
42
|
def block_raw(hash)
|
35
43
|
@connection.get("/rawblock/#{hash}")
|
36
44
|
end
|
data/lib/insight/connection.rb
CHANGED
@@ -14,14 +14,14 @@ module Insight
|
|
14
14
|
query :post, path, payload
|
15
15
|
end
|
16
16
|
|
17
|
-
def query(
|
17
|
+
def query(mthd, path, payload={})
|
18
18
|
uri = endpoint_uri(path)
|
19
19
|
begin
|
20
|
-
response = RestClient::Request.execute(:
|
20
|
+
response = RestClient::Request.execute(method: mthd, url: uri, payload: payload, ssl_version: 'SSLv23')
|
21
21
|
rescue Exception => e
|
22
22
|
response = e.response
|
23
23
|
end
|
24
|
-
JSON.parse response, :
|
24
|
+
JSON.parse response, symbolize_names: true
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -32,7 +32,5 @@ module Insight
|
|
32
32
|
end
|
33
33
|
"#{@url}/#{path}"
|
34
34
|
end
|
35
|
-
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
data/lib/insight/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insight_bitpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genaro Madrid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|