omniauth-bitreserve 0.0.4.pre.alpha → 0.0.5.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 +4 -4
- data/README.md +8 -1
- data/lib/omniauth/strategies/bitreserve.rb +8 -34
- data/lib/omniauth-bitreserve/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7f746c0c3aa6a64cd1533a26d1eb5d38ad40376
|
|
4
|
+
data.tar.gz: cdf386e09665457a80c866605c678a47a83eae01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
|
|
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,
|
|
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
|
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
|
+
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-
|
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omniauth
|