omniauth-surveymonkey2 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff45202d24adde4f7d46c4e1c8fa76176faf0f5
4
- data.tar.gz: adbc23c3f556f8351044816bef80b0fb8783e294
3
+ metadata.gz: 428d16f757dade79c13171d9972cf0fefb6093d0
4
+ data.tar.gz: fa0c053e1e575170b9be5f3fa1e7ba3da1e324b5
5
5
  SHA512:
6
- metadata.gz: ac6418e72501b3f06d989829bffc6109486b8edc1f6ab199747ad27de896af361de04d3ee8806614c6365717c2d711dc8442f07c4b1c291d7251bfc621eb5d4f
7
- data.tar.gz: ccbf457ee06d2c5fdb98aa25c5e7cf68f961c26168ca5feb289b692c7a030d37a67dd8e34143cbecd3a9f282a3a2863441fb23c868dfd3125e44dc12702de796
6
+ metadata.gz: b26d54645a99c9877354af0fc7a8395654fcf344954be842b508436c1f3289a5c9f191e74d72dde26d372f6e17062a23143d48583114e1ff713a297cf65fde50
7
+ data.tar.gz: 006e53aa1b4f820fb1c60f8d12cea5c1f1df2acd9ceaedf81c41313cc12e4469fdcdd14256977033e9953610007b0e50c54ec8be4327243fdfb239ea2c711899
data/Gemfile CHANGED
@@ -1,4 +1 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in omniauth-surveymonkey2.gemspec
4
- gemspec
1
+ gem "omniauth-oauth2"
data/Gemfile.lock ADDED
@@ -0,0 +1,23 @@
1
+ GEM
2
+ specs:
3
+ faraday (0.8.0)
4
+ multipart-post (~> 1.1)
5
+ hashie (1.2.0)
6
+ multi_json (1.3.6)
7
+ multipart-post (1.2.0)
8
+ oauth2 (0.5.2)
9
+ faraday (~> 0.7)
10
+ multi_json (~> 1.0)
11
+ omniauth (1.0.0)
12
+ hashie (~> 1.2)
13
+ rack
14
+ omniauth-oauth2 (1.0.0)
15
+ oauth2 (~> 0.5.0)
16
+ omniauth (~> 1.0)
17
+ rack (1.1.6)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ omniauth-oauth2
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2013 Kaushik SV
2
+
3
+ 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ 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.
data/README.md CHANGED
@@ -1,29 +1,13 @@
1
- # Omniauth::Surveymonkey2
1
+ #Surveymonkey Strategy
2
2
 
3
- TODO: Write a gem description
3
+ SurveyMonkey OAuth2 strategy for OmniAuth 1.0.
4
4
 
5
- ## Installation
5
+ #License
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Copyright (c) 2013 Kaushik SV, Chris Beck
8
8
 
9
- gem 'omniauth-surveymonkey2'
9
+ 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:
10
10
 
11
- And then execute:
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
12
 
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install omniauth-surveymonkey2
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
13
+ 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.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'omniauth-surveymonkey'
@@ -0,0 +1 @@
1
+ require "omniauth/surveymonkey"
@@ -0,0 +1,73 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Surveymonkey < OmniAuth::Strategies::OAuth2
6
+
7
+
8
+ DEFAULT_RESPONSE_TYPE = 'code'
9
+ DEFAULT_GRANT = 'authorization_code'
10
+
11
+ option :name, "surveymonkey"
12
+
13
+ option :client_options, {
14
+ :site => "https://api-surveymonkey-com-fytofsd4ktc2.runscope.net",
15
+ :authorize_url => '/oauth/authorize',
16
+ :token_url => '/oauth/token'
17
+ }
18
+
19
+ option :authorize_options, [:client_id, :api_key]
20
+
21
+ def authorize_params
22
+ log :info, ">>>>>>>> in authorize_params"
23
+ super.tap do |params|
24
+ params[:response_type] ||= DEFAULT_RESPONSE_TYPE
25
+ params[:client_id] = options[:client_id]
26
+ params[:api_key] = options[:api_key]
27
+ end
28
+ end
29
+
30
+ def token_params
31
+ log :info, ">>>>>>> calling token params"
32
+ super.tap do |params|
33
+ params[:grant_type] ||= DEFAULT_GRANT
34
+ params[:client_id] = options[:client_id]
35
+ params[:client_secret] = options[:client_secret]
36
+ params[:redirect_uri] = callback_url
37
+ end
38
+ end
39
+
40
+ def build_access_token
41
+ log :info, ">>>>>>>> calling build_access_token"
42
+ verifier = request.params['code']
43
+ log :info, ">>>>>>> code: #{verifier.inspect}"
44
+ log :info, ">>>>> getting auth token now"
45
+ token = client.auth_code.get_token(verifier, token_params)
46
+ log :info, ">>>>>> token: #{token.inspect}"
47
+ token
48
+ end
49
+
50
+ def callback_phase
51
+ log :info, ">>>>>>>> in callback_phase"
52
+ options[:client_options][:token_url] = "/oauth/token?api_key=#{options[:api_key]}"
53
+ log :info, ">>>> in callback phase, calling build_access_token"
54
+ self.access_token = build_access_token
55
+ log :info, ">>>>>> self access token: #{self.access_token.inspect}"
56
+ log :info, ">>>> getting ready to set auth hash"
57
+ hash = auth_hash
58
+ log :info, ">>>>> auth hash is: #{hash.inspect}"
59
+ self.env['omniauth.auth'] = hash
60
+ log :info, ">>>> calling app"
61
+ call_app!
62
+ end
63
+
64
+ info do
65
+ {
66
+ :token => self.access_token.token,
67
+ :client => self.access_token.client.id
68
+ }
69
+ end
70
+
71
+ end
72
+ end
73
+ end
@@ -0,0 +1 @@
1
+ require 'omniauth/strategies/surveymonkey'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Surveymonkey
3
+ VERSION = "0.0.7"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../lib/omniauth/surveymonkey/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.add_dependency 'omniauth', '~> 1.0'
5
+
6
+ gem.authors = ["Kaushik SV", "Chris Beck"]
7
+ gem.email = ["speak2kaushik@gmail.com", "chris.beck@me.com"]
8
+ gem.description = %q{Survemonkey OAuth2 strategy for OmniAuth 1.0}
9
+ gem.summary = %q{Survemonkey OAuth2 strategy for OmniAuth 1.0.}
10
+
11
+
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files spec/*`.split("\n")
14
+ gem.name = "omniauth-surveymonkey2"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniAuth::Surveymonkey::VERSION
17
+ gem.homepage = "https://github.com/cbeck/omniauth-surveymonkey"
18
+
19
+ gem.add_runtime_dependency 'omniauth-oauth2'
20
+
21
+ gem.add_development_dependency 'rspec', '~> 1.3.1'
22
+ gem.add_development_dependency 'rake'
23
+ end
@@ -0,0 +1 @@
1
+ require 'omniauth-surveymonkey'
@@ -1,14 +1,13 @@
1
- require 'spec_helper'
2
- require 'omniauth-surveymonkey2'
1
+ require 'omniauth-surveymonkey'
3
2
 
4
- describe OmniAuth::Strategies::Surveymonkey2 do
3
+ describe OmniAuth::Strategies::Surveymonkey do
4
+
5
5
  subject do
6
- OmniAuth::Strategies::Surveymonkey2.new(nil, @options || {})
6
+ OmniAuth::Strategies::Surveymonkey.new(nil, {})
7
7
  end
8
8
 
9
- it_should_behave_like 'an oauth2 strategy'
9
+ describe '#client' do
10
10
 
11
- describe '#client' do
12
11
  it 'has correct surveymonkey api site' do
13
12
  subject.options.client_options.site.should == ('https://api.surveymonkey.com')
14
13
  end
@@ -22,7 +21,7 @@ describe OmniAuth::Strategies::Surveymonkey2 do
22
21
  end
23
22
  end
24
23
 
25
- describe '#callback_path' do
24
+ describe '#callback_path' do
26
25
  it 'should have the correct callback path' do
27
26
  subject.callback_path.should == ('/auth/surveymonkey/callback')
28
27
  end
metadata CHANGED
@@ -1,9 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-surveymonkey2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
+ - Kaushik SV
7
8
  - Chris Beck
8
9
  autorequire:
9
10
  bindir: bin
@@ -11,41 +12,27 @@ cert_chain: []
11
12
  date: 2013-12-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: omniauth-oauth2
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
15
+ name: omniauth
29
16
  requirement: !ruby/object:Gem::Requirement
30
17
  requirements:
31
18
  - - ~>
32
19
  - !ruby/object:Gem::Version
33
- version: '1.3'
34
- type: :development
20
+ version: '1.0'
21
+ type: :runtime
35
22
  prerelease: false
36
23
  version_requirements: !ruby/object:Gem::Requirement
37
24
  requirements:
38
25
  - - ~>
39
26
  - !ruby/object:Gem::Version
40
- version: '1.3'
27
+ version: '1.0'
41
28
  - !ruby/object:Gem::Dependency
42
- name: rake
29
+ name: omniauth-oauth2
43
30
  requirement: !ruby/object:Gem::Requirement
44
31
  requirements:
45
32
  - - '>='
46
33
  - !ruby/object:Gem::Version
47
34
  version: '0'
48
- type: :development
35
+ type: :runtime
49
36
  prerelease: false
50
37
  version_requirements: !ruby/object:Gem::Requirement
51
38
  requirements:
@@ -58,30 +45,16 @@ dependencies:
58
45
  requirements:
59
46
  - - ~>
60
47
  - !ruby/object:Gem::Version
61
- version: '2.8'
48
+ version: 1.3.1
62
49
  type: :development
63
50
  prerelease: false
64
51
  version_requirements: !ruby/object:Gem::Requirement
65
52
  requirements:
66
53
  - - ~>
67
54
  - !ruby/object:Gem::Version
68
- version: '2.8'
55
+ version: 1.3.1
69
56
  - !ruby/object:Gem::Dependency
70
- name: rack-test
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
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
57
+ name: rake
85
58
  requirement: !ruby/object:Gem::Requirement
86
59
  requirements:
87
60
  - - '>='
@@ -94,29 +67,28 @@ dependencies:
94
67
  - - '>='
95
68
  - !ruby/object:Gem::Version
96
69
  version: '0'
97
- description: An alternative Survey Monkey strategy for OmniAuth that retrieves a long-term
98
- access token.
70
+ description: Survemonkey OAuth2 strategy for OmniAuth 1.0
99
71
  email:
72
+ - speak2kaushik@gmail.com
100
73
  - chris.beck@me.com
101
74
  executables: []
102
75
  extensions: []
103
76
  extra_rdoc_files: []
104
77
  files:
105
- - .gitignore
106
78
  - Gemfile
107
- - LICENSE.txt
79
+ - Gemfile.lock
80
+ - LICENSE
108
81
  - README.md
109
- - Rakefile
110
- - lib/omniauth-surveymonkey2.rb
111
- - lib/omniauth/strategies/surverymonkey2.rb
112
- - lib/omniauth/surveymonkey2/version.rb
113
- - omniauth-surveymonkey2.gemspec
114
- - spec/omniauth/strategies/surveymonkey2_spec.rb
115
- - spec/spec_helper.rb
116
- - spec/support/shared_examples.rb
117
- homepage: https://github.com/cbeck/omniauth-surveymonkey2
118
- licenses:
119
- - MIT
82
+ - init.rb
83
+ - lib/omniauth-surveymonkey.rb
84
+ - lib/omniauth/strategies/surveymonkey.rb
85
+ - lib/omniauth/surveymonkey.rb
86
+ - lib/omniauth/surveymonkey/version.rb
87
+ - omniauth-surveymonkey.gemspec
88
+ - omniauth-surveymonkey.rb
89
+ - spec/omniauth/strategies/surveymonkey_spec.rb
90
+ homepage: https://github.com/cbeck/omniauth-surveymonkey
91
+ licenses: []
120
92
  metadata: {}
121
93
  post_install_message:
122
94
  rdoc_options: []
@@ -137,9 +109,6 @@ rubyforge_project:
137
109
  rubygems_version: 2.1.5
138
110
  signing_key:
139
111
  specification_version: 4
140
- summary: STILL IN DEV. CHECK BACK SOON. An alternative Survey Monkey strategy for
141
- OmniAuth that retrieves a long-term access token.
112
+ summary: Survemonkey OAuth2 strategy for OmniAuth 1.0.
142
113
  test_files:
143
- - spec/omniauth/strategies/surveymonkey2_spec.rb
144
- - spec/spec_helper.rb
145
- - spec/support/shared_examples.rb
114
+ - spec/omniauth/strategies/surveymonkey_spec.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
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/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 Chris Beck
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1 +0,0 @@
1
- require_relative "omniauth/strategies/surveymonkey2"
@@ -1,15 +0,0 @@
1
- require 'omniauth/strategies/oauth2'
2
-
3
- module OmniAuth
4
- module Strategies
5
- class Surveymonkey2 < OmniAuth::Strategies::OAuth2
6
-
7
- DEFAULT_RESPONSE_TYPE = 'code'
8
- DEFAULT_GRANT = 'authorization_code'
9
-
10
- option :name, "surveymonkey"
11
-
12
-
13
- end
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- module Omniauth
2
- module Surveymonkey2
3
- VERSION = "0.0.6"
4
- end
5
- end
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- require File.expand_path('../lib/omniauth/surveymonkey2/version', __FILE__)
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "omniauth-surveymonkey2"
6
- spec.version = Omniauth::Surveymonkey2::VERSION
7
- spec.authors = ["Chris Beck"]
8
- spec.email = ["chris.beck@me.com"]
9
- spec.description = %q{An alternative Survey Monkey strategy for OmniAuth that retrieves a long-term access token.}
10
- spec.summary = %q{STILL IN DEV. CHECK BACK SOON. An alternative Survey Monkey strategy for OmniAuth that retrieves a long-term access token.}
11
- spec.homepage = "https://github.com/cbeck/omniauth-surveymonkey2"
12
- spec.license = "MIT"
13
-
14
- spec.files = `git ls-files`.split("\n")
15
- spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
- spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_runtime_dependency 'omniauth-oauth2'
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency 'rspec', '~> 2.8'
24
- spec.add_development_dependency 'rack-test'
25
- spec.add_development_dependency 'simplecov'
26
- end
data/spec/spec_helper.rb DELETED
@@ -1,15 +0,0 @@
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-surveymonkey2'
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
@@ -1,36 +0,0 @@
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