omniauth-assembla 0.0.3

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.tar.gz.sig ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ group :test do
6
+ gem 'rack-test'
7
+ gem 'coveralls', :require => false
8
+ gem 'rspec', '>= 2.14'
9
+ gem 'simplecov', :require => false
10
+ end
11
+
12
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ guard 'rspec', :version => 2 do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^spec/support/.+\.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
7
+
8
+ guard 'bundler' do
9
+ watch('Gemfile')
10
+ watch('omniauth-assembla.gemspec')
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Onboarder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # OmniAuth Assembla
2
+
3
+ This gem is the unofficial Assembla strategy for OmniAuth.
4
+
5
+ [![Build Status](https://travis-ci.org/onboarder/omniauth-assembla.png)](https://travis-ci.org/onboarder/omniauth-assembla)
6
+
7
+ ## Basic Usage
8
+
9
+ ```
10
+ use OmniAuth::Builder do
11
+ provider :assembla, ENV['ASSEMBLA_APP_ID'], ENV['ASSEMBLA_APP_SECRET']
12
+ end
13
+ ```
14
+
15
+ ## Supported Flows
16
+
17
+ Supports the web services flow as described by the [Authentication](http://api-doc.assembla.com/content/authentication.html#web_service) documentation at Assembla. This is the typical 3-step authentication flow for web applications.
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new do |t|
5
+ end
6
+
7
+ task :default => :spec
@@ -0,0 +1,20 @@
1
+ -----BEGIN CERTIFICATE-----
2
+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1nT2b037YLgHXZA8BZ0TgHzyn3
18
+ o8J3qnzOSN9tZb60WYxeown2g/OVzovnnEqdytI3Pcux68xPrsPojaXD4nYkouRk
19
+ houcKFBo4vS+f9EI5ZI=
20
+ -----END CERTIFICATE-----
@@ -0,0 +1,2 @@
1
+ require "omniauth-assembla/version"
2
+ require "omniauth/strategies/assembla"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Assembla
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -0,0 +1,54 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Assembla < OmniAuth::Strategies::OAuth2
7
+
8
+ option :client_options, {
9
+ site: "https://api.assembla.com",
10
+ authorize_url: "/authorization",
11
+ token_url: "/token",
12
+ }
13
+
14
+ option :name, "assembla"
15
+
16
+ def request_phase
17
+ super
18
+ end
19
+
20
+ def build_access_token
21
+ token_params = {
22
+ code: request.params["code"],
23
+ redirect_uri: callback_url,
24
+ client_id: client.id,
25
+ client_secret: client.secret,
26
+ grant_type: "authorization_code",
27
+ }
28
+ client.get_token(token_params)
29
+ end
30
+
31
+ uid { raw_info.parsed['id'] }
32
+
33
+ info do
34
+ {
35
+ 'email' => raw_info.parsed["email"],
36
+ 'name' => raw_info.parsed["name"],
37
+ }
38
+ end
39
+
40
+ extra do
41
+ {
42
+ 'login' => raw_info.parsed["login"],
43
+ 'raw_info' => raw_info.parsed,
44
+ }
45
+ end
46
+
47
+ def raw_info
48
+ access_token.options[:parse] = :json
49
+ @raw_info ||= access_token.get("/v1/user.json")
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require File.expand_path('../lib/omniauth-assembla/version', __FILE__)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-assembla"
8
+ spec.version = OmniAuth::Assembla::VERSION
9
+ spec.authors = ["Derek Hopper"]
10
+ spec.email = ["hopper.derek@gmail.com"]
11
+ spec.description = %q{OmniAuth strategy for Assembla}
12
+ spec.summary = %q{OmniAuth strategy for Assembla}
13
+ spec.homepage = "https://github.com/onboarder/omniauth-assembla"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'omniauth', '~> 1.0'
22
+ spec.add_dependency 'omniauth-oauth2', '~> 1.0'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.0'
25
+
26
+ spec.cert_chain = ['certs/djhopper01-public.pem']
27
+ spec.signing_key = File.expand_path("~/.gem/djhopper01-private.pem") if $0 =~ /gem\z/
28
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+ require 'omniauth-assembla'
3
+
4
+ describe OmniAuth::Strategies::Assembla do
5
+ subject do
6
+ strategy = OmniAuth::Strategies::Assembla.new(nil, @options || {})
7
+ strategy.stub(:session) { {} }
8
+ strategy
9
+ end
10
+
11
+ it_should_behave_like 'an oauth2 strategy'
12
+
13
+ describe '#client' do
14
+ it 'should have the correct Assembla site' do
15
+ subject.client.site.should eq("https://api.assembla.com")
16
+ end
17
+
18
+ it 'should have the correct authorization url' do
19
+ subject.client.options[:authorize_url].should eq("/authorization")
20
+ end
21
+
22
+ it 'should have the correct token url' do
23
+ subject.client.options[:token_url].should eq('/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/assembla/callback')
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'omniauth'
8
+ require 'omniauth-assembla'
9
+
10
+ Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
11
+
12
+ RSpec.configure do |config|
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ end
@@ -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,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-assembla
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Derek Hopper
9
+ autorequire:
10
+ bindir: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U1C
29
+ MEdBMVVkRGdRV0JCVHFzZFNTV1U2Rwo2ckgyNDByWElvQXNUa3FLaHpBTEJn
30
+ TlZIUThFQkFNQ0JMQXdEUVlKS29aSWh2Y05BUUVGQlFBRGdnRUJBREdaCllT
31
+ TGtqd0I1aUlKT0VhK1hRWWQ1d2dOKzRnMHFNOWI4V20vTmwyL2ZIaWI0anYz
32
+ NlhPaVk0MjhxM2dHS3orQXIKZytRT2lKMjlYdjNLc1hoUFBUOXI2OTRzUnhB
33
+ MFREaXE2UGc3RW5FeVdCNUl0ODZYUlFFNHpkaVp5aUoxWVk3RApDWlIzS0Zz
34
+ OTFTdzdWd05jb0RUSFZwRmt2SFU4RXpRcWZtWmJtb2NoQnFqTWZIZTF5dmhE
35
+ QU5PcVAya2lja3JhClY3YzFPZWt4bWN5c3RPT21mdXFFUE9NZEc3WWp0TTJ5
36
+ REJIbk1aMW5UMmIwMzdZTGdIWFpBOEJaMFRnSHp5bjMKbzhKM3Fuek9TTjl0
37
+ WmI2MFdZeGVvd24yZy9PVnpvdm5uRXFkeXRJM1BjdXg2OHhQcnNQb2phWEQ0
38
+ bllrb3VSawpob3VjS0ZCbzR2UytmOUVJNVpJPQotLS0tLUVORCBDRVJUSUZJ
39
+ Q0FURS0tLS0tCg==
40
+ date: 2013-11-27 00:00:00.000000000 Z
41
+ dependencies:
42
+ - !ruby/object:Gem::Dependency
43
+ name: omniauth
44
+ requirement: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: '1.0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: omniauth-oauth2
60
+ requirement: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: '1.0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: bundler
76
+ requirement: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ description: OmniAuth strategy for Assembla
91
+ email:
92
+ - hopper.derek@gmail.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - .gitignore
98
+ - .travis.yml
99
+ - Gemfile
100
+ - Guardfile
101
+ - LICENSE
102
+ - README.md
103
+ - Rakefile
104
+ - certs/djhopper01-public.pem
105
+ - lib/omniauth-assembla.rb
106
+ - lib/omniauth-assembla/version.rb
107
+ - lib/omniauth/strategies/assembla.rb
108
+ - omniauth-assembla.gemspec
109
+ - spec/omniauth/strategies/assembla_spec.rb
110
+ - spec/spec_helper.rb
111
+ - spec/support/shared_examples.rb
112
+ homepage: https://github.com/onboarder/omniauth-assembla
113
+ licenses:
114
+ - MIT
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 1.8.28
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: OmniAuth strategy for Assembla
137
+ test_files:
138
+ - spec/omniauth/strategies/assembla_spec.rb
139
+ - spec/spec_helper.rb
140
+ - spec/support/shared_examples.rb
141
+ has_rdoc:
metadata.gz.sig ADDED
Binary file