omniauth-uphold 2.0.1 → 2.1.1

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: f7e8d45078570334f20ef61f383d1c474400f016
4
- data.tar.gz: 2ac39f6f534c28b550862b5495e094944c89a077
3
+ metadata.gz: b2e11878cc7a471e29e90f2c5855b369c20e91d4
4
+ data.tar.gz: 316f5183a7ce7a62a49bfd555f76a4d56ada05f2
5
5
  SHA512:
6
- metadata.gz: a6ec98c68902d861ca8f996170d3c66b1ff1225accaa380774a413c4d1942930a566838c39a65eeceb6550a34561ee43b3554de7f5823371bfdefcd679dd215f
7
- data.tar.gz: ce6288817c53669829e37e7cc8f42e68974b6f18aece70cab6f270f16237ba051f72a496fe7dbb9682c9078d92a2e6d1f52e439094a2fa45c89b014853b48d7d
6
+ metadata.gz: afcb246257e543e15e4334b66dcbedb2934aa576f4019b624da7e81f3991ee1d94d27725c40a2680a515ab8fc3a80420e266ac15c53da1ed7ea99b8e2838fe9e
7
+ data.tar.gz: 7fa2309a30dec640f09146a36ed4e2a48b6c9a53807b8f15f458bb1c06c060954854cd7a7186e0b8ac2312e7e6da6828e6251dd7f177538dc9bacd0275f5232d
data/README.md CHANGED
@@ -28,14 +28,15 @@ end
28
28
 
29
29
  ## Sandbox API
30
30
 
31
- Uphold supports a sandbox environment for testing purposes. To use it with this strategy, you'll need to use the following environment variables:
31
+ Uphold supports a sandbox environment for testing purposes. To use it you will need a different strategy:
32
32
 
33
- ```
34
- uphold_URL="https://sandbox.uphold.com"
35
- uphold_API_URL="https://api-sandbox.uphold.com"
33
+ ```ruby
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider :uphold_sandbox, 'API_KEY', 'API_SECRET', name: :uphold
36
+ end
36
37
  ```
37
38
 
38
- We recommend [dotenv](https://github.com/bkeepers/dotenv) for this.
39
+ You can add `name: :uphold` to make sure it uses the same route names as if you were using the main strategy.
39
40
 
40
41
  ## Contributing
41
42
 
@@ -1,2 +1,3 @@
1
1
  require 'omniauth-uphold/version'
2
2
  require 'omniauth/strategies/uphold'
3
+ require 'omniauth/strategies/uphold_sandbox'
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Uphold
3
- VERSION = '2.0.1'
3
+ VERSION = '2.1.1'
4
4
  end
5
5
  end
@@ -5,18 +5,22 @@ module OmniAuth
5
5
  class Uphold < ::OmniAuth::Strategies::OAuth2
6
6
  include ::OmniAuth::Strategy
7
7
 
8
- UPHOLD_URL = ENV['UPHOLD_URL'] || ENV['BITRESERVE_URL'] || 'https://uphold.com'
9
- UPHOLD_API_URL = ENV['UPHOLD_API_URL'] || ENV['BITRESERVE_API_URL'] || 'https://api.uphold.com'
8
+ @uphold_url = 'https://uphold.com'
9
+ @uphold_api_url = 'https://api.uphold.com'
10
+
11
+ class << self
12
+ attr_reader :uphold_url, :uphold_api_url
13
+ end
10
14
 
11
15
  option :name, :uphold
12
16
  option :client_options, {
13
- site: UPHOLD_API_URL,
17
+ site: @uphold_api_url,
14
18
  token_url: 'oauth2/token'
15
19
  }
16
20
 
17
21
  def initialize(app, *args, &block)
18
22
  super
19
- options[:client_options][:authorize_url] = "#{UPHOLD_URL}/authorize/#{args[0]}"
23
+ options[:client_options][:authorize_url] = "#{self.class.uphold_url}/authorize/#{args[0]}"
20
24
  end
21
25
  end
22
26
  end
@@ -0,0 +1,15 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class UpholdSandbox < ::OmniAuth::Strategies::Uphold
6
+ @uphold_url = 'https://sandbox.uphold.com'
7
+ @uphold_api_url = 'https://api-sandbox.uphold.com'
8
+
9
+ option :client_options, {
10
+ site: @uphold_api_url,
11
+ token_url: 'oauth2/token'
12
+ }
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-uphold
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Palhas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-26 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -128,6 +128,7 @@ files:
128
128
  - lib/omniauth-uphold.rb
129
129
  - lib/omniauth-uphold/version.rb
130
130
  - lib/omniauth/strategies/uphold.rb
131
+ - lib/omniauth/strategies/uphold_sandbox.rb
131
132
  - omniauth-uphold.gemspec
132
133
  - spec/omniauth/strategies/bitreserve_spec.rb
133
134
  - spec/spec_helper.rb
@@ -151,11 +152,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  version: '0'
152
153
  requirements: []
153
154
  rubyforge_project:
154
- rubygems_version: 2.4.8
155
+ rubygems_version: 2.5.1
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: OAuth2 strategy for the Uphold API, by Subvisual
158
159
  test_files:
159
160
  - spec/omniauth/strategies/bitreserve_spec.rb
160
161
  - spec/spec_helper.rb
161
- has_rdoc: