blockchain-info-ruby 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b74e95ddaf7655095f9960c7b33965ad07e5beda
4
- data.tar.gz: 62357db58cec6998961c1ef69919f9f479c4b862
3
+ metadata.gz: b405df4711697b49cedcde1a688df699aef0c8d2
4
+ data.tar.gz: 8bf99dfbf6c7ca0ba63f519b41055d5dc573d319
5
5
  SHA512:
6
- metadata.gz: 80b04916ccc3880062462658a08db24f5d1051a3eb02f9ea1dac007dd28f4de90238100f60465149c2cb56751bbdcbbc58d22b6f823315631b87ae9ce655c647
7
- data.tar.gz: a13dceed4ae0faf3e142600bc752302025b49bb7d69ce0134b31fa098ae697d813ddafc4ae142f1edfe849c756611f961a7ca4af65d306a42983236c104a54e1
6
+ metadata.gz: 21a88190b89145dfbd7f4da26a7fac4039eebbf348f58d7f5058774329ac3342dabd6c5d116885b4a6cba6c82170a2cf0a1af4e9d43fa741d14fdcd67edff2ef
7
+ data.tar.gz: e93806aa7de20d13d2949ea3fc7ddab33e64e3cfd5361ecceee3cd2337e7ef9d3b51d7c4c35e08453038bb7f43fcc3c79da4b195fa30e7bd68478055980a840f
@@ -1,15 +1,15 @@
1
-
2
1
  module BlockchainInfo
3
2
  require 'json'
4
3
  require 'base64'
5
4
  require 'openssl'
6
5
  require 'net/http'
7
6
 
8
- autoload(:Ressource, 'ressource')
9
- autoload(:Charts, 'charts')
10
- autoload(:Exchange, 'exchange')
11
- autoload(:Wallet, 'wallet')
12
- autoload(:Merchant, 'merchant')
7
+ autoload(:Ressource, File.expand_path('ressource', __dir__))
8
+ autoload(:Charts, File.expand_path('charts', __dir__))
9
+ autoload(:Exchange, File.expand_path('exchange', __dir__))
10
+ autoload(:Wallet, File.expand_path('wallet', __dir__))
11
+ autoload(:Merchant, File.expand_path('merchant', __dir__))
12
+ autoload(:Data, File.expand_path('data', __dir__))
13
13
 
14
14
  class Configuration
15
15
  attr_accessor :domain
data/lib/data.rb ADDED
@@ -0,0 +1,19 @@
1
+ module BlockchainInfo
2
+
3
+ # See https://blockchain.info/fr/api/blockchain_api for more information.
4
+ class Data < BlockchainInfo::Ressource
5
+
6
+ # Return {"hash":"...0000bae09a7a39...", "ver":1, "prev_block":"...00007d0f98d9...", "mrkl_root":"935aa0ed2e...", "time":1322131230, "bits":437129626, "nonce":2964215930, "n_tx":22, "size":9195, "block_index":818044, "main_chain":true, "height":154595, "received_time":1322131301, "relayed_by":"108.60.208.156", "tx":[--Array of Transactions--] }
7
+ def self.block hash_or_index
8
+ query("rawblock/#{hash_or_index}")
9
+ end
10
+
11
+ # Return {"hash":"b6f6991d03...", "ver":1, "vin_sz":1, "vout_sz":2, "lock_time":"Unavailable", "size":258, "relayed_by":"64.179.201.80", "block_height", 12200, "tx_index":"12563028", "inputs":[--Array of Inputs--], "out":[--Array of Ouputs--] }
12
+ # Inputs {"prev_out":{"hash":"a3e2bcc9a5f776112497a32b05f4b9e5b2405ed9", "value":"100000000", "tx_index":"12554260", "n":"2"}, "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac"}
13
+ # Outputs {"value":"98000000", "hash":"29d6a3540acfa0a950bef2bfdc75cd51c24390fd", "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac"}
14
+ def self.transaction hash
15
+ query("rawtx/#{hash}")
16
+ end
17
+
18
+ end
19
+ end
data/lib/ressource.rb CHANGED
@@ -47,6 +47,8 @@ module BlockchainInfo
47
47
  rescue JSON::ParserError => e
48
48
  res.body.is_a?(String) ? res.body : {"error" => "invalid json response" }
49
49
  end
50
+ elsif res.code.to_i == 500
51
+ {"error" => res.body}
50
52
  else
51
53
  {"error" => "service not available"}
52
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blockchain-info-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Larcheveque
@@ -9,16 +9,17 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-28 00:00:00.000000000 Z
12
+ date: 2014-06-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This API allow you to interact with blockchain.info APIs
15
- email: ''
15
+ email: vrenaud@lamaisondubitcoin.fr
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/blockchain_info.rb
21
21
  - lib/charts.rb
22
+ - lib/data.rb
22
23
  - lib/exchange.rb
23
24
  - lib/merchant.rb
24
25
  - lib/ressource.rb