buttercoin 0.0.1 → 0.0.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/.gitignore +1 -0
- data/README.md +7 -3
- data/lib/buttercoin/client.rb +2 -4
- data/lib/buttercoin/version.rb +1 -1
- data/spec/buttercoin/client_spec.rb +7 -7
- 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: 4ca69768dcaf030fefd5c5c8f72ac50343fa4fe2
|
4
|
+
data.tar.gz: f26484dffeb3b4a92c6aad1ddc82ae3d3bd40c42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2264bfe54422459eef45040dec2a5181d7a9275457df179d7aa9d9157460b42290a57067f6800b6a453304872ad79369f1c6fb292939e56f62e13a465d795cfb
|
7
|
+
data.tar.gz: b837014948655f9cfe0a2b0442860c31bc37299d964c8b8aeb8ce89d76dd2f545b18954d72f88edb18ceb5c0ac474b2601ee98f17fe715e8e685f385a0ecea6c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ In order to keep sensitive data out of your codebase, we recommend you use envir
|
|
28
28
|
|
29
29
|
BUTTERCOIN_PUBLIC_KEY=5ti8pqwejqfcla4se1d7whydryoso5z8
|
30
30
|
BUTTERCOIN_SECRET_KEY=JCfcasdfinmKtdHgIlwXi3SEMJoCf4Bg
|
31
|
-
BUTTERCOIN_MODE=
|
31
|
+
BUTTERCOIN_MODE=sandbox
|
32
32
|
|
33
33
|
You can also create a script to export the variables before you start your server.
|
34
34
|
|
@@ -42,13 +42,13 @@ Setting | Property Name | Description
|
|
42
42
|
--- | --- | ---
|
43
43
|
Public Key | `:public_key` | Your Buttercoin API Public Key
|
44
44
|
Secret Key | `:secret_key` | Your Buttercoin API Secret Key
|
45
|
-
Mode | `:mode` | Your development environment (default: `'production'`, set to `'
|
45
|
+
Mode | `:mode` | Your development environment (default: `'production'`, set to `'sandbox'` to test with testnet bitcoins)
|
46
46
|
|
47
47
|
###### Example
|
48
48
|
```ruby
|
49
49
|
client = Buttercoin::Client.new(:public_key => '5ti8pqwejqfcla4se1d7whydryoso5z8',
|
50
50
|
:secret_key => 'JCfcasdfinmKtdHgIlwXi3SEMJoCf4Bg',
|
51
|
-
:mode => '
|
51
|
+
:mode => 'sandbox')
|
52
52
|
```
|
53
53
|
|
54
54
|
#### Configuration can be updated to reuse the same Client:
|
@@ -299,4 +299,8 @@ The aim is to take your great ideas and make everyone's experience using Butterc
|
|
299
299
|
|
300
300
|
- First release.
|
301
301
|
|
302
|
+
### 0.0.2
|
303
|
+
|
304
|
+
- changed test environment to sandbox
|
305
|
+
|
302
306
|
## License
|
data/lib/buttercoin/client.rb
CHANGED
@@ -23,7 +23,7 @@ module Buttercoin
|
|
23
23
|
}
|
24
24
|
|
25
25
|
PRODUCTION_URI = 'https://api.buttercoin.com/v1'
|
26
|
-
SANDBOX_URI = 'https://
|
26
|
+
SANDBOX_URI = 'https://sandbox.buttercoin.com/v1'
|
27
27
|
|
28
28
|
CA_CERT = 'cert/ca-cert.crt'
|
29
29
|
|
@@ -40,7 +40,7 @@ module Buttercoin
|
|
40
40
|
|
41
41
|
self.public_key, self.secret_key = options.values_at(:public_key, :secret_key)
|
42
42
|
self.mode = options[:mode] || CONFIG[:mode]
|
43
|
-
self.class.base_uri (
|
43
|
+
self.class.base_uri (self.mode == 'production') ? PRODUCTION_URI : SANDBOX_URI
|
44
44
|
end
|
45
45
|
|
46
46
|
# Wrappers for the main HTTP verbs
|
@@ -125,8 +125,6 @@ module Buttercoin
|
|
125
125
|
begin
|
126
126
|
mash = Hashie::Mash.new(JSON.parse(response_body))
|
127
127
|
raise HttpError.new(mash.errors.first.message)
|
128
|
-
rescue
|
129
|
-
raise HttpError.new(response_body)
|
130
128
|
end
|
131
129
|
end
|
132
130
|
end
|
data/lib/buttercoin/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe Buttercoin::Client do
|
|
7
7
|
let(:public_key) { 'public key' }
|
8
8
|
let(:secret_key) { 'secret key' }
|
9
9
|
let(:mode) { 'sandbox' }
|
10
|
-
let(:client) { Buttercoin::Client.new(:public_key => public_key, :secret_key => secret_key) }
|
10
|
+
let(:client) { Buttercoin::Client.new(:public_key => public_key, :secret_key => secret_key, :mode => mode) }
|
11
11
|
|
12
12
|
|
13
13
|
before :all do
|
@@ -26,8 +26,8 @@ describe Buttercoin::Client do
|
|
26
26
|
expect(client.mode).to eq('sandbox')
|
27
27
|
end
|
28
28
|
|
29
|
-
it "should
|
30
|
-
expect(Buttercoin::Client.new.class.base_uri).to eq(Buttercoin::Client::
|
29
|
+
it "should default the base_uri to the production" do
|
30
|
+
expect(Buttercoin::Client.new.class.base_uri).to eq(Buttercoin::Client::PRODUCTION_URI)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -38,15 +38,15 @@ describe Buttercoin::Client do
|
|
38
38
|
let(:timestamp) { 1444444444444 }
|
39
39
|
let(:path) { '/orders' }
|
40
40
|
let(:options) do { :status => "opened" } end
|
41
|
-
let(:message) { "1444444444444https://
|
42
|
-
let(:signature) { "
|
41
|
+
let(:message) { "1444444444444https://sandbox.buttercoin.com/v1/orders?status=opened" }
|
42
|
+
let(:signature) { "SLkHo487FQg5k7hWC8GoK/Us8e51ddqKhsw7V1gMKq8=\n" }
|
43
43
|
|
44
44
|
it "should build proper get request message for signing" do
|
45
|
-
expect(build_message.call(:get, path, timestamp, options)).to eq("1444444444444https://
|
45
|
+
expect(build_message.call(:get, path, timestamp, options)).to eq("1444444444444https://sandbox.buttercoin.com/v1/orders?status=opened")
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should build proper get request message for signing" do
|
49
|
-
expect(build_message.call(:post, path, timestamp, options)).to eq("1444444444444https://
|
49
|
+
expect(build_message.call(:post, path, timestamp, options)).to eq("1444444444444https://sandbox.buttercoin.com/v1/orders{\"status\":\"opened\"}")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should properly sign a message with the given key" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercoin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Adams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|