blocktrail 0.2.0 → 0.2.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 +4 -4
- data/lib/blocktrail/client.rb +46 -2
- data/lib/blocktrail/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c74c5af3afb7cba558d51d7f9914c7ddd0152c83
|
|
4
|
+
data.tar.gz: 1973271252a3599117873c9b02f5675cb96544c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e60460f3378fbac41f0212f62420a290b0e0677811b4094a7da565e146ffeb9a4f71d114a8330dec342faba5a2ebc973fd2b77e7559022ead100a00ace530c9e
|
|
7
|
+
data.tar.gz: f97d39fc9696e73aa15d6424558dc1bc3764798d8a8751c4db345df924651af9d06904184bdb8520f57112c2d9dd5de7d9481e96a944a7d882186abcdbf6befe
|
data/lib/blocktrail/client.rb
CHANGED
|
@@ -116,14 +116,54 @@ module Blocktrail
|
|
|
116
116
|
get("/webhook/#{identifier}/events", {}, params: { page: page, limit: limit })
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
+
def setup_webhook(url, identifier = nil)
|
|
120
|
+
post("/webhook", { url: url, identifier: identifier })
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def update_webhook(identifier, new_url = nil, new_identifier = nil)
|
|
124
|
+
put("/webhook/#{identifier}", { url: new_url, identifier: new_identifier })
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def delete_webhook(identifier)
|
|
128
|
+
delete("/webhook/#{identifier}")
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def subscribe_address_transactions(identifier, address, confirmations = 6)
|
|
132
|
+
post("/webhook/#{identifier}/events", { event_type: 'address-transactions', address: address, confirmations: confirmations })
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def subscribe_new_blocks(identifier)
|
|
136
|
+
post("/webhook/#{identifier}/events", { event_type: 'block' })
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def subscribe_transaction(identifier, transaction, confirmations = 6)
|
|
140
|
+
post("/webhook/#{identifier}/events", { event_type: 'transaction', transaction: transaction, confirmations: confirmations })
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def unsubscribe_address_transactions(identifier, address)
|
|
144
|
+
delete("/webhook/#{identifier}/address-transactions/#{address}")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def unsubscribe_new_blocks(identifier)
|
|
148
|
+
delete("/webhook/#{identifier}/block")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def unsubscribe_transaction(identifier, transaction)
|
|
152
|
+
delete("/webhook/#{identifier}/transaction/#{transaction}")
|
|
153
|
+
end
|
|
154
|
+
|
|
119
155
|
def price
|
|
120
156
|
get("/price")
|
|
121
157
|
end
|
|
122
158
|
|
|
159
|
+
def verify_message(message, address, signature)
|
|
160
|
+
post("/verify_message", { message: message, address: address, signature: signature })
|
|
161
|
+
end
|
|
162
|
+
|
|
123
163
|
# Payments API
|
|
124
164
|
|
|
125
165
|
def all_wallets(page = 1, limit = 20)
|
|
126
|
-
get("/wallets",
|
|
166
|
+
get("/wallets", {}, params: { page: page, limit: limit })
|
|
127
167
|
end
|
|
128
168
|
|
|
129
169
|
def get_wallet(identifier)
|
|
@@ -142,6 +182,10 @@ module Blocktrail
|
|
|
142
182
|
post("/wallet/#{identifier}/path", { path: path })
|
|
143
183
|
end
|
|
144
184
|
|
|
185
|
+
def send_transaction(identifier, raw_tx, paths, check_fee = false)
|
|
186
|
+
post("/wallet/#{identifier}/send", { raw_transaction: raw_tx, paths: paths }, params: { check_fee: check_fee })
|
|
187
|
+
end
|
|
188
|
+
|
|
145
189
|
private
|
|
146
190
|
|
|
147
191
|
def request(method, url, payload = {}, headers = {})
|
|
@@ -172,7 +216,7 @@ module Blocktrail
|
|
|
172
216
|
puts 'Headers: ' + response.headers.inspect
|
|
173
217
|
puts 'Content: ' + response.body.inspect
|
|
174
218
|
end
|
|
175
|
-
response.empty? ? nil : JSON.parse(response)
|
|
219
|
+
response.empty? ? nil : JSON.parse(response, quirks_mode: true)
|
|
176
220
|
rescue RestClient::ExceptionWithResponse => error
|
|
177
221
|
raise Blocktrail::Exceptions.build_exception(error)
|
|
178
222
|
end
|
data/lib/blocktrail/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blocktrail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuri Skurikhin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-03-
|
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|