omniauth-meetup 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/Gemfile +1 -1
- data/README.md +8 -1
- data/Rakefile +3 -3
- data/lib/omniauth-meetup.rb +2 -2
- data/lib/omniauth-meetup/version.rb +1 -1
- data/lib/omniauth/strategies/meetup.rb +30 -14
- data/omniauth-meetup.gemspec +9 -14
- data/spec/omniauth/strategies/meetup_spec.rb +31 -31
- data/spec/spec_helper.rb +1 -1
- metadata +20 -34
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MzczYjI4ZWRhY2RmY2NlNGEwMTlkOTFlZDhiZGZkZjRkMDg2MWQ5NzM3NDAz
|
10
|
-
M2VhMzE4YWFkNjk5MmRkOWYzYjZjZDAyNzZmODBkYWQyZTVmYTEwMzJiOTVh
|
11
|
-
NzIzM2QwY2M5M2ZmZTQ5MzBkODM3ZGNhNjIzYjZiMjZkNTllZTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDY1NDM4MGE1MjkzZDJiMTUxYWVjMzY2ZTU1YWFlZDUzYjVmY2E3NmZhNzNk
|
14
|
-
Y2I1ZjliODMyOGMyOGFhNThmMDA3NTNhZGIyYTNjNzgxNTY1YWQzZDg1ZTRi
|
15
|
-
OGI3MWVlOTNmYzRiYzQ0ZTc1NWRkNmNjMWY4MmY1YTBhMzAwM2I=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c9abf71008da990179408266afa4a38e1ee484d1
|
4
|
+
data.tar.gz: 03e363e9e2a322d36ae3d3d3042c365aeddcb2a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 392ef42c2fd9aca7e2bf9eec8e6e7934bd0c7c3940e4a50c9655c3eac5f4a35bab15c5bee8ad905b73ba0b22607b005b0b0877526277286e428c8e79fdab9d63
|
7
|
+
data.tar.gz: ed6eec0f6c82522cec0ef091ded032276079df5ae5d855d0112ce26f53b09c52c55a29fd947603ba8a6c49d93c738e355afc48a72841af9f44c7f86295067a2b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ implementation of OAuth2
|
|
13
13
|
Add to your `Gemfile`:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
|
16
|
+
gem 'omniauth-meetup'
|
17
17
|
```
|
18
18
|
|
19
19
|
Then `bundle install`.
|
@@ -32,6 +32,13 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
32
32
|
provider :meetup, ENV['MEETUP_KEY'], ENV['MEETUP_SECRET']
|
33
33
|
end
|
34
34
|
```
|
35
|
+
or with Devise
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
config.omniauth :meetup, ENV['MEETUP_KEY'], ENV['MEETUP_SECRET'], callback_url: 'http://example.com/users/auth/meetup/callback'
|
39
|
+
```
|
40
|
+
**Starting from version 1.4 in omniauth-oauth2 you must provide same callback url you have provided on API dashboard otherwise authentication won't work.**
|
41
|
+
|
35
42
|
You can then implement your authentication as usual with OmniAuth as
|
36
43
|
shown in the excellent [Railscast
|
37
44
|
241](http://railscasts.com/episodes/241-simple-omniauth)
|
data/Rakefile
CHANGED
data/lib/omniauth-meetup.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'omniauth-meetup/version'
|
2
|
+
require 'omniauth/strategies/meetup'
|
@@ -2,30 +2,30 @@ require 'omniauth-oauth2'
|
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
|
+
# Meetup omniauth-oauth2 strategy
|
5
6
|
class Meetup < OmniAuth::Strategies::OAuth2
|
6
|
-
option :name,
|
7
|
+
option :name, 'meetup'
|
7
8
|
|
8
|
-
option :client_options,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
9
|
+
option :client_options,
|
10
|
+
site: 'https://api.meetup.com',
|
11
|
+
authorize_url: 'https://secure.meetup.com/oauth2/authorize',
|
12
|
+
token_url: 'https://secure.meetup.com/oauth2/access'
|
13
13
|
|
14
14
|
def request_phase
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
|
-
uid{ raw_info['id'] }
|
18
|
+
uid { raw_info['id'] }
|
19
19
|
|
20
20
|
info do
|
21
21
|
{
|
22
|
-
:
|
23
|
-
:
|
24
|
-
|
25
|
-
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
22
|
+
id: raw_info['id'],
|
23
|
+
name: raw_info['name'],
|
24
|
+
photo_url: meetup_photo_url,
|
25
|
+
image: meetup_photo_url,
|
26
|
+
urls: { public_profile: raw_info['link'] },
|
27
|
+
description: raw_info['bio'],
|
28
|
+
location: meetup_location
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
@@ -33,10 +33,26 @@ module OmniAuth
|
|
33
33
|
{ 'raw_info' => raw_info }
|
34
34
|
end
|
35
35
|
|
36
|
+
def callback_url
|
37
|
+
# Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
38
|
+
options[:callback_url] || (full_host + script_name + callback_path)
|
39
|
+
end
|
40
|
+
|
36
41
|
def raw_info
|
37
42
|
@raw_info ||= JSON.parse(access_token.get('/2/member/self').body)
|
38
43
|
end
|
39
44
|
|
45
|
+
private
|
46
|
+
|
47
|
+
def meetup_location
|
48
|
+
[raw_info['city'], raw_info['state'], raw_info['country']].reject do |v|
|
49
|
+
!v || v.empty?
|
50
|
+
end.join(', ')
|
51
|
+
end
|
52
|
+
|
53
|
+
def meetup_photo_url
|
54
|
+
raw_info.key?('photo') ? raw_info['photo']['photo_link'] : nil
|
55
|
+
end
|
40
56
|
end
|
41
57
|
end
|
42
58
|
end
|
data/omniauth-meetup.gemspec
CHANGED
@@ -1,26 +1,21 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "omniauth-meetup/version"
|
4
|
-
|
5
2
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name =
|
7
|
-
gem.version =
|
8
|
-
gem.authors = [
|
9
|
-
gem.email = [
|
10
|
-
gem.homepage =
|
11
|
-
gem.description =
|
3
|
+
gem.name = 'omniauth-meetup'
|
4
|
+
gem.version = '0.0.8'
|
5
|
+
gem.authors = ['Miles Woodroffe']
|
6
|
+
gem.email = ['miles@thespecials.com']
|
7
|
+
gem.homepage = 'http://github.com/tapster/omniauth-meetup'
|
8
|
+
gem.description = 'Meetup.com authentication handler for OmniAuth'
|
12
9
|
gem.summary = gem.description
|
13
10
|
|
14
|
-
gem.
|
15
|
-
gem.files
|
16
|
-
gem.test_files
|
17
|
-
gem.require_paths = ["lib"]
|
11
|
+
gem.require_paths = ['lib']
|
12
|
+
gem.files = ['.gitignore', '.rspec', '.travis.yml', 'Gemfile', 'README.md', 'Rakefile', 'lib/omniauth-meetup.rb', 'lib/omniauth-meetup/version.rb', 'lib/omniauth/strategies/meetup.rb', 'omniauth-meetup.gemspec']
|
13
|
+
gem.test_files = ['./spec/omniauth/strategies/meetup_spec.rb', 'spec/spec_helper.rb']
|
18
14
|
|
19
15
|
# specify any dependencies here; for example:
|
20
16
|
gem.add_dependency 'omniauth', '~> 1.0'
|
21
17
|
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
22
18
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
23
19
|
gem.add_development_dependency 'rack-test'
|
24
|
-
gem.add_development_dependency 'simplecov'
|
25
20
|
gem.add_development_dependency 'webmock'
|
26
21
|
end
|
@@ -6,69 +6,69 @@ describe OmniAuth::Strategies::Meetup do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '#client' do
|
9
|
-
it '
|
10
|
-
subject.client.site.
|
9
|
+
it 'has a correct api url' do
|
10
|
+
expect(subject.client.site).to eq('https://api.meetup.com')
|
11
11
|
end
|
12
12
|
|
13
|
-
it '
|
14
|
-
subject.client.options[:authorize_url].
|
13
|
+
it 'has a correct api authorization url' do
|
14
|
+
expect(subject.client.options[:authorize_url]).to eq('https://secure.meetup.com/oauth2/authorize')
|
15
15
|
end
|
16
16
|
|
17
|
-
it '
|
18
|
-
subject.client.options[:token_url].
|
17
|
+
it 'has a correct api token auth url' do
|
18
|
+
expect(subject.client.options[:token_url]).to eq('https://secure.meetup.com/oauth2/access')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#callback_path' do
|
23
|
-
it '
|
24
|
-
subject.callback_path.
|
23
|
+
it 'has a correct callback path' do
|
24
|
+
expect(subject.callback_path).to eq('/auth/meetup/callback')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#uid' do
|
29
29
|
it 'returns the uid from raw_info' do
|
30
|
-
subject.
|
31
|
-
subject.uid.
|
30
|
+
allow(subject).to receive(:raw_info).and_return('id' => '999')
|
31
|
+
expect(subject.uid).to eq('999')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#info' do
|
36
36
|
it 'returns the name from raw_info' do
|
37
|
-
subject.
|
38
|
-
subject.info[:name].
|
37
|
+
allow(subject).to receive(:raw_info).and_return('name' => 'Bert')
|
38
|
+
expect(subject.info[:name]).to eq('Bert')
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'returns the photo_url from raw_info if available' do
|
42
|
-
subject.
|
43
|
-
subject.info[:photo_url].
|
44
|
-
subject.
|
45
|
-
subject.info[:photo_url].
|
42
|
+
allow(subject).to receive(:raw_info).and_return('photo' => { 'photo_link' => 'http://meetup.com/bert.jpg' })
|
43
|
+
expect(subject.info[:photo_url]).to eq('http://meetup.com/bert.jpg')
|
44
|
+
allow(subject).to receive(:raw_info).and_return({})
|
45
|
+
expect(subject.info[:photo_url]).to eq(nil)
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'returns the image from raw_info if available' do
|
49
|
-
subject.
|
50
|
-
subject.info[:image].
|
51
|
-
subject.
|
52
|
-
subject.info[:image].
|
49
|
+
allow(subject).to receive(:raw_info).and_return('photo' => { 'photo_link' => 'http://meetup.com/bert.jpg' })
|
50
|
+
expect(subject.info[:image]).to eq('http://meetup.com/bert.jpg')
|
51
|
+
allow(subject).to receive(:raw_info).and_return({})
|
52
|
+
expect(subject.info[:image]).to eq(nil)
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
it 'returns the public_profile url' do
|
56
|
-
subject.
|
57
|
-
subject.info[:urls][:public_profile].
|
56
|
+
allow(subject).to receive(:raw_info).and_return('link' => 'http://meetup.com/bert')
|
57
|
+
expect(subject.info[:urls][:public_profile]).to eq('http://meetup.com/bert')
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'returns the description from raw_info' do
|
61
|
-
subject.
|
62
|
-
subject.info[:description].
|
61
|
+
allow(subject).to receive(:raw_info).and_return('bio' => 'My name is Bert.')
|
62
|
+
expect(subject.info[:description]).to eq('My name is Bert.')
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'returns the location from raw_info' do
|
66
|
-
subject.
|
67
|
-
subject.info[:location].
|
68
|
-
subject.
|
69
|
-
subject.info[:location].
|
70
|
-
subject.
|
71
|
-
subject.info[:location].
|
66
|
+
allow(subject).to receive(:raw_info).and_return('city' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA')
|
67
|
+
expect(subject.info[:location]).to eq('Los Angeles, CA, USA')
|
68
|
+
allow(subject).to receive(:raw_info).and_return('city' => 'Tokyo', 'country' => 'Japan')
|
69
|
+
expect(subject.info[:location]).to eq('Tokyo, Japan')
|
70
|
+
allow(subject).to receive(:raw_info).and_return({})
|
71
|
+
expect(subject.info[:location]).to eq('')
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-meetup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Woodroffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: omniauth-oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ! '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ! '>='
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: webmock
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
description: Meetup.com authentication handler for OmniAuth
|
@@ -101,9 +87,10 @@ executables: []
|
|
101
87
|
extensions: []
|
102
88
|
extra_rdoc_files: []
|
103
89
|
files:
|
104
|
-
- .
|
105
|
-
- .
|
106
|
-
- .
|
90
|
+
- "./spec/omniauth/strategies/meetup_spec.rb"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
107
94
|
- Gemfile
|
108
95
|
- README.md
|
109
96
|
- Rakefile
|
@@ -111,7 +98,6 @@ files:
|
|
111
98
|
- lib/omniauth-meetup/version.rb
|
112
99
|
- lib/omniauth/strategies/meetup.rb
|
113
100
|
- omniauth-meetup.gemspec
|
114
|
-
- spec/omniauth/strategies/meetup_spec.rb
|
115
101
|
- spec/spec_helper.rb
|
116
102
|
homepage: http://github.com/tapster/omniauth-meetup
|
117
103
|
licenses: []
|
@@ -122,20 +108,20 @@ require_paths:
|
|
122
108
|
- lib
|
123
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
110
|
requirements:
|
125
|
-
- -
|
111
|
+
- - ">="
|
126
112
|
- !ruby/object:Gem::Version
|
127
113
|
version: '0'
|
128
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
115
|
requirements:
|
130
|
-
- -
|
116
|
+
- - ">="
|
131
117
|
- !ruby/object:Gem::Version
|
132
118
|
version: '0'
|
133
119
|
requirements: []
|
134
120
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.5.1
|
136
122
|
signing_key:
|
137
123
|
specification_version: 4
|
138
124
|
summary: Meetup.com authentication handler for OmniAuth
|
139
125
|
test_files:
|
140
|
-
- spec/omniauth/strategies/meetup_spec.rb
|
126
|
+
- "./spec/omniauth/strategies/meetup_spec.rb"
|
141
127
|
- spec/spec_helper.rb
|