omniauth-qq-oauth2 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43519bc04dd254638567691ba9e6626d78218f36
4
- data.tar.gz: 4ba0493978c7ccf0ae891cbc5d8cce73916a5d95
3
+ metadata.gz: aa2fa442c74de06d91f9e47a3dea8011c1ea53b5
4
+ data.tar.gz: aee9470f651af7284a7c47939a1a3210d8234590
5
5
  SHA512:
6
- metadata.gz: 8af2c78b5bdac91a4673f94434412977ca3c8128c9a1bdc49b26b8c3b31b772b83adeaf1a9d17b322671ca4a047db1f63605bbd1bf6112fbd280d7a9556ad240
7
- data.tar.gz: 800f6143a39586e19fbb496b7d3183939f38275bd8e0aa5e38bee6d669d034d27715a4bc015a309c1015ee024eb7ce9e02f1315d1480bb6e1598222370a041dd
6
+ metadata.gz: b2aac2fbe4f4572ff873f63ffd7104d685aeca3e222708b340f6d9f1bfb025385d593d98d42ef57fc42d8ba7033d8c7bfda625bb80b4f82f10782aef67f51048
7
+ data.tar.gz: 8525da38b558ba113afa97e9f70a1feaf5d6b2c9d3a63081b452c8ebbd809d33aa5ac99ee2bb560facb7bb94c1a0fcadbdeef6d149e3f0f56b3556444ceae434
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ # Specify your gem's dependencies in omniauth-qq-oauth2.gemspec
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 roger
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Omniauth::Qq::Oauth2
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'omniauth-qq-oauth2'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install omniauth-qq-oauth2
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "omniauth-qq-oauth2/version"
2
+ require 'omniauth/strategies/qq'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Qq
3
+ VERSION = "0.4.0"
4
+ end
5
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+ require 'omniauth/strategies/oauth2'
3
+ module Omniauth
4
+ module Strategies
5
+ class QQ < OmniAuth::Strategies::OAuth2
6
+ option :name, "qq"
7
+ option :client_options, {
8
+ :site => 'https://graph.qq.com/oauth2.0/',
9
+ :authorize_url => '/oauth2.0/authorize',
10
+ :token_url => "/oauth2.0/token"
11
+ }
12
+ option :token_params, {
13
+ :state => 'foobar',
14
+ :parse => :query
15
+ }
16
+ uid do
17
+ @uid ||= begin
18
+ access_token.options[:mode] = :query
19
+ access_token.options[:param_name] = :access_token
20
+ response = access_token.get('/oauth2.0/me')
21
+ matched = response.body.match(/"openid":"(?<openid>\w+)"/)
22
+ matched[:openid]
23
+ end
24
+ end
25
+ info do
26
+ {
27
+ :nickname => raw_info['nickname'],
28
+ :name => raw_info['nickname'],
29
+ :image => raw_info['figureurl_1'],
30
+ }
31
+ end
32
+ extra do
33
+ {
34
+ :raw_info => raw_info
35
+ }
36
+ end
37
+
38
+ def raw_info
39
+ @raw_info ||= begin
40
+ client.request(:get, "https://graph.qq.com/user/get_user_info", :params => {
41
+ :format => :json,
42
+ :openid => uid,
43
+ :oauth_consumer_key => options[:client_id],
44
+ :access_token => access_token.token
45
+ }, :parse => :json).parsed
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ OmniAuth.config.add_camelization('qq', 'QQ')
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/omniauth-qq-oauth2/version', __FILE__)
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "omniauth-qq-oauth2"
5
+ spec.version = Omniauth::Qq::VERSION
6
+ spec.authors = ["Cireate"]
7
+ spec.email = ["jacky8ts@gmail.com"]
8
+ spec.description = %q{OmniAuth for QQ}
9
+ spec.summary = %q{OmniAuth for QQ}
10
+ spec.homepage = "https://github.com/yeetim/omniauth-qq-oauth2"
11
+
12
+ spec.files = `git ls-files`.split("\n")
13
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_development_dependency 'omniauth', '~> 1.0'
18
+ spec.add_development_dependency 'omniauth-oauth', '~> 1.0'
19
+ spec.add_development_dependency 'omniauth-oauth2', '~> 1.0'
20
+ spec.add_development_dependency 'multi_json'
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-qq-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cireate
@@ -72,7 +72,16 @@ email:
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
- files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/omniauth-qq-oauth2.rb
82
+ - lib/omniauth-qq-oauth2/version.rb
83
+ - lib/omniauth/strategies/qq.rb
84
+ - omniauth-qq-oauth2.gemspec
76
85
  homepage: https://github.com/yeetim/omniauth-qq-oauth2
77
86
  licenses: []
78
87
  metadata: {}