omniauth-eventbrite 0.0.5 → 0.0.6
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 +7 -0
- data/CHANGELOG.md +58 -0
- data/LICENSE.md +19 -0
- data/README.md +22 -1
- data/lib/omniauth-eventbrite.rb +1 -1
- data/lib/omniauth/eventbrite.rb +1 -1
- data/lib/omniauth/eventbrite/version.rb +1 -1
- data/lib/omniauth/strategies/eventbrite.rb +30 -29
- data/omniauth-eventbrite.gemspec +18 -20
- metadata +24 -53
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/lib/.DS_Store +0 -0
- data/spec/omniauth/strategies/eventbrite_spec.rb +0 -32
- data/spec/spec_helper.rb +0 -6
- data/spec/support/shared_examples.rb +0 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22782f3f0f7a6eaea968835f4d6a74fca2596d32
|
4
|
+
data.tar.gz: 46961778499be45bbb59ed953ef657f854758736
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d5839bebf6e58e2cebd2660a002f42d85c7184111194d86ffb54e69597d9e64e181f90cd96948567d9a1944de2b4fe2ecb03bd3d6e4374674cc073b50a63d817
|
7
|
+
data.tar.gz: 0db9cb3cf09d7c7250f8b10ad51e78c9c16e759a3c2215d79c01a0f16b0f28f4f1918e660446583bea960976b748cb93fa90d1121c1fc50077e935d8688fdbfc
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
This project adheres to [Semantic Versioning 2.0.0][semver].
|
6
|
+
|
7
|
+
## [Unreleased][unreleased]
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Nothing yet.
|
12
|
+
|
13
|
+
## [0.0.6] - 2014-05-02
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- *Breaking*: Switched the identity retrieval to the newer API v3 endpoint.
|
18
|
+
This will cause any retrieved user_id to change to the v3 standard, which
|
19
|
+
is incompatible with the v1 API. Eventbrite is deprecating API v1 within
|
20
|
+
the next two months, so if this is breaks your code you should update to
|
21
|
+
the newer API.
|
22
|
+
- Relaxed omniauth-oauth2 dependency to ~> 1.0 to ease use with other oauth2
|
23
|
+
providers.
|
24
|
+
- Added support for a "ref" parameter for the Eventbrite Referral Program.
|
25
|
+
|
26
|
+
## [0.0.5] - 2013-12-17
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
|
30
|
+
- Bugfix: Ensure raw_info at least returns an empty hash.
|
31
|
+
|
32
|
+
## [0.0.4] - 2012-09-20
|
33
|
+
|
34
|
+
### Changed
|
35
|
+
|
36
|
+
- user_id is now set as a string instead of an integer to match other
|
37
|
+
providers.
|
38
|
+
- Bugfix: Improve name handling for users with missing first or last names.
|
39
|
+
|
40
|
+
## [0.0.3] - 2012-02-16
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
|
44
|
+
- Bugfix: user_id was being pulled from the wrong attribute.
|
45
|
+
|
46
|
+
## [0.0.2] - 2012-02-16
|
47
|
+
|
48
|
+
### Changed
|
49
|
+
|
50
|
+
- Bugfix: Raw hashes were not being pruned properly.
|
51
|
+
|
52
|
+
[semver]: http://semver.org/spec/v2.0.0.html
|
53
|
+
[unreleased]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.6...HEAD
|
54
|
+
[0.0.6]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.5...v0.0.6
|
55
|
+
[0.0.5]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.4...v0.0.5
|
56
|
+
[0.0.4]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.3...v0.0.4
|
57
|
+
[0.0.3]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.2...v0.0.3
|
58
|
+
[0.0.2]: https://github.com/k504866430/omniauth-eventbrite/compare/v0.0.1...v0.0.2
|
data/LICENSE.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2012-2015 Kruttik Aggarwal
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# OmniAuth Eventbrite
|
2
2
|
|
3
|
-
This gem contains the Eventbrite strategy for OmniAuth
|
3
|
+
This gem contains the Eventbrite strategy for OmniAuth 2.0.
|
4
|
+
|
5
|
+
*Notice*: Versions 0.0.1 through 0.0.5 use Eventbrite API v1, which is due to
|
6
|
+
be deprecated within two months of 2015-04-30. Versions after that will use
|
7
|
+
Eventbrite API v3. This will affect the user_id that you get back from the API
|
8
|
+
but your auth_token should remain the same.
|
4
9
|
|
5
10
|
## Installing
|
6
11
|
|
@@ -22,6 +27,22 @@ end
|
|
22
27
|
|
23
28
|
You can find your client secret on the same page where your application API key is.
|
24
29
|
|
30
|
+
## Referral Program Code
|
31
|
+
|
32
|
+
If you participate in the [Eventbrite Referral Program][referral], you can also
|
33
|
+
include your referral code as a parameter in all of your OAuth2 authentications
|
34
|
+
by including it in the builder block:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
use OmniAuth::Builder do
|
38
|
+
provider :eventbrite, ENV['EVENTBRITE_CLIENT_ID'],
|
39
|
+
ENV['EVENTBRITE_CLIENT_SECRET'],
|
40
|
+
ref: 'EVENTBRITE_REFERRAL_CODE'
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
[referral]: https://www.eventbrite.com/referral-program/
|
45
|
+
|
25
46
|
## License
|
26
47
|
|
27
48
|
Copyright (c) 2012 Kruttik Aggarwal
|
data/lib/omniauth-eventbrite.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'omniauth/eventbrite'
|
data/lib/omniauth/eventbrite.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'omniauth/eventbrite/version'
|
2
|
-
require 'omniauth/strategies/eventbrite'
|
2
|
+
require 'omniauth/strategies/eventbrite'
|
@@ -5,16 +5,16 @@ module OmniAuth
|
|
5
5
|
class Eventbrite < OmniAuth::Strategies::OAuth2
|
6
6
|
DEFAULT_RESPONSE_TYPE = 'code'
|
7
7
|
DEFAULT_GRANT = 'authorization_code'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
option :
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
uid { raw_info['
|
17
|
-
|
8
|
+
INFO_URL = 'https://www.eventbriteapi.com/v3/users/me/'.freeze
|
9
|
+
|
10
|
+
option :name, 'eventbrite'
|
11
|
+
option :authorize_options, [:ref]
|
12
|
+
option :client_options, site: 'https://www.eventbrite.com',
|
13
|
+
authorize_url: '/oauth/authorize',
|
14
|
+
token_url: '/oauth/token'
|
15
|
+
|
16
|
+
uid { raw_info['id'].to_s }
|
17
|
+
|
18
18
|
def authorize_params
|
19
19
|
super.tap do |params|
|
20
20
|
params[:response_type] ||= DEFAULT_RESPONSE_TYPE
|
@@ -29,34 +29,29 @@ module OmniAuth
|
|
29
29
|
params[:client_secret] = client.secret
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
info do
|
34
|
-
prune!(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
'last_name' => raw_info['last_name'],
|
39
|
-
})
|
34
|
+
prune!('email' => retrieved_email,
|
35
|
+
'name' => raw_info['name'],
|
36
|
+
'first_name' => raw_info['first_name'],
|
37
|
+
'last_name' => raw_info['last_name'])
|
40
38
|
end
|
41
|
-
|
39
|
+
|
42
40
|
extra do
|
43
|
-
prune!(
|
44
|
-
'raw_info' => raw_info
|
45
|
-
})
|
41
|
+
prune!('raw_info' => raw_info)
|
46
42
|
end
|
47
43
|
|
48
44
|
def raw_info
|
49
|
-
@raw_info ||= access_token.get(
|
45
|
+
@raw_info ||= access_token.get(INFO_URL).parsed || {}
|
50
46
|
end
|
51
|
-
|
47
|
+
|
52
48
|
private
|
53
49
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
50
|
+
def full_name
|
51
|
+
first_name = raw_info['first_name'] || ''
|
52
|
+
last_name = raw_info['last_name'] || ''
|
53
|
+
|
54
|
+
"#{first_name} #{last_name}".strip || nil
|
60
55
|
end
|
61
56
|
|
62
57
|
def prune!(hash)
|
@@ -65,6 +60,12 @@ module OmniAuth
|
|
65
60
|
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
66
61
|
end
|
67
62
|
end
|
63
|
+
|
64
|
+
def retrieved_email
|
65
|
+
primary = raw_info['emails'].detect { |e| e['primary'] }
|
66
|
+
primary ||= raw_info['emails'].first
|
67
|
+
primary['email']
|
68
|
+
end
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
data/omniauth-eventbrite.gemspec
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/eventbrite/version'
|
4
5
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-eventbrite'
|
8
|
+
spec.version = Omniauth::Eventbrite::VERSION
|
9
|
+
spec.authors = ['Kruttik Aggarwal']
|
10
|
+
spec.email = ['kruttikagarwal@gmail.com']
|
11
|
+
spec.homepage = 'https://github.com/k504866430/omniauth-eventbrite'
|
12
|
+
spec.summary = 'Eventbrite OAuth2 strategy for OmniAuth'
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.license = 'MIT'
|
13
15
|
|
14
|
-
|
16
|
+
spec.files = %w(CHANGELOG.md LICENSE.md README.md omniauth-eventbrite.gemspec)
|
17
|
+
spec.files += Dir['lib/**/*.rb']
|
18
|
+
spec.require_paths = ['lib']
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.0'
|
22
|
-
s.add_development_dependency 'rspec', '~> 2.7.0'
|
23
|
-
s.add_development_dependency 'rake'
|
20
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.0'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
24
22
|
end
|
metadata
CHANGED
@@ -1,109 +1,80 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-eventbrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kruttik Aggarwal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-05-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: omniauth-oauth2
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: '1.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
26
|
+
version: '1.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: bundler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: '1.0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
|
47
|
-
name: rake
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
description: Eventbrite strategy for OmniAuth
|
40
|
+
version: '1.0'
|
41
|
+
description: Eventbrite OAuth2 strategy for OmniAuth
|
63
42
|
email:
|
64
43
|
- kruttikagarwal@gmail.com
|
65
44
|
executables: []
|
66
45
|
extensions: []
|
67
46
|
extra_rdoc_files: []
|
68
47
|
files:
|
69
|
-
- .
|
70
|
-
-
|
48
|
+
- CHANGELOG.md
|
49
|
+
- LICENSE.md
|
71
50
|
- README.md
|
72
|
-
- Rakefile
|
73
|
-
- lib/.DS_Store
|
74
51
|
- lib/omniauth-eventbrite.rb
|
75
52
|
- lib/omniauth/eventbrite.rb
|
76
53
|
- lib/omniauth/eventbrite/version.rb
|
77
54
|
- lib/omniauth/strategies/eventbrite.rb
|
78
55
|
- omniauth-eventbrite.gemspec
|
79
|
-
- spec/omniauth/strategies/eventbrite_spec.rb
|
80
|
-
- spec/spec_helper.rb
|
81
|
-
- spec/support/shared_examples.rb
|
82
56
|
homepage: https://github.com/k504866430/omniauth-eventbrite
|
83
|
-
licenses:
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
84
60
|
post_install_message:
|
85
61
|
rdoc_options: []
|
86
62
|
require_paths:
|
87
63
|
- lib
|
88
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- -
|
66
|
+
- - ">="
|
92
67
|
- !ruby/object:Gem::Version
|
93
68
|
version: '0'
|
94
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
70
|
requirements:
|
97
|
-
- -
|
71
|
+
- - ">="
|
98
72
|
- !ruby/object:Gem::Version
|
99
73
|
version: '0'
|
100
74
|
requirements: []
|
101
|
-
rubyforge_project:
|
102
|
-
rubygems_version:
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.4.5
|
103
77
|
signing_key:
|
104
|
-
specification_version:
|
105
|
-
summary:
|
106
|
-
test_files:
|
107
|
-
- spec/omniauth/strategies/eventbrite_spec.rb
|
108
|
-
- spec/spec_helper.rb
|
109
|
-
- spec/support/shared_examples.rb
|
78
|
+
specification_version: 4
|
79
|
+
summary: Eventbrite OAuth2 strategy for OmniAuth
|
80
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/lib/.DS_Store
DELETED
Binary file
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'omniauth-eventbrite'
|
3
|
-
|
4
|
-
OmniAuth.config.test_mode = true
|
5
|
-
|
6
|
-
describe OmniAuth::Strategies::Eventbrite do
|
7
|
-
subject do
|
8
|
-
OmniAuth::Strategies::Eventbrite.new(nil, @options || {})
|
9
|
-
end
|
10
|
-
|
11
|
-
it_should_behave_like 'an oauth2 strategy'
|
12
|
-
|
13
|
-
describe '#client' do
|
14
|
-
it 'should have the correct Eventbrite site' do
|
15
|
-
subject.client.site.should eq("https://www.eventbrite.com")
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should have the correct authorization url' do
|
19
|
-
subject.client.options[:authorize_url].should eq("/oauth/authorize")
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should have the correct token url' do
|
23
|
-
subject.client.options[:token_url].should eq('/oauth/token')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#callback_path' do
|
28
|
-
it 'should have the correct callback path' do
|
29
|
-
subject.callback_path.should eq('/auth/eventbrite/callback')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
-
shared_examples 'an oauth2 strategy' do
|
3
|
-
describe '#client' do
|
4
|
-
it 'should be initialized with symbolized client_options' do
|
5
|
-
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
6
|
-
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#authorize_params' do
|
11
|
-
it 'should include any authorize params passed in the :authorize_params option' do
|
12
|
-
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
13
|
-
subject.authorize_params['foo'].should eq('bar')
|
14
|
-
subject.authorize_params['baz'].should eq('zip')
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should include top-level options that are marked as :authorize_options' do
|
18
|
-
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
19
|
-
subject.authorize_params['scope'].should eq('bar')
|
20
|
-
subject.authorize_params['foo'].should eq('baz')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#token_params' do
|
25
|
-
it 'should include any authorize params passed in the :authorize_params option' do
|
26
|
-
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
27
|
-
subject.token_params['foo'].should eq('bar')
|
28
|
-
subject.token_params['baz'].should eq('zip')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should include top-level options that are marked as :authorize_options' do
|
32
|
-
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
33
|
-
subject.token_params['scope'].should eq('bar')
|
34
|
-
subject.token_params['foo'].should eq('baz')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|