omniauth-constantcontact2 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +2 -0
- data/lib/omniauth-constantcontact2/version.rb +1 -1
- data/lib/omniauth/strategies/constantcontact2.rb +9 -11
- data/omniauth-constantcontact2.gemspec +0 -1
- data/spec/omniauth/strategies/constantcontact2_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples.rb +9 -9
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c363d7cfb0d2e9d549f4df63dcafdb50a71c1e88
|
4
|
+
data.tar.gz: 4a1260c79d1a5077104a84185c1da0caae06495a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2bec6eca8a9b4d6f718988e06988605232593c18b4eb2f341c153787b239ab4553c30b5cbdb39ebd79b29671f24ede4dbb45c1c5a186bbc3a62993818d2bdb6
|
7
|
+
data.tar.gz: a4c7112597e70985e71c37666143d9a5f725b599a1028cb3655ed64f33175d7f2361a0d4df5430c686c9914decfe0bed68db16385dd83b01ec4a2954766a800d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Omniauth::ConstantContact2
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/asanghi/omniauth-constantcontact2.svg?branch=master)](https://travis-ci.org/asanghi/omniauth-constantcontact2)
|
4
|
+
|
3
5
|
This gem is an OmniAuth 2.0 Strategy for the [ConstantContact API](http://http://community.constantcontact.com/t5/Documentation/Authentication-using-OAuth-2-0-new-October-2011/ba-p/38313)
|
4
6
|
|
5
7
|
It supports the OmniAuth REST API which uses OAuth 2.0
|
@@ -8,6 +8,7 @@ module OmniAuth
|
|
8
8
|
|
9
9
|
DEFAULT_RESPONSE_TYPE = 'code'
|
10
10
|
DEFAULT_GRANT = 'authorization_code'
|
11
|
+
API_PATH = 'https://api.constantcontact.com/v2'
|
11
12
|
|
12
13
|
option :name, "constantcontact"
|
13
14
|
|
@@ -37,16 +38,9 @@ module OmniAuth
|
|
37
38
|
end
|
38
39
|
|
39
40
|
info do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
:email_entries => entries.map{|x|x["content"]["Email"]["EmailAddress"]}
|
44
|
-
}
|
45
|
-
else
|
46
|
-
{
|
47
|
-
:email => entries["content"]["Email"]["EmailAddress"]
|
48
|
-
}
|
49
|
-
end
|
41
|
+
{
|
42
|
+
email: raw_info['email']
|
43
|
+
}
|
50
44
|
end
|
51
45
|
|
52
46
|
extra do
|
@@ -54,7 +48,11 @@ module OmniAuth
|
|
54
48
|
end
|
55
49
|
|
56
50
|
def raw_info
|
57
|
-
|
51
|
+
options = {
|
52
|
+
params: {api_key: client.id},
|
53
|
+
headers: {'Authorization' => "Bearer #{access_token.token}"}
|
54
|
+
}
|
55
|
+
@raw_info ||= JSON.parse(access_token.get("#{API_PATH}/account/info", options).body)
|
58
56
|
end
|
59
57
|
end
|
60
58
|
end
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency 'omniauth', '~> 1.0'
|
19
19
|
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
20
20
|
gem.add_dependency 'multi_json', '~> 1.0'
|
21
|
-
gem.add_dependency 'multi_xml'
|
22
21
|
|
23
22
|
gem.add_development_dependency 'rake'
|
24
23
|
gem.add_development_dependency 'rspec', '~> 2.8'
|
@@ -10,21 +10,21 @@ describe OmniAuth::Strategies::ConstantContact2 do
|
|
10
10
|
|
11
11
|
describe '#client' do
|
12
12
|
it 'should have the correct Constant Contact site' do
|
13
|
-
subject.client.site.
|
13
|
+
expect(subject.client.site).to eq("https://oauth2.constantcontact.com")
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should have the correct authorization url' do
|
17
|
-
subject.client.options[:authorize_url].
|
17
|
+
expect(subject.client.options[:authorize_url]).to eq("/oauth2/oauth/siteowner/authorize")
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should have the correct token url' do
|
21
|
-
subject.client.options[:token_url].
|
21
|
+
expect(subject.client.options[:token_url]).to eq('/oauth2/oauth/token')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#callback_path' do
|
26
26
|
it 'should have the correct callback path' do
|
27
|
-
subject.callback_path.
|
27
|
+
expect(subject.callback_path).to eq('/auth/constantcontact/callback')
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,35 +5,35 @@ shared_examples 'an oauth2 strategy' do
|
|
5
5
|
describe '#client' do
|
6
6
|
it 'should be initialized with symbolized client_options' do
|
7
7
|
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
8
|
-
subject.client.options[:authorize_url].
|
8
|
+
expect(subject.client.options[:authorize_url]).to eq('https://example.com')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#authorize_params' do
|
13
13
|
it 'should include any authorize params passed in the :authorize_params option' do
|
14
14
|
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
15
|
-
subject.authorize_params['foo'].
|
16
|
-
subject.authorize_params['baz'].
|
15
|
+
expect(subject.authorize_params['foo']).to eq('bar')
|
16
|
+
expect(subject.authorize_params['baz']).to eq('zip')
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should include top-level options that are marked as :authorize_options' do
|
20
20
|
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
21
|
-
subject.authorize_params['scope'].
|
22
|
-
subject.authorize_params['foo'].
|
21
|
+
expect(subject.authorize_params['scope']).to eq('bar')
|
22
|
+
expect(subject.authorize_params['foo']).to eq('baz')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#token_params' do
|
27
27
|
it 'should include any token params passed in the :token_params option' do
|
28
28
|
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
29
|
-
subject.token_params['foo'].
|
30
|
-
subject.token_params['baz'].
|
29
|
+
expect(subject.token_params['foo']).to eq('bar')
|
30
|
+
expect(subject.token_params['baz']).to eq('zip')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should include top-level options that are marked as :token_options' do
|
34
34
|
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
35
|
-
subject.token_params['scope'].
|
36
|
-
subject.token_params['foo'].
|
35
|
+
expect(subject.token_params['scope']).to eq('bar')
|
36
|
+
expect(subject.token_params['foo']).to eq('baz')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-constantcontact2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditya Sanghi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: multi_xml
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
148
|
version: '0'
|
163
149
|
requirements: []
|
164
150
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.4.8
|
166
152
|
signing_key:
|
167
153
|
specification_version: 4
|
168
154
|
summary: OmniAuth Strategy for Constant Contact using OAuth2
|