uphold 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/uphold/options.rb +5 -19
- data/lib/uphold/version.rb +1 -1
- data/spec/unit/client_spec.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: 0ea311052aefef8d48f00041ec404a864e296d07
|
4
|
+
data.tar.gz: c0daaf546e7a1c033b1d58306952e027b01c87f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8562644ea03754faf17641ba96ac1d3728a3c70936226ff2816657a322329970cf92414a55efd59ce76117ba0ea5915cb0e8d33aefd6d2e9ddaa122b32af1d68
|
7
|
+
data.tar.gz: 6c7ea074cafd84793b25c662964d2594fb73dc9a7eb22a77189122e7a9ecb0c59cca427cdf426c4acb92e1a01bcb3dabe2d44b017b459d197090e35ca6693cce
|
data/.gitignore
CHANGED
data/lib/uphold/options.rb
CHANGED
@@ -9,7 +9,11 @@ module Uphold
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def bearer_token
|
12
|
-
@bearer_token ||=
|
12
|
+
@bearer_token ||= (
|
13
|
+
options[:token] ||
|
14
|
+
ENV['UPHOLD_AUTH_TOKEN'] ||
|
15
|
+
ENV['BITRESERVE_AUTH_TOKEN']
|
16
|
+
)
|
13
17
|
end
|
14
18
|
|
15
19
|
def authorization_header
|
@@ -17,23 +21,5 @@ module Uphold
|
|
17
21
|
|
18
22
|
{ 'Authorization' => "Bearer #{bearer_token}" }
|
19
23
|
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def authenticate!
|
24
|
-
return options[:token] if options[:token]
|
25
|
-
return ENV['UPHOLD_AUTH_TOKEN'] if !options[:client_id] || !options[:client_secret]
|
26
|
-
|
27
|
-
response = Request.new(RequestData.new('/me/tokens', nil, {}, authentication_body)).post #perform(:post, '/oauth/token', body: authentication_body)
|
28
|
-
Hash(response).fetch('access_token', nil)
|
29
|
-
end
|
30
|
-
|
31
|
-
def authentication_body
|
32
|
-
{
|
33
|
-
grant_type: 'client_credentials',
|
34
|
-
client_id: options[:client_id],
|
35
|
-
client_secret: options[:client_secret]
|
36
|
-
}
|
37
|
-
end
|
38
24
|
end
|
39
25
|
end
|
data/lib/uphold/version.rb
CHANGED
data/spec/unit/client_spec.rb
CHANGED
@@ -21,13 +21,13 @@ module Uphold
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'uses the production api by default' do
|
24
|
-
Uphold.sandbox = false
|
25
24
|
expect(Uphold.api_base).to eq Uphold::Options::API_BASE
|
26
25
|
end
|
27
26
|
|
28
27
|
it 'uses the sandbox api when asked to' do
|
29
28
|
Uphold.sandbox = true
|
30
29
|
expect(Uphold.api_base).to eq Uphold::Options::SANDBOX_API_BASE
|
30
|
+
Uphold.sandbox = false
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uphold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subvisual
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|