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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09719fb406dae1eb4e0e589a92db14b05f02fb2b
4
- data.tar.gz: e0c4b67e64237221e2cc1c3ad311e90880ca5686
3
+ metadata.gz: a55952a8ebf27fb69ded304a66eaa464fdff884e
4
+ data.tar.gz: bcff1555ac106ceeed468fd6d46d6b6a0bb8bf3e
5
5
  SHA512:
6
- metadata.gz: 968a0e2a3c29b7c560dc44c191628bbe1896145e2027a8deb195d96c577360131d72f137463b1c935ade405edf3c1e3f651fbd251f79b353e95ce2ea9c813e37
7
- data.tar.gz: aed894aa94f9e9c005067a7f04afbfb9684434ec73d299ce8ef9c8918e6fcc7dc2fcbf1b6fd52bbfde7b6e5dd7d243c127a632fa8a0084e490eaeaa26ef85d8e
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
- Use the Gem for a more complete solution that also checks SSL certificates,
21
- handles some errors and wraps some API calls.
20
+ ### Ruby Gems
21
+
22
+ [![Gem Version](https://badge.fury.io/rb/coinkite.svg)](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
 
@@ -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 AuthenticationError.new('No API key provided. ' +
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
 
@@ -1,3 +1,3 @@
1
1
  module Coinkite
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
@@ -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
- it "should return an Enumerator" do
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.1
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-07-16 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client