omniauth-meetup 0.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/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +9 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/lib/omniauth/strategies/meetup.rb +38 -0
- data/lib/omniauth-meetup/version.rb +5 -0
- data/lib/omniauth-meetup.rb +2 -0
- data/omniauth-meetup.gemspec +26 -0
- data/spec/omniauth/strategies/meetup_spec.rb +29 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/shared_examples.rb +36 -0
- metadata +127 -0
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# OmniAuth Meetup
|
2
|
+
|
3
|
+
`OmniAuth::Strategies::Meetup` is an OmniAuth strategy for authenticating to
|
4
|
+
meetup.com with OAuth2. Read detailed information about the meetup.com
|
5
|
+
implementation of OAuth2
|
6
|
+
[here](http://www.meetup.com/meetup_api/auth/#oauth2)
|
7
|
+
|
8
|
+
## Installing
|
9
|
+
|
10
|
+
Add to your `Gemfile`:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'omniauth-meetup'
|
14
|
+
```
|
15
|
+
|
16
|
+
Then `bundle install`.
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
To get stared you will need to register an OAuth Consumer in your
|
21
|
+
meetup.com account
|
22
|
+
[here](http://www.meetup.com/meetup_api/oauth_consumers/)
|
23
|
+
|
24
|
+
Here's a quick example, adding the middleware to a Rails app in
|
25
|
+
`config/initializers/omniauth.rb`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
+
provider :facebook, ENV['MEETUP_KEY'], ENV['MEETUP_SECRET']
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
Copyright (c) 2011 by Miles Woodroffe
|
36
|
+
|
37
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
38
|
+
copy of this software and associated documentation files (the
|
39
|
+
"Software"), to deal in the Software without restriction, including
|
40
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
41
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
42
|
+
permit persons to whom the Software is furnished to do so, subject to
|
43
|
+
the following conditions:
|
44
|
+
|
45
|
+
The above copyright notice and this permission notice shall be included
|
46
|
+
in all copies or substantial portions of the Software.
|
47
|
+
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
49
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
50
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
51
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
52
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
53
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
54
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Meetup < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "meetup"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => "https://api.meetup.com",
|
10
|
+
:authorize_url => 'https://secure.meetup.com/oauth2/authorize',
|
11
|
+
:token_url => 'https://secure.meetup.com/oauth2/access'
|
12
|
+
}
|
13
|
+
|
14
|
+
def request_phase
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
uid{ raw_info['id'] }
|
19
|
+
|
20
|
+
info do
|
21
|
+
{
|
22
|
+
:id => raw_info['id'],
|
23
|
+
:name => raw_info['name'],
|
24
|
+
:photo_url => raw_info['photo_url']
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
extra do
|
29
|
+
{ 'raw_info' => raw_info }
|
30
|
+
end
|
31
|
+
|
32
|
+
def raw_info
|
33
|
+
@raw_info ||= access_token.get("/members?member_id=self&access_token=#{access_token.token}").parsed["results"].first
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-meetup/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "omniauth-meetup"
|
7
|
+
gem.version = Omniauth::Meetup::VERSION
|
8
|
+
gem.authors = ["Miles Woodroffe"]
|
9
|
+
gem.email = ["miles@thespecials.com"]
|
10
|
+
gem.homepage = "http://github.com/tapster/omniauth-meetup"
|
11
|
+
gem.description = %q{Meetup.com authentication handler for OmniAuth}
|
12
|
+
gem.summary = gem.description
|
13
|
+
|
14
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
# specify any dependencies here; for example:
|
20
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
21
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
23
|
+
gem.add_development_dependency 'rack-test'
|
24
|
+
gem.add_development_dependency 'simplecov'
|
25
|
+
gem.add_development_dependency 'webmock'
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Meetup do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::Meetup.new(nil, @options || {})
|
6
|
+
end
|
7
|
+
|
8
|
+
it_should_behave_like 'an oauth2 strategy'
|
9
|
+
|
10
|
+
describe '#client' do
|
11
|
+
it 'should have the correct meetup site' do
|
12
|
+
subject.client.site.should eq("https://api.meetup.com")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the correct authorization url' do
|
16
|
+
subject.client.options[:authorize_url].should eq("https://secure.meetup.com/oauth2/authorize")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have the correct token url' do
|
20
|
+
subject.client.options[:token_url].should eq('https://secure.meetup.com/oauth2/access')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#callback_path' do
|
25
|
+
it 'should have the correct callback path' do
|
26
|
+
subject.callback_path.should eq('/auth/meetup/callback')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
shared_examples 'an oauth2 strategy' do
|
2
|
+
describe '#client' do
|
3
|
+
it 'should be initialized with symbolized client_options' do
|
4
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
5
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#authorize_params' do
|
10
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
11
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
12
|
+
subject.authorize_params['foo'].should eq('bar')
|
13
|
+
subject.authorize_params['baz'].should eq('zip')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
17
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
18
|
+
subject.authorize_params['scope'].should eq('bar')
|
19
|
+
subject.authorize_params['foo'].should eq('baz')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#token_params' do
|
24
|
+
it 'should include any token params passed in the :token_params option' do
|
25
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
26
|
+
subject.token_params['foo'].should eq('bar')
|
27
|
+
subject.token_params['baz'].should eq('zip')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should include top-level options that are marked as :token_options' do
|
31
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
32
|
+
subject.token_params['scope'].should eq('bar')
|
33
|
+
subject.token_params['foo'].should eq('baz')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-meetup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Miles Woodroffe
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: &70211957335100 !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: *70211957335100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: omniauth-oauth2
|
27
|
+
requirement: &70211957334460 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70211957334460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70211957333880 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.7'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70211957333880
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rack-test
|
49
|
+
requirement: &70211957333280 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70211957333280
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &70211957332580 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70211957332580
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: &70211957331900 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70211957331900
|
80
|
+
description: Meetup.com authentication handler for OmniAuth
|
81
|
+
email:
|
82
|
+
- miles@thespecials.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- Gemfile
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- lib/omniauth-meetup.rb
|
93
|
+
- lib/omniauth-meetup/version.rb
|
94
|
+
- lib/omniauth/strategies/meetup.rb
|
95
|
+
- omniauth-meetup.gemspec
|
96
|
+
- spec/omniauth/strategies/meetup_spec.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
- spec/support/shared_examples.rb
|
99
|
+
homepage: http://github.com/tapster/omniauth-meetup
|
100
|
+
licenses: []
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 1.8.10
|
120
|
+
signing_key:
|
121
|
+
specification_version: 3
|
122
|
+
summary: Meetup.com authentication handler for OmniAuth
|
123
|
+
test_files:
|
124
|
+
- spec/omniauth/strategies/meetup_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
- spec/support/shared_examples.rb
|
127
|
+
has_rdoc:
|