omniauth-weasyl 0.1 → 0.2

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.
@@ -4,13 +4,17 @@ require 'omniauth-oauth2'
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class Weasyl < OmniAuth::Strategies::OAuth2
7
- option :name, 'weasyl'
8
-
9
- option :client_options, {
10
- :site => 'https://www.weasyl.com',
11
- :authorize_url => 'https://www.weasyl.com/api/oauth2/authorize',
12
- :token_url => 'https://www.weasyl.com/api/oauth2/token',
13
- }
7
+ def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
8
+ site = options[:site] || 'https://www.weasyl.com'
9
+ opts = {
10
+ :client_options => {
11
+ :site => site,
12
+ :authorize_url => site + '/api/oauth2/authorize',
13
+ :token_url => site + '/api/oauth2/token',
14
+ },
15
+ }
16
+ super(app, consumer_key, consumer_secret, opts, &block)
17
+ end
14
18
 
15
19
  uid { raw_info['userid'].to_s }
16
20
 
@@ -28,15 +32,15 @@ module OmniAuth
28
32
 
29
33
  def access_token
30
34
  ::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
31
- :mode => :query,
35
+ :mode => :header,
32
36
  :param_name => 'oauth2_access_token',
33
37
  :expires_in => oauth2_access_token.expires_in,
34
- :expires_at => oauth2_access_token.expires_at
38
+ :expires_at => oauth2_access_token.expires_at,
35
39
  })
36
40
  end
37
41
 
38
42
  def raw_info
39
- @raw_info ||= access_token.get('/api/whoami').parsed
43
+ MultiJson.load access_token.get('/api/whoami').body
40
44
  end
41
45
  end
42
46
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "omniauth-weasyl"
5
- gem.version = "0.1"
5
+ gem.version = "0.2"
6
6
  gem.authors = ["weykent"]
7
7
  gem.email = ["weykent@weasyl.com"]
8
8
  gem.description = %q{A Weasyl strategy for OmniAuth.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-weasyl
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: