omniauth-bitreserve 0.0.4.pre.alpha → 0.0.5.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 939320f2c6682cdf039eeed7d0d424a2769299c9
4
- data.tar.gz: 08a382964d8c85e4c0edc6db5590749abb656dca
3
+ metadata.gz: d7f746c0c3aa6a64cd1533a26d1eb5d38ad40376
4
+ data.tar.gz: cdf386e09665457a80c866605c678a47a83eae01
5
5
  SHA512:
6
- metadata.gz: 08d91ff96cf82e40f036037b3108ef0c5bf8c2dca18c246767f993b6eaebca3d8f097ae95cb5978e5a0e98605689f909db6f94731c9d8de27281951c7f20502c
7
- data.tar.gz: 75ab7a3a164b9f35a3f14605e7b5d35b1ab51149b9e960ea6611caab6abce2e5203b484ca51b159c8801be7a5a8772a05137dabcfc9298e3d39b144a5ee7282e
6
+ metadata.gz: 7723afd446ea1664d516d3cf75c6aac999336324b85da47665026f06f3b697a6b68fd4eb14d0b0590177cb39e2ff5e70b68f1a5b350e3dc8bc8988dadadfa968
7
+ data.tar.gz: a784211dc0878179bbc8063f4059b4121dc41a2336d3339aaa2268e094e58a2187195c476e5d122fbfed8ad837ab6d36d152c56e3fb9f2eff7828dfd9a83125c
data/README.md CHANGED
@@ -28,7 +28,14 @@ end
28
28
 
29
29
  ## Sandbox API
30
30
 
31
- Bitreserve supports a sandbox environment for testing purposes. Authentication for the sandbox API is done via `https://sandbox.bitreserve.org`. To use that, you have to override the environment variable `BITRESERVE_CONNECT_URL` with the previously mentioned URL before loading the gem. We recommend [dotenv](https://github.com/bkeepers/dotenv).
31
+ Bitreserve supports a sandbox environment for testing purposes. To use it with this strategy, you'll need to use the following environment variables:
32
+
33
+ ```
34
+ BITRESERVE_URL="https://sandbox.bitreserve.org"
35
+ BITRESERVE_API_URL="https://api-sandbox.bitreserve.org"
36
+ ```
37
+
38
+ We recommend [dotenv](https://github.com/bkeepers/dotenv) for this.
32
39
 
33
40
  ## Contributing
34
41
 
@@ -1,49 +1,23 @@
1
1
  require 'omniauth-oauth2'
2
2
 
3
- class BitreserveClient < OAuth2::Client
4
- def initialize(client_id, client_secret, options = {}, &block)
5
- super
6
- @authorize_site = options.delete(:authorize_site)
7
- @token_site = options.delete(:token_site)
8
- options[:authorize_url] = [options.delete(:authorize_site), options[:authorize_url]].join('/')
9
- options[:token_url] = [options.delete(:token_site), options[:token_url] ].join('/')
10
- end
11
- end
12
-
13
3
  module OmniAuth
14
4
  module Strategies
15
5
  class Bitreserve < ::OmniAuth::Strategies::OAuth2
16
6
  include ::OmniAuth::Strategy
17
7
 
18
- URL = ENV['BITRESERVE_CONNECT_URL'] || 'https://bitreserve.org'
8
+ BITRESERVE_URL = ENV['BITRESERVE_URL'] || 'https://bitreserve.org'
9
+ BITRESERVE_API_URL = ENV['BITRESERVE_API_URL'] || 'https://api.bitreserve.org'
10
+
19
11
  option :name, :bitreserve
20
- option :client_options, site: URL
12
+ option :client_options, {
13
+ site: BITRESERVE_API_URL,
14
+ token_url: 'oauth2/token'
15
+ }
21
16
 
22
17
  def initialize(app, *args, &block)
23
18
  super
24
- options[:client_options][:authorize_url] = "/authorize/#{args[0]}"
25
- options[:client_options][:token_url] = '/oauth2/token'
19
+ options[:client_options][:authorize_url] = "#{BITRESERVE_URL}/authorize/#{args[0]}"
26
20
  end
27
-
28
- def client
29
- options[:authorize_site] = 'https://sandbox.bitreserve.org'
30
- options[:token_site] = 'https://api-sandbox.bitreserve.org'
31
- BitreserveClient.new(options.client_id, options.client_secret, deep_symbolize(options.client_options))
32
- end
33
-
34
- # uid do
35
- # raw_info['id']
36
- # end
37
-
38
- # info do
39
- # {
40
- # email: raw_info['email']
41
- # }
42
- # end
43
-
44
- # def raw_info
45
- # @raw_info ||= access_token.get('/me').parsed
46
- # end
47
21
  end
48
22
  end
49
23
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Bitreserve
3
- VERSION = '0.0.4.pre.alpha'
3
+ VERSION = '0.0.5.pre.alpha'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-bitreserve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.pre.alpha
4
+ version: 0.0.5.pre.alpha
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-05-13 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth