blockcypher-ruby 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +8 -3
  3. data/lib/blockcypher-ruby.rb +1 -0
  4. data/lib/blockcypher/api.rb +75 -41
  5. data/spec/blockcypher/api_spec.rb +100 -57
  6. data/spec/config.yml.sample +2 -0
  7. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/Asset_API/Asset_Transfer/should_transfer_asset.yml +1349 -0
  8. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/Asset_API/Generate_Asset_Address/should_include_private_public_oap_address_original_address_hashes.yml +51 -0
  9. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/Asset_API/Issue_Asset/should_issue_asset.yml +156 -0
  10. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_address_final_balance/should_get_the_balance_of_an_address.yml +102 -0
  11. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_address_generate/should_generate_new_addresses.yml +97 -0
  12. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_create_forwarding_address/allows_creating_a_payment_forward_with_a_callback.yml +100 -0
  13. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_create_forwarding_address/allows_creating_a_payment_forward_with_a_callback_and_confirmation_notifications_enabled.yml +101 -0
  14. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_create_forwarding_address/allows_creating_a_payment_forward_with_options.yml +102 -0
  15. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_create_forwarding_address/creates_a_payment_forward.yml +99 -0
  16. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_create_forwarding_address/is_possible_to_use_the_alias_create_payments_forwarding.yml +99 -0
  17. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_delete_forwarding_address/deletes_all_previously_created_forwarding_addresses.yml +269 -0
  18. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_faucet/should_fund_a_bcy_test_address_with_the_faucet.yml +96 -0
  19. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_list_forwarding_addresses/lists_all_forwading_addresses_created_for_a_given_token.yml +119 -0
  20. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_transaction_new/should_call_the_txs/new_api.yml +187 -0
  21. data/spec/fixtures/vcr_cassettes/BlockCypher_Api/_transaction_sign_and_send/should_call_txs/send_api.yml +187 -0
  22. data/spec/spec_helper.rb +15 -0
  23. data/spec/support/vcr.rb +10 -0
  24. metadata +66 -6
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.blockcypher.com/v1/bcy/test/oap/addrs?token=<api_token>
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.9.12
23
+ Date:
24
+ - Tue, 25 Oct 2016 06:36:08 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '346'
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '179'
39
+ body:
40
+ encoding: UTF-8
41
+ string: |-
42
+ {
43
+ "private": "7ac4a4899444c04253d731ad792e4c287e022d199560d14c638c4935cd8ae1ff",
44
+ "public": "023e05052f7c9ba4f341649237ebbe901bf9c5968b656239115c72ed15d743e860",
45
+ "oap_address": "1C1f946JkAnYYQUEr45YLjUDFB16nT4oR2j",
46
+ "original_address": "C1f946JkAnYYQUEr45YLjUDFB16nQAKtrh",
47
+ "wif": "BsSgAH7YPHMmWgryXLAnkUvJTLruvLQx7drWefhiiMTWqLCMRq3H"
48
+ }
49
+ http_version:
50
+ recorded_at: Tue, 25 Oct 2016 06:36:08 GMT
51
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,156 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.blockcypher.com/v1/bcy/test/oap/addrs?token=<api_token>
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.9.12
23
+ Date:
24
+ - Tue, 25 Oct 2016 06:36:09 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '346'
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '195'
39
+ body:
40
+ encoding: UTF-8
41
+ string: |-
42
+ {
43
+ "private": "c5b98c7a8c7bd1825410a58313e516d62326e9b4969e8d9ec09be955446c4907",
44
+ "public": "02f2c92c8f0925a2ef5eef62cfd19cf72d236d780755cc4aaf6dea63f195d70b2e",
45
+ "oap_address": "1C5cM5T8vXfe9SaJKWCgMrgTixnxZcmDb4y",
46
+ "original_address": "C5cM5T8vXfe9SaJKWCgMrgTixnxZYUKnT1",
47
+ "wif": "BuxP78R9erkyRXco5p1baiEZM3rEGqpury2oSSK9pXBgxxfyAurr"
48
+ }
49
+ http_version:
50
+ recorded_at: Tue, 25 Oct 2016 06:36:10 GMT
51
+ - request:
52
+ method: post
53
+ uri: https://api.blockcypher.com/v1/bcy/test/faucet?token=<api_token>
54
+ body:
55
+ encoding: UTF-8
56
+ string: '{"address":"C5cM5T8vXfe9SaJKWCgMrgTixnxZYUKnT1","amount":1000000}'
57
+ headers:
58
+ Accept-Encoding:
59
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60
+ Accept:
61
+ - "*/*"
62
+ User-Agent:
63
+ - Ruby
64
+ Content-Type:
65
+ - application/json
66
+ response:
67
+ status:
68
+ code: 200
69
+ message: OK
70
+ headers:
71
+ Server:
72
+ - nginx/1.11.2
73
+ Date:
74
+ - Tue, 25 Oct 2016 06:36:11 GMT
75
+ Content-Type:
76
+ - application/json
77
+ Content-Length:
78
+ - '82'
79
+ Connection:
80
+ - keep-alive
81
+ Access-Control-Allow-Headers:
82
+ - Origin, X-Requested-With, Content-Type, Accept
83
+ Access-Control-Allow-Methods:
84
+ - GET, POST, PUT, DELETE
85
+ Access-Control-Allow-Origin:
86
+ - "*"
87
+ X-Ratelimit-Remaining:
88
+ - '176'
89
+ body:
90
+ encoding: UTF-8
91
+ string: |-
92
+ {
93
+ "tx_ref": "b6e86704af5d31955370c5df3acdd5c8cd73a05ff934eb78aac03175e1c25a86"
94
+ }
95
+ http_version:
96
+ recorded_at: Tue, 25 Oct 2016 06:36:11 GMT
97
+ - request:
98
+ method: post
99
+ uri: https://api.blockcypher.com/v1/bcy/test/oap/issue?token=<api_token>
100
+ body:
101
+ encoding: UTF-8
102
+ string: '{"from_private":"c5b98c7a8c7bd1825410a58313e516d62326e9b4969e8d9ec09be955446c4907","to_address":"1C5cM5T8vXfe9SaJKWCgMrgTixnxZcmDb4y","amount":1000}'
103
+ headers:
104
+ Accept-Encoding:
105
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106
+ Accept:
107
+ - "*/*"
108
+ User-Agent:
109
+ - Ruby
110
+ Content-Type:
111
+ - application/json
112
+ response:
113
+ status:
114
+ code: 201
115
+ message: Created
116
+ headers:
117
+ Server:
118
+ - nginx/1.9.12
119
+ Date:
120
+ - Tue, 25 Oct 2016 06:36:13 GMT
121
+ Content-Type:
122
+ - application/json
123
+ Content-Length:
124
+ - '392'
125
+ Connection:
126
+ - keep-alive
127
+ Access-Control-Allow-Headers:
128
+ - Origin, X-Requested-With, Content-Type, Accept
129
+ Access-Control-Allow-Methods:
130
+ - GET, POST, PUT, DELETE
131
+ Access-Control-Allow-Origin:
132
+ - "*"
133
+ X-Ratelimit-Remaining:
134
+ - '194'
135
+ body:
136
+ encoding: UTF-8
137
+ string: |-
138
+ {
139
+ "ver": 1,
140
+ "assetid": "1EfiAViDcsVHJoabNnaSHGh7EogkAboW1b",
141
+ "oap_meta": "",
142
+ "hash": "a9ee3352e4c5f39b9a887740ddf5f2359096e1dbf84402b4f3652ce5c4aed96c",
143
+ "received": "2016-10-25T06:36:13.085784805Z",
144
+ "double_spend": false,
145
+ "inputs": [],
146
+ "outputs": [
147
+ {
148
+ "address": "1C5cM5T8vXfe9SaJKWCgMrgTixnxZcmDb4y",
149
+ "value": 1000,
150
+ "original_output_index": 0
151
+ }
152
+ ]
153
+ }
154
+ http_version:
155
+ recorded_at: Tue, 25 Oct 2016 06:36:13 GMT
156
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,102 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.blockcypher.com/v1/bcy/test/addrs?token=<api_token>
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.9.12
23
+ Date:
24
+ - Tue, 25 Oct 2016 06:35:44 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '281'
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '182'
39
+ body:
40
+ encoding: UTF-8
41
+ string: |-
42
+ {
43
+ "private": "f29b1419cd0b3943ba595cdfb1e0c8ed666693997e1cf1097c906baeab927358",
44
+ "public": "03ea9a402647cced83b71ea92a96a5ffcf85ebfdc9e3e19fcf71d318f9408591bd",
45
+ "address": "C964NAK4Refx6XGoynP6wvF3RDE8d6AJzb",
46
+ "wif": "BwTdBkEPSpczgQyBxGGRJ6q5b94jLamSzELWj5WDnyPZUCJWD9KQ"
47
+ }
48
+ http_version:
49
+ recorded_at: Tue, 25 Oct 2016 06:35:45 GMT
50
+ - request:
51
+ method: get
52
+ uri: https://api.blockcypher.com/v1/bcy/test/addrs/C964NAK4Refx6XGoynP6wvF3RDE8d6AJzb/balance?omitWalletAddresses=false&token=<api_token>
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ''
56
+ headers:
57
+ Accept-Encoding:
58
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
59
+ Accept:
60
+ - "*/*"
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Server:
69
+ - nginx/1.9.12
70
+ Date:
71
+ - Tue, 25 Oct 2016 06:35:46 GMT
72
+ Content-Type:
73
+ - application/json
74
+ Transfer-Encoding:
75
+ - chunked
76
+ Connection:
77
+ - keep-alive
78
+ Access-Control-Allow-Headers:
79
+ - Origin, X-Requested-With, Content-Type, Accept
80
+ Access-Control-Allow-Methods:
81
+ - GET, POST, PUT, DELETE
82
+ Access-Control-Allow-Origin:
83
+ - "*"
84
+ X-Ratelimit-Remaining:
85
+ - '181'
86
+ body:
87
+ encoding: ASCII-8BIT
88
+ string: |-
89
+ {
90
+ "address": "C964NAK4Refx6XGoynP6wvF3RDE8d6AJzb",
91
+ "total_received": 0,
92
+ "total_sent": 0,
93
+ "balance": 0,
94
+ "unconfirmed_balance": 0,
95
+ "final_balance": 0,
96
+ "n_tx": 0,
97
+ "unconfirmed_n_tx": 0,
98
+ "final_n_tx": 0
99
+ }
100
+ http_version:
101
+ recorded_at: Tue, 25 Oct 2016 06:35:46 GMT
102
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,97 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.blockcypher.com/v1/bcy/test/addrs?token=<api_token>
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.9.12
23
+ Date:
24
+ - Tue, 25 Oct 2016 06:34:55 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '281'
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '185'
39
+ body:
40
+ encoding: UTF-8
41
+ string: |-
42
+ {
43
+ "private": "3ec42fb035d591cd252a30441c105d2d44b9ae51cf69c0fcfc0b771feaa01ddf",
44
+ "public": "0228287639157aa3f437c99aa25ca91fbecdd7246cd48e0c111998ec28179e5e3c",
45
+ "address": "C4n93JUZetFGG9pt4K56kcknHCm4r1Ek9k",
46
+ "wif": "BqS3J2y63KzB7p4YWTRXHAP8oU55XtQRwMdsC67ixBBMnLnUsRib"
47
+ }
48
+ http_version:
49
+ recorded_at: Tue, 25 Oct 2016 06:34:55 GMT
50
+ - request:
51
+ method: post
52
+ uri: https://api.blockcypher.com/v1/bcy/test/addrs?token=<api_token>
53
+ body:
54
+ encoding: UTF-8
55
+ string: ''
56
+ headers:
57
+ Accept-Encoding:
58
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
59
+ Accept:
60
+ - "*/*"
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 201
66
+ message: Created
67
+ headers:
68
+ Server:
69
+ - nginx/1.9.12
70
+ Date:
71
+ - Tue, 25 Oct 2016 06:34:56 GMT
72
+ Content-Type:
73
+ - application/json
74
+ Content-Length:
75
+ - '281'
76
+ Connection:
77
+ - keep-alive
78
+ Access-Control-Allow-Headers:
79
+ - Origin, X-Requested-With, Content-Type, Accept
80
+ Access-Control-Allow-Methods:
81
+ - GET, POST, PUT, DELETE
82
+ Access-Control-Allow-Origin:
83
+ - "*"
84
+ X-Ratelimit-Remaining:
85
+ - '184'
86
+ body:
87
+ encoding: UTF-8
88
+ string: |-
89
+ {
90
+ "private": "36ab071c346df251b5a0380e274103cccf208a43f7f8c6163f984ade033d7838",
91
+ "public": "02f665c1397cae5f82236af90eab78c686d63a41ff5906d92812c83d47474d6c98",
92
+ "address": "Btr8fDMAKwXHSZQyoEtyDeEa7dcq7QXbYo",
93
+ "wif": "BqAJFyyReBUaPnEaLzRKPUuAsNYbswP2rcWqoC2brnVDTCSs82eF"
94
+ }
95
+ http_version:
96
+ recorded_at: Tue, 25 Oct 2016 06:34:56 GMT
97
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,100 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.blockcypher.com/v1/bcy/test/addrs?token=<api_token>
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.9.12
23
+ Date:
24
+ - Tue, 25 Oct 2016 06:35:50 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '281'
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '186'
39
+ body:
40
+ encoding: UTF-8
41
+ string: |-
42
+ {
43
+ "private": "203ec39df399ebc4a2a7f4cf3aae689cb810f63dce2393cfc203767795b991b0",
44
+ "public": "035a9b2851abf125d1eb2ccffd6360c108b705a753abda1d7fa957951c54b10d0a",
45
+ "address": "Bz1kdFmvRP3sxw3YTG1iz6Q1xvFSV3taLd",
46
+ "wif": "BpQiCeoPkejjPHD3c6ijkEw4SN1PjwzZzE6d1U6TSxF8akF4YirN"
47
+ }
48
+ http_version:
49
+ recorded_at: Tue, 25 Oct 2016 06:35:50 GMT
50
+ - request:
51
+ method: post
52
+ uri: https://api.blockcypher.com/v1/bcy/test/payments?token=<api_token>
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"destination":"Bz1kdFmvRP3sxw3YTG1iz6Q1xvFSV3taLd","callback_url":"http://test.com/foo","enable_confirmations":false}'
56
+ headers:
57
+ Accept-Encoding:
58
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
59
+ Accept:
60
+ - "*/*"
61
+ User-Agent:
62
+ - Ruby
63
+ Content-Type:
64
+ - application/json
65
+ response:
66
+ status:
67
+ code: 201
68
+ message: Created
69
+ headers:
70
+ Server:
71
+ - nginx/1.9.12
72
+ Date:
73
+ - Tue, 25 Oct 2016 06:35:51 GMT
74
+ Content-Type:
75
+ - application/json
76
+ Content-Length:
77
+ - '250'
78
+ Connection:
79
+ - keep-alive
80
+ Access-Control-Allow-Headers:
81
+ - Origin, X-Requested-With, Content-Type, Accept
82
+ Access-Control-Allow-Methods:
83
+ - GET, POST, PUT, DELETE
84
+ Access-Control-Allow-Origin:
85
+ - "*"
86
+ X-Ratelimit-Remaining:
87
+ - '180'
88
+ body:
89
+ encoding: UTF-8
90
+ string: |-
91
+ {
92
+ "id": "94f44d55-8155-458d-b3b9-142084c1ad5e",
93
+ "token": "<api_token>",
94
+ "destination": "Bz1kdFmvRP3sxw3YTG1iz6Q1xvFSV3taLd",
95
+ "input_address": "CD3jhqqaS8QvaNG7aVzPUGuWbFhdHknRkR",
96
+ "callback_url": "http://test.com/foo"
97
+ }
98
+ http_version:
99
+ recorded_at: Tue, 25 Oct 2016 06:35:52 GMT
100
+ recorded_with: VCR 3.0.3