gitcoin_blockchain_explorer 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7de5d2af81d181fedf552755d7504ddc64fe625
4
+ data.tar.gz: 2b66e554371e41e314a6936c64e8e39f7b197eda
5
+ SHA512:
6
+ metadata.gz: d1a594fa64e943bfd7bed224b934dbe014121686e24e812f7d321eca434aa470ed25eef62b4a884112b3323a84b92f0f0b704e8dd7e7d42a32f762aa7101b879
7
+ data.tar.gz: cc97fab8a5b285a6223bad4212cd8c495bbc765d5cd1d20791ef5d4f4cc8104c533bada58e1df5ce30f427e4a0eeafa3cbe748aea90ad5fc86793d9ebc082d86
@@ -0,0 +1,48 @@
1
+ 'reauire httparty'
2
+
3
+ module GitcoinBlockchainExplorer
4
+ class Explorer
5
+ attr_accessor :coinbase_api_base, :blockr_api_base, :blockchain_api_base, :cex_api_base
6
+
7
+ def initialize()
8
+ self.coinbase_api_base = 'https://coinbase.com/api/v1/'
9
+ self.blockr_api_base = 'http://blockr.io/api/v1/'
10
+ self.blockchain_api_base = 'http://blockchain.info/'
11
+ self.cex_api_base = 'https://cex.io/api/'
12
+ end
13
+
14
+
15
+ def last_block()
16
+ HTTParty.get("#{self.blockr_api_base}coin/info")['data']
17
+ end
18
+
19
+ def last_blocks(number_of_blocks = 5)
20
+ #HTTParty.get("#{Figaro.env.blockr_api_base}block/info/#{last_block_num},#{last_block_num - 1},#{last_block_num - 2},#{last_block_num - 3},#{last_block_num - 4},#{last_block_num - 5}")['data']
21
+ HTTParty.get("#{self.blockr_api_base}block/info/#{HTTParty.get("#{self.blockr_api_base}coin/info")['data']['last_block']['nb']}")['data']
22
+ end
23
+
24
+ def last_transactions(number_of_transactions = 10)
25
+ HTTParty.get("#{self.blockr_api_base}block/txs/last")['data']
26
+ end
27
+
28
+ def block(block_number)
29
+ HTTParty.get("#{self.blockr_api_base}block/info/#{block_number}")['data']
30
+ end
31
+
32
+ def block_transactions(block_number)
33
+ HTTParty.get("#{self.blockr_api_base}block/txs/#{block_number}")['data']
34
+ end
35
+
36
+ def transaction(transaction_hash)
37
+ HTTParty.get("#{self.blockr_api_base}tx/info/#{transaction_hash}")['data']
38
+ end
39
+
40
+ def address(public_address)
41
+ HTTParty.get("#{Figaro.env.blockr_api_base}address/info/#{public_address}")['data']
42
+ end
43
+
44
+ def address_transactions(public_address)
45
+ HTTParty.get("#{Figaro.env.blockr_api_base}address/txs/#{public_address}")['data']
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitcoin_blockchain_explorer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Cardona
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.0
27
+ description: Gitcoin.co's Blockchain Explorer
28
+ email: gitcoin.co@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/gitcoin_blockchain_explorer.rb
34
+ homepage: http://rubygems.org/gems/gitcoin_blockchain_explorer
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.0.3
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Gitcoin.co's Blockchain Explorer
58
+ test_files: []
59
+ has_rdoc: