omniauth-tianji 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README +0 -0
- data/Rakefile +1 -0
- data/lib/omniauth-tianji.rb +2 -0
- data/lib/omniauth-tianji/version.rb +5 -0
- data/lib/omniauth/strategies/tianji.rb +41 -0
- data/omniauth-tianji.gemspec +27 -0
- metadata +112 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
module OmniAuth
|
3
|
+
module Strategies
|
4
|
+
class Tianji < OmniAuth::Strategies::OAuth2
|
5
|
+
option :client_options, {
|
6
|
+
:site => 'https://login.tianji.com/',
|
7
|
+
:authorize_url => '/authz/oauth/authorize',
|
8
|
+
:token_url => '/authz/oauth/token'
|
9
|
+
}
|
10
|
+
def request_phase
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
uid { raw_info['id'] }
|
15
|
+
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
"uid" => raw_info["id"],
|
20
|
+
"gender"=> raw_info['gender'],
|
21
|
+
'contact_count' => raw_info['contact_count'],
|
22
|
+
'location' => raw_info['location'],
|
23
|
+
'language' => raw_info['language'],
|
24
|
+
"image"=>raw_info['picture_large'],
|
25
|
+
'name' => raw_info['name'],
|
26
|
+
'title' => raw_info['headline'],
|
27
|
+
'urls' => {
|
28
|
+
'Tianji' => raw_info['link']
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def raw_info
|
34
|
+
@raw_info ||= MultiJson.decode(access_token.get("https://api.tianji.com/me?access_token=#{@access_token.token}").body)
|
35
|
+
@raw_info
|
36
|
+
rescue ::Errno::ETIMEDOUT
|
37
|
+
raise ::Timeout::Error
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-tianji/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-tianji"
|
7
|
+
s.version = Omniauth::Tianji::VERSION
|
8
|
+
s.authors = ["Scott Ballantyne"]
|
9
|
+
s.email = ["ussballantyne@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{an omniauth strategy for tianji}
|
12
|
+
s.description = %q{an omniauth strategy for tianji}
|
13
|
+
|
14
|
+
s.rubyforge_project = "omniauth-tianji"
|
15
|
+
s.add_dependency 'omniauth', '~> 1.0.0.rc2'
|
16
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.0.0.rc2'
|
17
|
+
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
# specify any dependencies here; for example:
|
25
|
+
# s.add_development_dependency "rspec"
|
26
|
+
# s.add_runtime_dependency "rest-client"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-tianji
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: -1038621796
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 2
|
12
|
+
version: 1.0.0.rc2
|
13
|
+
platform: ruby
|
14
|
+
authors:
|
15
|
+
- Scott Ballantyne
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2011-10-30 00:00:00 Z
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: omniauth
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: -1038621796
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
- rc
|
36
|
+
- 2
|
37
|
+
version: 1.0.0.rc2
|
38
|
+
type: :runtime
|
39
|
+
version_requirements: *id001
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: omniauth-oauth2
|
42
|
+
prerelease: false
|
43
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: -1038621796
|
49
|
+
segments:
|
50
|
+
- 1
|
51
|
+
- 0
|
52
|
+
- 0
|
53
|
+
- rc
|
54
|
+
- 2
|
55
|
+
version: 1.0.0.rc2
|
56
|
+
type: :runtime
|
57
|
+
version_requirements: *id002
|
58
|
+
description: an omniauth strategy for tianji
|
59
|
+
email:
|
60
|
+
- ussballantyne@gmail.com
|
61
|
+
executables: []
|
62
|
+
|
63
|
+
extensions: []
|
64
|
+
|
65
|
+
extra_rdoc_files: []
|
66
|
+
|
67
|
+
files:
|
68
|
+
- .gitignore
|
69
|
+
- Gemfile
|
70
|
+
- README
|
71
|
+
- Rakefile
|
72
|
+
- lib/omniauth-tianji.rb
|
73
|
+
- lib/omniauth-tianji/version.rb
|
74
|
+
- lib/omniauth/strategies/tianji.rb
|
75
|
+
- omniauth-tianji.gemspec
|
76
|
+
homepage: ""
|
77
|
+
licenses: []
|
78
|
+
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 25
|
99
|
+
segments:
|
100
|
+
- 1
|
101
|
+
- 3
|
102
|
+
- 1
|
103
|
+
version: 1.3.1
|
104
|
+
requirements: []
|
105
|
+
|
106
|
+
rubyforge_project: omniauth-tianji
|
107
|
+
rubygems_version: 1.8.11
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: an omniauth strategy for tianji
|
111
|
+
test_files: []
|
112
|
+
|