omniauth-weasyl 0.1
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.
- data/Gemfile +3 -0
- data/lib/omniauth-weasyl.rb +1 -0
- data/lib/omniauth/strategies/weasyl.rb +43 -0
- data/omniauth-weasyl.gemspec +20 -0
- metadata +82 -0
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/strategies/weasyl'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
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
|
+
}
|
14
|
+
|
15
|
+
uid { raw_info['userid'].to_s }
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
:name => raw_info['login'],
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
extra do
|
24
|
+
{ 'raw_info' => raw_info }
|
25
|
+
end
|
26
|
+
|
27
|
+
alias :oauth2_access_token :access_token
|
28
|
+
|
29
|
+
def access_token
|
30
|
+
::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
|
31
|
+
:mode => :query,
|
32
|
+
:param_name => 'oauth2_access_token',
|
33
|
+
:expires_in => oauth2_access_token.expires_in,
|
34
|
+
:expires_at => oauth2_access_token.expires_at
|
35
|
+
})
|
36
|
+
end
|
37
|
+
|
38
|
+
def raw_info
|
39
|
+
@raw_info ||= access_token.get('/api/whoami').parsed
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "omniauth-weasyl"
|
5
|
+
gem.version = "0.1"
|
6
|
+
gem.authors = ["weykent"]
|
7
|
+
gem.email = ["weykent@weasyl.com"]
|
8
|
+
gem.description = %q{A Weasyl strategy for OmniAuth.}
|
9
|
+
gem.summary = %q{A Weasyl strategy for OmniAuth.}
|
10
|
+
gem.homepage = "https://github.com/Weasyl/omniauth-weasyl"
|
11
|
+
gem.license = "ISC"
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($/)
|
14
|
+
gem.executables = []
|
15
|
+
gem.test_files = []
|
16
|
+
gem.require_paths = ['lib']
|
17
|
+
|
18
|
+
gem.add_runtime_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_runtime_dependency 'omniauth-oauth2'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-weasyl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- weykent
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: omniauth-oauth2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: A Weasyl strategy for OmniAuth.
|
47
|
+
email:
|
48
|
+
- weykent@weasyl.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- Gemfile
|
54
|
+
- lib/omniauth-weasyl.rb
|
55
|
+
- lib/omniauth/strategies/weasyl.rb
|
56
|
+
- omniauth-weasyl.gemspec
|
57
|
+
homepage: https://github.com/Weasyl/omniauth-weasyl
|
58
|
+
licenses:
|
59
|
+
- ISC
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.23
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: A Weasyl strategy for OmniAuth.
|
82
|
+
test_files: []
|