onchain 2.2 → 2.3

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: 8daec2e381d473e47ebe8d4ab18e1585c5a544c3
4
- data.tar.gz: ff2a9d4f62ac459f155711991acf1eaba64c48db
3
+ metadata.gz: 3e0ae65d6e54cbc4599ea2ccb949acc9a2482ced
4
+ data.tar.gz: b71e1ebe3e447b7663e171bbf8de786e91e1cf53
5
5
  SHA512:
6
- metadata.gz: 5e68953fbfe313160f26784bcbbff717cc99e3a4225c0395771d98f00b833b60c0fba62ba2638950f78931bb2baed1188c5d0f1bcf431abfb1f7583077f6e604
7
- data.tar.gz: a25412df8a41ab71a004523a3f3b37b1cddd94efe003508f51f86c7827ae34edc8ddce253df716f1d882264c2232b53f516639bfb11b28648c377ccdd09142f0
6
+ metadata.gz: 1e95e29074f81ac939a68bdb16ff3d03a63dfcf5c2a9a50333c75932c386431f295d263d2c38bb1991210732e8cc39939b9babb961de719350bfe0eccbac1f19
7
+ data.tar.gz: 33581e5f053abf20126df74cce178e927afeabb4e363e295ed413b9e0065012d6f6f579cd49ee5553328b152a8435b09a6239aacfd6355734adaadc188af5e60
@@ -125,6 +125,11 @@ class OnChain::BlockChain
125
125
  if supplier == :blockr and method_name.to_s == 'address_history'
126
126
  next
127
127
  end
128
+
129
+ if supplier == :blockr and method_name.to_s == 'get_address_info'
130
+ next
131
+ end
132
+
128
133
  if supplier == :blockr and method_name.to_s == 'get_history_for_addresses'
129
134
  next
130
135
  end
@@ -59,6 +59,18 @@ class OnChain::BlockChain
59
59
  return hist
60
60
  end
61
61
 
62
+ def blockinfo_get_address_info(address)
63
+
64
+ base = "https://blockchain.info/multiaddr?&simple=true&active=" + address
65
+
66
+ json = fetch_response(URI::encode(base))
67
+
68
+ return { received: json[address]['total_received'],
69
+ balance: json[address]['final_balance'],
70
+ confirmed: json[address]['final_balance'] }
71
+
72
+ end
73
+
62
74
  def blockinfo_get_all_balances(addresses)
63
75
  base = "https://blockchain.info/multiaddr?&simple=true&active="
64
76
 
@@ -35,6 +35,16 @@ class OnChain::BlockChain
35
35
  return cache_read(address)
36
36
  end
37
37
 
38
+ def blockr_get_address_info(address)
39
+
40
+ json = blockr('address/balance', address)
41
+
42
+ return { received: json[address]['total_received'],
43
+ balance: json[address]['final_balance'],
44
+ confirmed: json[address]['final_balance'] }
45
+
46
+ end
47
+
38
48
  def blockr_get_transactions(address)
39
49
  base_url = "http://btc.blockr.io/api/v1/address/txs/#{address}"
40
50
  json = fetch_response(base_url, true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onchain
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Purton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake