blockcypher-ruby 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -1
  3. data/lib/blockcypher/api.rb +21 -10
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7745506061c201b5a82f943b2dadec2759f82a88
4
- data.tar.gz: fb35dcbc2e31dbf1c3433f41d442413b9cb79a62
3
+ metadata.gz: 8ee649063cde0162f14040bafc09e2d1a7cbb6dc
4
+ data.tar.gz: 0f44d0d0fe1f91010a47799ca41bd171c64f5ff6
5
5
  SHA512:
6
- metadata.gz: 1ce6d7b7f4d59c3080e77d952e0bf5ff59c1674d9d3f833c749f6d20058f0dbe0e2080fbee7864e8a75a77f17d0fd1a8e1ea5747576a47fc4127216e6edc1da2
7
- data.tar.gz: a3a07c71551edd6f81a4f94ad3017fb540b7cb14eefd2e182a33330ce530a92b2cec39b1346dce0b9fc2b53bc5b79ab6fdc1f9480a9d71cb83c7c5b4de12c714
6
+ metadata.gz: a06ce90d9d766498e367aec48c8933457862ba637deeb72a9da696a411e54fbff830f5a1cdadd2980d364bcc2c49fa6a20897acf712a997b740e5cf5d84ab0aa
7
+ data.tar.gz: 94f82dea7f64bb80b08a5ab3e2ac47ea9e1d207e89ab9cb5872ce4fa590e0ebaca02d71bab893c44edf87b8f67b8fdf10d9c1cac4a54e7ae05c8e86e77396502
data/README.md CHANGED
@@ -6,7 +6,31 @@ Simple Ruby client for the [BlockCypher](http://www.blockcypher.com) API.
6
6
 
7
7
  Simply using rubygems:
8
8
 
9
- gem install blockcypher-ruby
9
+ gem install blockcypher-ruby
10
+
11
+ ### For Rails apps
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'blockcypher-ruby', '~> 0.2.0', :require => 'blockcypher'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ ```bash
22
+ $ bundle install
23
+ ```
24
+
25
+ Or install it yourself as:
26
+
27
+ ```bash
28
+ $ git clone https://github.com/blockcypher/ruby-client.git
29
+ $ cd ruby-client
30
+ $ bundle
31
+ $ gem build blockcypher-ruby.gemspec
32
+ $ gem install blockcypher-ruby-0.2.0.gem
33
+ ```
10
34
 
11
35
  ## Initializing a client
12
36
 
@@ -32,8 +32,8 @@ module BlockCypher
32
32
  api_http_get('/txs')
33
33
  end
34
34
 
35
- def blockchain_transaction(transaction_hash)
36
- api_http_get('/txs/' + transaction_hash)
35
+ def blockchain_transaction(transaction_hash, **params)
36
+ api_http_get('/txs/' + transaction_hash, query: params)
37
37
  end
38
38
 
39
39
  def blockchain_block(block_index, params)
@@ -56,7 +56,7 @@ module BlockCypher
56
56
  ##################
57
57
  # Transaction API
58
58
  ##################
59
-
59
+
60
60
  def decode_hex(hex)
61
61
  payload = { 'tx' => hex}
62
62
  api_http_post('/txs/decode', json_payload: payload)
@@ -140,8 +140,8 @@ module BlockCypher
140
140
 
141
141
  ##################
142
142
  # Microtx API
143
- ##################
144
-
143
+ ##################
144
+
145
145
  # This method sends private key to server
146
146
  def microtx_from_priv(private_key, to_address, value_satoshis)
147
147
  payload = {
@@ -178,8 +178,16 @@ module BlockCypher
178
178
  api_http_post('/addrs', json_payload: payload)
179
179
  end
180
180
 
181
- def address_details(address, unspent_only: false)
182
- api_http_get('/addrs/' + address, query: { unspentOnly: unspent_only } )
181
+ def address_details(address, unspent_only: false, limit: 50,
182
+ before: nil, omit_wallet_addresses: false)
183
+ query = {
184
+ unspentOnly: unspent_only,
185
+ limit: limit,
186
+ omitWalletAddresses: omit_wallet_addresses
187
+ }
188
+ query[:before] = before if before
189
+
190
+ api_http_get('/addrs/' + address, query: query )
183
191
  end
184
192
 
185
193
  def address_balance(address)
@@ -191,14 +199,17 @@ module BlockCypher
191
199
  details['final_balance']
192
200
  end
193
201
 
194
- def address_full_txs(address, limit: 10)
195
- api_http_get("/addrs/#{address}/full", query: { limit: limit })
202
+ def address_full_txs(address, limit: 10, before: nil)
203
+ query = { limit: limit }
204
+ query[:before] = before if before
205
+
206
+ api_http_get("/addrs/#{address}/full", query: query)
196
207
  end
197
208
 
198
209
  ##################
199
210
  # Wallet API
200
211
  ##################
201
-
212
+
202
213
  def wallet_create(name, addresses)
203
214
  payload = { 'name' => name, 'addresses' => Array(addresses)}
204
215
  api_http_post('/wallets', json_payload: payload)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blockcypher-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - CoinHako
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-06-23 00:00:00.000000000 Z
14
+ date: 2015-09-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bitcoin-ruby
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.4.5
117
+ rubygems_version: 2.4.5.1
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Ruby library to help you build your crypto application on BlockCypher