omniauth-eventbrite 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 +4 -0
- data/Gemfile +6 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/lib/.DS_Store +0 -0
- data/lib/omniauth-eventbrite.rb +1 -0
- data/lib/omniauth/eventbrite.rb +2 -0
- data/lib/omniauth/eventbrite/version.rb +5 -0
- data/lib/omniauth/strategies/eventbrite.rb +55 -0
- data/omniauth-eventbrite.gemspec +24 -0
- data/spec/omniauth/strategies/eventbrite_spec.rb +30 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared_examples.rb +37 -0
- metadata +94 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# OmniAuth Eventbrite
|
2
|
+
|
3
|
+
This gem contains the Eventbrite strategy for OmniAuth 1.0.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Add to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-eventbrite', '~> 0.0.1'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
14
|
+
|
15
|
+
## Basic Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
use OmniAuth::Builder do
|
19
|
+
provider :eventbrite, ENV['EVENTBRITE_CLIENT_ID'], ENV['EVENTBRITE_SECRET']
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
Copyright (c) 2012 Kruttik Aggarwal
|
26
|
+
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
28
|
+
copy of this software and associated documentation files (the
|
29
|
+
"Software"), to deal in the Software without restriction, including
|
30
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
31
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
32
|
+
permit persons to whom the Software is furnished to do so, subject to
|
33
|
+
the following conditions:
|
34
|
+
|
35
|
+
The above copyright notice and this permission notice shall be included
|
36
|
+
in all copies or substantial portions of the Software.
|
37
|
+
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
39
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
40
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
41
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
42
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
43
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
44
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
require "omniauth/eventbrite"
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Eventbrite < OmniAuth::Strategies::OAuth2
|
6
|
+
DEFAULT_RESPONSE_TYPE = 'code'
|
7
|
+
DEFAULT_GRANT = 'authorization_code'
|
8
|
+
|
9
|
+
option :name, "eventbrite"
|
10
|
+
|
11
|
+
option :client_options, {
|
12
|
+
:site => "https://www.eventbrite.com",
|
13
|
+
:authorize_url => '/oauth/authorize',
|
14
|
+
:token_url => '/oauth/token'
|
15
|
+
}
|
16
|
+
uid { raw_info['id'] }
|
17
|
+
|
18
|
+
def authorize_params
|
19
|
+
super.tap do |params|
|
20
|
+
params[:response_type] ||= DEFAULT_RESPONSE_TYPE
|
21
|
+
params[:client_id] = client.id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def token_params
|
26
|
+
super.tap do |params|
|
27
|
+
params[:grant_type] ||= DEFAULT_GRANT
|
28
|
+
params[:client_id] = client.id
|
29
|
+
params[:client_secret] = client.secret
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
info do
|
34
|
+
prune!({
|
35
|
+
'email' => raw_info['email'],
|
36
|
+
'name' => raw_info['first_name'] + " " + raw_info['last_name'],
|
37
|
+
'first_name' => raw_info['first_name'],
|
38
|
+
'last_name' => raw_info['last_name'],
|
39
|
+
})
|
40
|
+
end
|
41
|
+
|
42
|
+
extra do
|
43
|
+
prune!({
|
44
|
+
'raw_info' => raw_info
|
45
|
+
})
|
46
|
+
end
|
47
|
+
|
48
|
+
def raw_info
|
49
|
+
@raw_info ||= access_token.get('/json/user_get')['user']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
OmniAuth.config.add_camelization 'eventbrite', 'Eventbrite'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth/eventbrite/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-eventbrite"
|
7
|
+
s.version = Omniauth::Eventbrite::VERSION
|
8
|
+
s.authors = ["Kruttik Aggarwal"]
|
9
|
+
s.email = ["kruttikagarwal@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/k504866430/omniauth-eventbrite"
|
11
|
+
s.summary = "EventBrite strategy for Omniauth with OAuth 2.0"
|
12
|
+
s.description = "Eventbrite strategy for OmniAuth"
|
13
|
+
|
14
|
+
s.rubyforge_project = "omniauth-eventbrite"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
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.0.0'
|
22
|
+
s.add_development_dependency 'rspec', '~> 2.7.0'
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-eventbrite'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Eventbrite do
|
5
|
+
subject do
|
6
|
+
OmniAuth::Strategies::Eventbrite.new(nil, @options || {})
|
7
|
+
end
|
8
|
+
|
9
|
+
it_should_behave_like 'an oauth2 strategy'
|
10
|
+
|
11
|
+
describe '#client' do
|
12
|
+
it 'should have the correct Eventbrite site' do
|
13
|
+
subject.client.site.should eq("https://www.eventbrite.com")
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have the correct authorization url' do
|
17
|
+
subject.client.options[:authorize_url].should eq("/oauth/authorize")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the correct token url' do
|
21
|
+
subject.client.options[:token_url].should eq('/oauth/token')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#callback_path' do
|
26
|
+
it 'should have the correct callback path' do
|
27
|
+
subject.callback_path.should eq('/auth/eventbrite/callback')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-eventbrite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kruttik Aggarwal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: &70315423404860 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70315423404860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70315423403920 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.7.0
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70315423403920
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &70315423403540 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70315423403540
|
47
|
+
description: Eventbrite strategy for OmniAuth
|
48
|
+
email:
|
49
|
+
- kruttikagarwal@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- lib/.DS_Store
|
59
|
+
- lib/omniauth-eventbrite.rb
|
60
|
+
- lib/omniauth/eventbrite.rb
|
61
|
+
- lib/omniauth/eventbrite/version.rb
|
62
|
+
- lib/omniauth/strategies/eventbrite.rb
|
63
|
+
- omniauth-eventbrite.gemspec
|
64
|
+
- spec/omniauth/strategies/eventbrite_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
66
|
+
- spec/support/shared_examples.rb
|
67
|
+
homepage: https://github.com/k504866430/omniauth-eventbrite
|
68
|
+
licenses: []
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project: omniauth-eventbrite
|
87
|
+
rubygems_version: 1.8.10
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: EventBrite strategy for Omniauth with OAuth 2.0
|
91
|
+
test_files:
|
92
|
+
- spec/omniauth/strategies/eventbrite_spec.rb
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/support/shared_examples.rb
|