omniauth-bitreserve 0.0.3.pre.alpha → 0.0.4.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/strategies/bitreserve.rb +27 -10
- data/lib/omniauth-bitreserve/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939320f2c6682cdf039eeed7d0d424a2769299c9
|
4
|
+
data.tar.gz: 08a382964d8c85e4c0edc6db5590749abb656dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
18
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
end
|
34
|
+
# uid do
|
35
|
+
# raw_info['id']
|
36
|
+
# end
|
26
37
|
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|