insight_bitpay 0.0.7 → 0.0.8

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: fb4de160fc73eb3b6a227ceab3ecbd5c212e90ed
4
- data.tar.gz: 01c7aaa91f9d092c94fd55934e1d0cb3f0b738ce
3
+ metadata.gz: 1a89a8e78315bb810305eab5183ed778b9908eca
4
+ data.tar.gz: 02273455201502e2ddc71b6afed2cab1c5d6b970
5
5
  SHA512:
6
- metadata.gz: ebe1933c7e837657664c19584ec5b787059beaf90dabb197220100ecb5be64df551c81adaa1a496cd9fab9731d843fbda4221dcb4a7350439daba73dfa3464c5
7
- data.tar.gz: e830cdca1a19032cdd13798d42bf26c4ff54db2bc1e06e937f8b2657e303e525251f01cef071b27acc95c03916e5eef853a141184bbafdab3a3e78b510d56788
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 'insight'
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 insight
21
+ $ gem install insight_bitpay
22
22
 
23
23
  ## Usage
24
24
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  task :console do
4
- exec 'irb -r Insight -I ./lib'
4
+ exec 'pry -r Insight -I ./lib'
5
5
  end
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
@@ -14,14 +14,14 @@ module Insight
14
14
  query :post, path, payload
15
15
  end
16
16
 
17
- def query(method, path, payload={})
17
+ def query(mthd, path, payload={})
18
18
  uri = endpoint_uri(path)
19
19
  begin
20
- response = RestClient::Request.execute(:method => method, :url => uri, :payload => payload, :ssl_version => 'SSLv23')
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, :symbolize_names => true
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
@@ -1,3 +1,3 @@
1
1
  module Insight
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
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.7
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-06-09 00:00:00.000000000 Z
11
+ date: 2017-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client