omniauth-xing 0.1.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.
- data/Gemfile +9 -0
- data/LICENSE.txt +20 -0
- data/README.md +43 -0
- data/Rakefile +38 -0
- data/lib/omniauth-xing.rb +1 -0
- data/lib/omniauth-xing/version.rb +5 -0
- data/lib/omniauth/strategies/xing.rb +40 -0
- data/test/helper.rb +17 -0
- data/test/test_omniauth-xing.rb +16 -0
- metadata +165 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Dennis Schoen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# OmniAuth GitHub
|
2
|
+
|
3
|
+
This gem contains the XING strategy for OmniAuth.
|
4
|
+
|
5
|
+
## How To Use It
|
6
|
+
|
7
|
+
Usage is as per any other OmniAuth 1.0 strategy. So let's say you're using Rails, you need to add the strategy to your `Gemfile` along side omniauth:
|
8
|
+
|
9
|
+
gem 'omniauth'
|
10
|
+
gem 'omniauth-xing'
|
11
|
+
|
12
|
+
Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
|
13
|
+
|
14
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
15
|
+
provider :xing, "consumer_key", "consumer_secret"
|
16
|
+
end
|
17
|
+
|
18
|
+
You will obviously have to put in your key and secret, which you get when you register your app with XING.
|
19
|
+
|
20
|
+
## License
|
21
|
+
|
22
|
+
(The MIT License)
|
23
|
+
|
24
|
+
Copyright (c) 2011 Dennis Schoen <dennis@blogma.de>
|
25
|
+
|
26
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
27
|
+
a copy of this software and associated documentation files (the
|
28
|
+
'Software'), to deal in the Software without restriction, including
|
29
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
30
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
31
|
+
permit persons to whom the Software is furnished to do so, subject to
|
32
|
+
the following conditions:
|
33
|
+
|
34
|
+
The above copyright notice and this permission notice shall be
|
35
|
+
included in all copies or substantial portions of the Software.
|
36
|
+
|
37
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
38
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
39
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
40
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
41
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
42
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
43
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
require './lib/omniauth-xing/version.rb'
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
gem.name = "omniauth-xing"
|
18
|
+
gem.homepage = "http://github.com/roccoblues/omniauth-xing"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{XING strategy for OmniAuth.}
|
21
|
+
gem.description = %Q{XING strategy for OmniAuth.}
|
22
|
+
gem.email = "dennis@blogma.de"
|
23
|
+
gem.authors = ["Dennis Schoen"]
|
24
|
+
gem.version = Omniauth::Xing::VERSION
|
25
|
+
gem.add_dependency 'omniauth-oauth', '~> 1.0.0'
|
26
|
+
gem.add_dependency 'multi_json'
|
27
|
+
gem.files.exclude 'Gemfile.lock', 'omniauth-xing.gemspec'
|
28
|
+
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
|
+
|
31
|
+
require 'rake/testtask'
|
32
|
+
Rake::TestTask.new(:test) do |test|
|
33
|
+
test.libs << 'lib' << 'test'
|
34
|
+
test.pattern = 'test/**/test_*.rb'
|
35
|
+
test.verbose = true
|
36
|
+
end
|
37
|
+
|
38
|
+
task :default => :test
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/strategies/xing'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'omniauth/strategies/oauth'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Xing < OmniAuth::Strategies::OAuth
|
6
|
+
|
7
|
+
args [:consumer_key, :consumer_secret]
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:access_token_path => '/v1/access_token',
|
11
|
+
:authorize_path => '/v1/authorize',
|
12
|
+
:request_token_path => '/v1/request_token/',
|
13
|
+
:site => 'https://api.xing.com'
|
14
|
+
}
|
15
|
+
|
16
|
+
info do
|
17
|
+
{
|
18
|
+
:first_name => raw_info["first_name"],
|
19
|
+
:last_name => raw_info["last_name"],
|
20
|
+
:email => raw_info["active_email"],
|
21
|
+
:birth_date => raw_info["birth_date"],
|
22
|
+
:company_name => raw_info["company_name"],
|
23
|
+
:image => raw_info["photo_urls"]["large"],
|
24
|
+
:url => "http://www.xing.com/profile/#{raw_info["page_name"]}",
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
uid { access_token.params[:user_id] }
|
29
|
+
|
30
|
+
extra do
|
31
|
+
{ 'raw_info' => raw_info }
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
@raw_info ||= MultiJson.decode( access_token.get('/v1/users/me').body )["users"].first
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
+
require 'omniauth-xing'
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestOmniauthXing < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@strategy = OmniAuth::Strategies::Xing.new(nil, {})
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_client_options
|
10
|
+
assert_equal @strategy.options.client_options.site, 'https://api.xing.com'
|
11
|
+
assert_equal @strategy.options.client_options.access_token_path, '/v1/access_token'
|
12
|
+
assert_equal @strategy.options.client_options.authorize_path, '/v1/authorize'
|
13
|
+
assert_equal @strategy.options.client_options.request_token_path, '/v1/request_token/'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-xing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Dennis Schoen
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-13 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
type: :runtime
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
version_requirements: *id001
|
32
|
+
name: multi_json
|
33
|
+
prerelease: false
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 23
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 0
|
45
|
+
- 0
|
46
|
+
version: 1.0.0
|
47
|
+
version_requirements: *id002
|
48
|
+
name: omniauth-oauth
|
49
|
+
prerelease: false
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
type: :development
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 23
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 0
|
61
|
+
- 0
|
62
|
+
version: 1.0.0
|
63
|
+
version_requirements: *id003
|
64
|
+
name: bundler
|
65
|
+
prerelease: false
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
type: :development
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 7
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
- 6
|
77
|
+
- 4
|
78
|
+
version: 1.6.4
|
79
|
+
version_requirements: *id004
|
80
|
+
name: jeweler
|
81
|
+
prerelease: false
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
type: :runtime
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 23
|
90
|
+
segments:
|
91
|
+
- 1
|
92
|
+
- 0
|
93
|
+
- 0
|
94
|
+
version: 1.0.0
|
95
|
+
version_requirements: *id005
|
96
|
+
name: omniauth-oauth
|
97
|
+
prerelease: false
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :runtime
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
version_requirements: *id006
|
110
|
+
name: multi_json
|
111
|
+
prerelease: false
|
112
|
+
description: XING strategy for OmniAuth.
|
113
|
+
email: dennis@blogma.de
|
114
|
+
executables: []
|
115
|
+
|
116
|
+
extensions: []
|
117
|
+
|
118
|
+
extra_rdoc_files:
|
119
|
+
- LICENSE.txt
|
120
|
+
- README.md
|
121
|
+
files:
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- lib/omniauth-xing.rb
|
127
|
+
- lib/omniauth-xing/version.rb
|
128
|
+
- lib/omniauth/strategies/xing.rb
|
129
|
+
- test/helper.rb
|
130
|
+
- test/test_omniauth-xing.rb
|
131
|
+
homepage: http://github.com/roccoblues/omniauth-xing
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
156
|
+
version: "0"
|
157
|
+
requirements: []
|
158
|
+
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 1.8.12
|
161
|
+
signing_key:
|
162
|
+
specification_version: 3
|
163
|
+
summary: XING strategy for OmniAuth.
|
164
|
+
test_files: []
|
165
|
+
|