coinkite 0.9.1 → 0.9.2
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/README.md +9 -3
- data/lib/coinkite.rb +8 -2
- data/lib/coinkite/version.rb +1 -1
- data/spec/coinkite_spec.rb +24 -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: a55952a8ebf27fb69ded304a66eaa464fdff884e
|
4
|
+
data.tar.gz: bcff1555ac106ceeed468fd6d46d6b6a0bb8bf3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca4289c12b2298c407c0edd1fddcc99421f35d74a567a485e2008e5f49ef51f1b113ddccc9ba47031c476cb86ab6a8e12c2b303098b39e6844b2f338f33316c4
|
7
|
+
data.tar.gz: 25c85a4bee81135ba9d32fd01716f22f84549991d6dc2dfb448e1af244e47944f573ee0b05e621180743831fc44eb95b65ce6999f243ae90cd109f509957fe1c
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Coinkite API Code for Ruby
|
1
|
+
# Coinkite Bitcoin API Code for Ruby
|
2
2
|
|
3
3
|
[Learn more about Coinkite's API here](https://docs.coinkite.com/)
|
4
4
|
and visit the [Coinkite Main Site](https://coinkite.com/) to open your
|
@@ -17,8 +17,14 @@ Header lines you need:
|
|
17
17
|
X-CK-Timestamp: 2014-06-23T03:10:04.905376
|
18
18
|
X-CK-Sign: 0aa7755aaa45189a98a5a8a887a564aa55aa5aa4aa7a98aa2858aaa60a5a56aa
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
### Ruby Gems
|
21
|
+
|
22
|
+
[](http://badge.fury.io/rb/coinkite)
|
23
|
+
|
24
|
+
Use the [Coinkite Gem](http://rubygems.org/gems/coinkite) for a more complete solution that also checks SSL certificates, handles some errors and wraps some API calls.
|
25
|
+
|
26
|
+
_Quick install_ `gem install coinkite`
|
27
|
+
|
22
28
|
|
23
29
|
## How to Install
|
24
30
|
|
data/lib/coinkite.rb
CHANGED
@@ -26,7 +26,7 @@ module Coinkite
|
|
26
26
|
|
27
27
|
def request(method, endpoint, params={}, headers={})
|
28
28
|
unless api_key ||= @api_key
|
29
|
-
raise
|
29
|
+
raise CoinkiteError.new('No API key provided. ' +
|
30
30
|
'Set your API key using "Coinkite.api_key = <API-KEY>". ' +
|
31
31
|
'You can generate API keys from the Coinkite web interface. ')
|
32
32
|
end
|
@@ -137,7 +137,7 @@ module Coinkite
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def request_headers(endpoint, force_ts=nil)
|
140
|
-
signature, timestamp = make_signature(endpoint, force_ts)
|
140
|
+
signature, timestamp = make_signature(_signable_endpoint(endpoint), force_ts)
|
141
141
|
|
142
142
|
{
|
143
143
|
'X-CK-Key' => @api_key,
|
@@ -197,6 +197,12 @@ module Coinkite
|
|
197
197
|
endpoint = "/v1/list/#{what}"
|
198
198
|
get_iter(endpoint)
|
199
199
|
end
|
200
|
+
|
201
|
+
private
|
202
|
+
def _signable_endpoint(endpoint)
|
203
|
+
# return endpoint without query string
|
204
|
+
endpoint.split("?").first
|
205
|
+
end
|
200
206
|
end
|
201
207
|
end
|
202
208
|
|
data/lib/coinkite/version.rb
CHANGED
data/spec/coinkite_spec.rb
CHANGED
@@ -5,6 +5,29 @@ describe Coinkite do
|
|
5
5
|
@coinkite = Coinkite::Client.new(ENV['CK_API_KEY'], ENV['CK_API_SECRET'])
|
6
6
|
end
|
7
7
|
|
8
|
+
describe "#_signable_endpoint" do
|
9
|
+
let(:endpoint_with_query_string) { "https://api.coinkite.com/v1/my/accounts?foo=bar" }
|
10
|
+
let(:endpoint_without_query_string) { "https://api.coinkite.com/v1/my/accounts" }
|
11
|
+
|
12
|
+
it "should return endpoint without query string if given one" do
|
13
|
+
expect(@coinkite.send(:_signable_endpoint, endpoint_with_query_string)).to eq(endpoint_without_query_string)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return endpoint without query string if given none" do
|
17
|
+
expect(@coinkite.send(:_signable_endpoint, endpoint_without_query_string)).to eq(endpoint_without_query_string)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#get" do
|
22
|
+
context "with query string in endpoint" do
|
23
|
+
it "should be retrievable" do
|
24
|
+
WebMock.allow_net_connect!
|
25
|
+
spot_quote = @coinkite.get('/v1/spot_quote?to_cct=ZAR')
|
26
|
+
expect(spot_quote).to have_key("result")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
8
31
|
describe "#get_accounts" do
|
9
32
|
it "should be retrievable" do
|
10
33
|
stub_request(:get, "https://api.coinkite.com/v1/my/accounts").to_return(body: fixture("accounts.json"))
|
@@ -24,7 +47,7 @@ describe Coinkite do
|
|
24
47
|
@activities.next
|
25
48
|
end
|
26
49
|
|
27
|
-
|
50
|
+
it "should return an Enumerator" do
|
28
51
|
expect(@activities).to be_kind_of(Enumerator)
|
29
52
|
end
|
30
53
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinkite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilia Lobsanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|