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

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: f4f5ed8bec996240589bdb7339784c64ab2553f5
4
- data.tar.gz: 6f46823547025de99af8e789d4eaeb6650b5f358
3
+ metadata.gz: 939320f2c6682cdf039eeed7d0d424a2769299c9
4
+ data.tar.gz: 08a382964d8c85e4c0edc6db5590749abb656dca
5
5
  SHA512:
6
- metadata.gz: 0939e5e3fe4ac3ae68d3ba27ae379253f8289de285abf048e92c5db048bd46bc06736d31bc1745e31236161375fd053ecd2058494b9d1d00c28b5774f03c6443
7
- data.tar.gz: 3e1324d5f5abbb4696272a5a712a60817b2bfcb895b0c9b29165ee638412606c74bcb7604f77b613abffc8ae1283288093d0cc9c1b216ee9a49e16a3832baf4d
6
+ metadata.gz: 08d91ff96cf82e40f036037b3108ef0c5bf8c2dca18c246767f993b6eaebca3d8f097ae95cb5978e5a0e98605689f909db6f94731c9d8de27281951c7f20502c
7
+ data.tar.gz: 75ab7a3a164b9f35a3f14605e7b5d35b1ab51149b9e960ea6611caab6abce2e5203b484ca51b159c8801be7a5a8772a05137dabcfc9298e3d39b144a5ee7282e
@@ -1,5 +1,15 @@
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
+
3
13
  module OmniAuth
4
14
  module Strategies
5
15
  class Bitreserve < ::OmniAuth::Strategies::OAuth2
@@ -12,21 +22,28 @@ module OmniAuth
12
22
  def initialize(app, *args, &block)
13
23
  super
14
24
  options[:client_options][:authorize_url] = "/authorize/#{args[0]}"
25
+ options[:client_options][:token_url] = '/oauth2/token'
15
26
  end
16
27
 
17
- uid do
18
- raw_info['id']
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))
19
32
  end
20
33
 
21
- info do
22
- {
23
- email: raw_info['email']
24
- }
25
- end
34
+ # uid do
35
+ # raw_info['id']
36
+ # end
26
37
 
27
- def raw_info
28
- @raw_info ||= access_token.get('/me').parsed
29
- end
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
30
47
  end
31
48
  end
32
49
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Bitreserve
3
- VERSION = '0.0.3-alpha'
3
+ VERSION = '0.0.4.pre.alpha'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-bitreserve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.pre.alpha
4
+ version: 0.0.4.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Palhas