coinstats 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coinstats.rb +18 -0
- data/lib/coinstats/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08d96eda82d78a4265ce9cca3a8fec228720bc7b
|
4
|
+
data.tar.gz: d3780438046a9ca599fee45677996ab97bb2bcf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4db15063b3b5bad6d1091dce7333587528f959f622587464048e5ec1beb3dfdfc73f04145b38fe6f77535db8c4553f1ec0341144389f0af7074ec992bfc6527
|
7
|
+
data.tar.gz: bbbeb2a11f032b1f6cdf2d9afc5b3ec17800907ea98b34fdb3596ead086bb20f307bee221680e8eace78fb216fa932b065fd36e55fcf1a22a9a526c99d85e39e
|
data/lib/coinstats.rb
CHANGED
@@ -4,4 +4,22 @@ module Coinstats
|
|
4
4
|
def self.add(a,b)
|
5
5
|
a + b
|
6
6
|
end
|
7
|
+
def get_http(url, body=nil)
|
8
|
+
nonce = (Time.now.to_f * 1e6).to_i
|
9
|
+
message = nonce.to_s + url + body.to_s
|
10
|
+
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha256'), API_SECRET, message)
|
11
|
+
headers = {"ACCESS_KEY" => API_KEY,
|
12
|
+
"ACCESS_SIGNATURE" => signature,
|
13
|
+
"ACCESS_NONCE" => nonce}
|
14
|
+
begin
|
15
|
+
if body.nil?
|
16
|
+
RestClient.get(url, headers)
|
17
|
+
else
|
18
|
+
RestClient.post(url, body, headers)
|
19
|
+
end
|
20
|
+
rescue => e
|
21
|
+
puts e
|
22
|
+
e.response
|
23
|
+
end
|
24
|
+
end
|
7
25
|
end
|
data/lib/coinstats/version.rb
CHANGED