omniauth-opinionage 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Opinionage
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -6,20 +6,26 @@ module OmniAuth
6
6
 
7
7
  class Opinionage < OmniAuth::Strategies::OAuth2
8
8
 
9
- OAUTH_BASE_URL = "https://www.opinionage.com"
10
- SERVICES_BASE_URL = "https://opinionage.com/api"
9
+ def initialize(*args)
10
+ super
11
11
 
12
- option :client_options, { :site => OAUTH_BASE_URL,
13
- :authorize_url => "/auth/authorize",
14
- :token_url => "/auth/token",
15
- :url => "https://opinionage.com", :ssl => { :verify => false } }
12
+ @OAUTH_BASE_URL = ENV['OAUTH_BASE_URL'] || "https://www.opinionage.com"
13
+ @SERVICES_BASE_URL = ENV['SERVICES_BASE_URL'] || "https://opinionage.com/api"
16
14
 
17
- option :mode, :query
18
- option :param_name, 'access_token'
15
+ puts "OmniAuth::Opinionage OAUTH_BASE_URL=#{@OAUTH_BASE_URL} - SERVICES_BASE_URL=#{@SERVICES_BASE_URL}"
16
+ @options[:client_options] = { :site => @OAUTH_BASE_URL,
17
+ :authorize_url => "/auth/authorize",
18
+ :token_url => "/auth/token",
19
+ :url => @OAUTH_BASE_URL, :ssl => { :verify => false } }
19
20
 
20
- option :token_params, {
21
- :parse => :json
22
- }
21
+ @options[:mode] = :query
22
+ @options[:param_name] = 'access_token'
23
+
24
+ @options[:token_params] = {
25
+ :parse => :json
26
+ }
27
+
28
+ end
23
29
 
24
30
  uid { raw_info['user']['graph_id'] }
25
31
 
@@ -35,7 +41,7 @@ module OmniAuth
35
41
  end
36
42
 
37
43
  def raw_info
38
- @raw_info ||= access_token.get(SERVICES_BASE_URL + "/1/users/me").parsed || { }
44
+ @raw_info ||= access_token.get(@SERVICES_BASE_URL + "/1/users/me").parsed || { }
39
45
  end
40
46
 
41
47
  def build_access_token
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: omniauth-opinionage
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Carlo Alberto Degli Atti
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-08 00:00:00 Z
13
+ date: 2012-10-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: omniauth-oauth2