omniauth-ticketbud 1.0.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/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *.gem
2
+ .bundle
3
+ .rspec
4
+ /Gemfile.lock
5
+ pkg/*
6
+ .powenv
7
+ tmp
8
+ bin
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.3-p286-perf@omniauth-ticketbud --create
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'omniauth-oauth2'
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ omniauth-ticketbud
2
+ ==============
3
+ Ticketbud OAuth2 Strategy for OmniAuth 1.x and supports the OAuth 2.0 server-side flow.
4
+
5
+ *Ticketbud API docs can be found [here](https://api.ticketbud.com).*
6
+
7
+ ## Installation
8
+
9
+ Add to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'omniauth-ticketbud'
13
+ ```
14
+
15
+ Then `bundle install`.
16
+
17
+ ## Usage
18
+
19
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
20
+
21
+ ```ruby
22
+ Rails.application.config.middleware.use OmniAuth::Builder do
23
+ provider :ticketbud, ENV['TICKETBUD_CLIENT_ID'], ENV['TICKETBUD_CLIENT_SECRET']
24
+ end
25
+ ```
26
+
27
+ ## Auth Hash
28
+
29
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
30
+
31
+ ```ruby
32
+ {
33
+ :provider => 'ticketbud',
34
+ :uid => '1234567',
35
+ :info => {
36
+ :email => 'foo@bar.com',
37
+ :first_name => 'Brandon',
38
+ :last_name => 'Harris'
39
+ },
40
+ :credentials => {
41
+ :token => 'ABCDEF...',
42
+ :expires => false
43
+ },
44
+ :extra => {
45
+ :raw_info => {
46
+ :user => {
47
+ :id => 1234567,
48
+ :full_name => "Brandon Harris",
49
+ :first_name => "Brandon",
50
+ :last_name => "Harris",
51
+ :email => "foo@bar.com",
52
+ :default_subdomain => "adipisci-71972",
53
+ :event_ids => [
54
+ 11111,
55
+ 22222
56
+ ]
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## Supported Ruby Versions
64
+ `omniauth-ticketbud` is tested under 1.9.3
65
+
66
+ ## Versioning
67
+ This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
68
+ of this scheme should be reported as bugs. Specifically, if a minor or patch
69
+ version is released that breaks backward compatibility, that version should be
70
+ immediately yanked and/or a new version should be immediately released that
71
+ restores compatibility. Breaking changes to the public API will only be
72
+ introduced with new major versions. As a result of this policy, you can (and
73
+ should) specify a dependency on this gem using the [Pessimistic Version
74
+ Constraint][pvc] with two digits of precision. For example:
75
+
76
+ spec.add_dependency 'omniauth-ticketbud', '~> 1.0'
77
+
78
+ [semver]: http://semver.org/
79
+ [pvc]: http://docs.rubygems.org/read/chapter/16#page74
80
+
81
+
82
+ ## License
83
+
84
+ Copyright (c) 2013 by Brandon Harris
85
+
86
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
87
+
88
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
89
+
90
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,32 @@
1
+ module OmniAuth
2
+ module Strategies
3
+ class Ticketbud < OmniAuth::Strategies::OAuth2
4
+ option :name, :ticketbud
5
+
6
+ option :client_options, {
7
+ :site => "https://api.ticketbud.com",
8
+ :authorize_url => "/oauth/authorize",
9
+ :token_url => "/oauth/token"
10
+ }
11
+
12
+ uid { raw_info["user"]["id"] }
13
+
14
+ info do
15
+ {
16
+ :first_name => raw_info["user"]["first_name"],
17
+ :last_name => raw_info["user"]["first_name"],
18
+ :email => raw_info["user"]["email"]
19
+ }
20
+ end
21
+
22
+ extra do
23
+ { user: raw_info["user"] }
24
+ end
25
+
26
+ def raw_info
27
+ @raw_info ||= access_token.get('/me.json').parsed
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Ticketbud
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
data/lib/ticketbud.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'omniauth/ticketbud/version'
2
+ require 'omniauth/strategies/ticketbud'
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'ticketbud/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'omniauth-ticketbud'
7
+ s.version = OmniAuth::Ticketbud::VERSION
8
+ s.authors = ['Brandon Harris']
9
+ s.email = ['development@ticketbud.com']
10
+ s.summary = 'Ticketbud strategy for OmniAuth'
11
+ s.homepage = 'https://github.com/Ticketbud/omniauth-ticketbud'
12
+ s.license = 'MIT'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
17
+ s.require_paths = ['lib']
18
+
19
+ s.add_runtime_dependency 'omniauth'
20
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
21
+ s.add_development_dependency 'rspec', '~> 2.7.0'
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'webmock'
24
+ s.add_development_dependency 'rack-test'
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "OmniAuth::Strategies::Ticketbud" do
4
+ subject do
5
+ OmniAuth::Strategies::Ticketbud.new(nil)
6
+ end
7
+
8
+ it 'should be named ticketbud' do
9
+ subject.options.name.should eq(:ticketbud)
10
+ end
11
+
12
+ context 'client options' do
13
+ it 'has main api site' do
14
+ subject.options.client_options.site.should eq('https://api.ticketbud.com')
15
+ end
16
+
17
+ it 'has the correct authorize_path' do
18
+ subject.options.client_options.authorize_url.should eq("/oauth/authorize")
19
+ end
20
+
21
+ it 'has the correct token_url' do
22
+ subject.options.client_options.token_url.should eq("/oauth/token")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'rspec'
5
+ require 'rack/test'
6
+ require 'webmock/rspec'
7
+ require 'omniauth'
8
+ require 'omniauth-oauth2'
9
+ require 'strategies/ticketbud'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-ticketbud
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brandon Harris
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth2
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.1'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.7.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: 2.7.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: webmock
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rack-test
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description:
111
+ email:
112
+ - development@ticketbud.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .rvmrc
119
+ - Gemfile
120
+ - README.md
121
+ - lib/strategies/ticketbud.rb
122
+ - lib/ticketbud.rb
123
+ - lib/ticketbud/version.rb
124
+ - omniauth-ticketbud.gemspec
125
+ - spec/omniauth/strategies/ticketbud_spec.rb
126
+ - spec/spec_helper.rb
127
+ homepage: https://github.com/Ticketbud/omniauth-ticketbud
128
+ licenses:
129
+ - MIT
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 1.8.23
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Ticketbud strategy for OmniAuth
152
+ test_files:
153
+ - spec/omniauth/strategies/ticketbud_spec.rb
154
+ - spec/spec_helper.rb