uphold 1.0.1 → 1.1.0

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: 00473b601ec27323673b55ba2318a4a04fb37ed1
4
- data.tar.gz: 8b5ce0ca9f8efaebe34e8fac6607396658a70da1
3
+ metadata.gz: 0ea311052aefef8d48f00041ec404a864e296d07
4
+ data.tar.gz: c0daaf546e7a1c033b1d58306952e027b01c87f7
5
5
  SHA512:
6
- metadata.gz: 4c5378f901a9b721e0d8d5bcc45b5819d0d687e29aa27ba5af8f91bd380131a761b083ad3781291eb0eb145a9ba9215096b9ece0a484ef554f00c87f520ca2d9
7
- data.tar.gz: c6a661cc19d0908f587148005a54c8766da56abca5735306b10a72a29b71fefbe1f92b1d239b645def0602a01305f0d6f3f09d7e4f04f995007c007729602240
6
+ metadata.gz: 8562644ea03754faf17641ba96ac1d3728a3c70936226ff2816657a322329970cf92414a55efd59ce76117ba0ea5915cb0e8d33aefd6d2e9ddaa122b32af1d68
7
+ data.tar.gz: 6c7ea074cafd84793b25c662964d2594fb73dc9a7eb22a77189122e7a9ecb0c59cca427cdf426c4acb92e1a01bcb3dabe2d44b017b459d197090e35ca6693cce
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ tags
17
17
  .tags
18
18
  path
19
19
  .ruby-version
20
+ *.gem
@@ -9,7 +9,11 @@ module Uphold
9
9
  end
10
10
 
11
11
  def bearer_token
12
- @bearer_token ||= authenticate!
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
@@ -1,3 +1,3 @@
1
1
  module Uphold
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -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.1
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-14 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty