omniauth-proz 0.1.8 → 0.1.9

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: 5c7022232406544bf10aa0ecd13e6d8ba723fb5d
4
- data.tar.gz: f958e8d37e926b5821886352b5885c4be6c55e63
3
+ metadata.gz: 519e81141220c530c71ea5542c0ce01aa0e6d68a
4
+ data.tar.gz: ce1f29c10305691147b762660ba12fbe76c3fedc
5
5
  SHA512:
6
- metadata.gz: 8bae2659d0f8cb717a228e7c8a87dbd5735412e95b00d75c6f8c20114ae242fbca14bea98cfe8db402ae1f4451ba6ca313251e17205e6a3b53500d01ed7f0575
7
- data.tar.gz: 9e9952667d2da98cb9dd83bc1d69cbf27a1cb7c481677ae44c3cf66c305ad09aaee0e615b434447ea7e6cebdc3dc15e42e79c902b5b8fba67054861992916dea
6
+ metadata.gz: 7f0bfd77fdb98362dea43a1b96f9533212e8475949e9092659eef27423f681d6fae2dbb9fb8d4e72c8dd7212d4cce8038cab8b2d5e803259f228214e96fa5548
7
+ data.tar.gz: d7c4c50c917d9c4508158d4ac1f5dca17e8fe4ddbbc50db5f24aa85e1ea5f5241024d620519c9fda4536ae61f7fb7b70885522d26af185406caaf0611a1e7e1d
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Proz
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
@@ -4,6 +4,8 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Proz < OmniAuth::Strategies::OAuth2
6
6
 
7
+ DEFAULT_SCOPE = 'user.email'
8
+
7
9
  option :name, :proz
8
10
 
9
11
  option :client_options, {
@@ -12,6 +14,8 @@ module OmniAuth
12
14
  :token_url => '/oauth/token'
13
15
  }
14
16
 
17
+ option :authorize_options, [:scope]
18
+
15
19
  uid { raw_info['uuid'] }
16
20
 
17
21
  info do
@@ -23,18 +27,30 @@ module OmniAuth
23
27
  end
24
28
 
25
29
  def raw_info
26
- puts "Get Raw Info"
27
30
  @raw_info ||= access_token.get('https://api.proz.com/v2/user').parsed
28
31
  end
29
32
 
33
+ def authorize_params
34
+ super.tap do |params|
35
+ %w[scope].each do |v|
36
+ if request.params[v]
37
+ params[v.to_sym] = request.params[v]
38
+ end
39
+ end
40
+
41
+ params[:scope] ||= DEFAULT_SCOPE
42
+ end
43
+ end
44
+
30
45
  protected
46
+
31
47
  def build_access_token
32
48
  params = {
33
49
  'client_id' => client.id,
34
50
  'client_secret' => client.secret,
35
51
  'code' => request.params['code'],
36
52
  'grant_type' => 'authorization_code',
37
- 'redirect_uri' => 'http://localhost:3000/translators/auth/proz/callback'
53
+ 'redirect_uri' => options[:callback_url]
38
54
  }.merge(token_params.to_hash(symbolize_keys: true))
39
55
  client.get_token(params, deep_symbolize(options.auth_token_params))
40
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-proz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias