omniauth-mailchimp 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +0 -18
- data/examples/config.ru +9 -6
- data/lib/omniauth/mailchimp/version.rb +1 -1
- data/lib/omniauth/strategies/mailchimp.rb +0 -1
- data/spec/omniauth/.DS_Store +0 -0
- data/spec/omniauth/strategies/mailchimp_spec.rb +23 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared_examples.rb +37 -0
- metadata +19 -11
data/Gemfile.lock
CHANGED
@@ -8,29 +8,14 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (3.1.1)
|
12
|
-
multi_json (~> 1.0)
|
13
11
|
addressable (2.2.6)
|
14
12
|
diff-lcs (1.1.3)
|
15
13
|
faraday (0.7.5)
|
16
14
|
addressable (~> 2.2.6)
|
17
15
|
multipart-post (~> 1.1.3)
|
18
16
|
rack (>= 1.1.0, < 2)
|
19
|
-
gibbon (0.3.1)
|
20
|
-
activesupport (>= 2.3.14)
|
21
|
-
activesupport (>= 2.3.14)
|
22
|
-
httparty (> 0.6.0)
|
23
|
-
httparty (> 0.6.0)
|
24
|
-
json (> 1.4.0)
|
25
|
-
json (> 1.4.0)
|
26
|
-
rdoc
|
27
17
|
hashie (1.2.0)
|
28
|
-
httparty (0.8.1)
|
29
|
-
multi_json
|
30
|
-
multi_xml
|
31
|
-
json (1.6.1)
|
32
18
|
multi_json (1.0.4)
|
33
|
-
multi_xml (0.3.0)
|
34
19
|
multipart-post (1.1.4)
|
35
20
|
oauth2 (0.5.1)
|
36
21
|
faraday (~> 0.7.4)
|
@@ -45,8 +30,6 @@ GEM
|
|
45
30
|
rack-protection (1.1.4)
|
46
31
|
rack
|
47
32
|
rake (0.9.2.2)
|
48
|
-
rdoc (3.11)
|
49
|
-
json (~> 1.4)
|
50
33
|
rspec (2.6.0)
|
51
34
|
rspec-core (~> 2.6.0)
|
52
35
|
rspec-expectations (~> 2.6.0)
|
@@ -65,7 +48,6 @@ PLATFORMS
|
|
65
48
|
ruby
|
66
49
|
|
67
50
|
DEPENDENCIES
|
68
|
-
gibbon
|
69
51
|
omniauth-mailchimp!
|
70
52
|
rake
|
71
53
|
rspec (~> 2.6.0)
|
data/examples/config.ru
CHANGED
@@ -6,9 +6,14 @@ require 'omniauth-mailchimp'
|
|
6
6
|
|
7
7
|
get '/' do
|
8
8
|
<<-HTML
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
<div>
|
10
|
+
Your credentials are :
|
11
|
+
<ul>
|
12
|
+
<li>client id : #{ENV["MC_KEY"]}</li>
|
13
|
+
<li>secret key : #{ENV["MC_SECRET"]}</li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<a href='/auth/mailchimp'>Sign in with MailChimp</a>
|
12
17
|
HTML
|
13
18
|
end
|
14
19
|
|
@@ -28,6 +33,4 @@ use Rack::Session::Cookie, :secret => ENV['RACK_COOKIE_SECRET']
|
|
28
33
|
|
29
34
|
use OmniAuth::Builder do
|
30
35
|
provider :mailchimp, ENV["MC_KEY"], ENV["MC_SECRET"]
|
31
|
-
end
|
32
|
-
|
33
|
-
#run App.new
|
36
|
+
end
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-mailchimp'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Mailchimp do
|
5
|
+
before :each do
|
6
|
+
@request = double('Request')
|
7
|
+
@request.stub(:params) { {} }
|
8
|
+
end
|
9
|
+
|
10
|
+
subject do
|
11
|
+
OmniAuth::Strategies::Mailchimp.new(nil, @options || {}).tap do |strategy|
|
12
|
+
strategy.stub(:request) { @request }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like 'an oauth2 strategy'
|
17
|
+
|
18
|
+
describe '#client' do
|
19
|
+
it 'has correct MailChimp site' do
|
20
|
+
subject.client.site.should eq('https://login.mailchimp.com')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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 => 'http://bar', :foo => 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('http://bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'should include any token params passed in the :token_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 :token_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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &70341852345780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70341852345780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: omniauth-oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &70341852343840 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70341852343840
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70341852343320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.6.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70341852343320
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70341852342900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70341852342900
|
58
58
|
description: MailChimp OAuth2 strategy for OmniAuth 1.0
|
59
59
|
email:
|
60
60
|
- florian.mhun@gmail.com
|
@@ -74,6 +74,10 @@ files:
|
|
74
74
|
- lib/omniauth/mailchimp/version.rb
|
75
75
|
- lib/omniauth/strategies/mailchimp.rb
|
76
76
|
- omniauth-mailchimp.gemspec
|
77
|
+
- spec/omniauth/.DS_Store
|
78
|
+
- spec/omniauth/strategies/mailchimp_spec.rb
|
79
|
+
- spec/spec_helper.rb
|
80
|
+
- spec/support/shared_examples.rb
|
77
81
|
homepage: http://floomoon.org/project/omniauth-mailchimp
|
78
82
|
licenses: []
|
79
83
|
post_install_message:
|
@@ -98,4 +102,8 @@ rubygems_version: 1.8.10
|
|
98
102
|
signing_key:
|
99
103
|
specification_version: 3
|
100
104
|
summary: MailChimp OAuth2 strategy for OmniAuth 1.0.
|
101
|
-
test_files:
|
105
|
+
test_files:
|
106
|
+
- spec/omniauth/.DS_Store
|
107
|
+
- spec/omniauth/strategies/mailchimp_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/support/shared_examples.rb
|