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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 929d1c23ce6c29dd2eaa4748d4e8e38307d292c1
4
- data.tar.gz: 6c9cff9903d99bf06a2048d900391d753d5473c3
3
+ metadata.gz: c363d7cfb0d2e9d549f4df63dcafdb50a71c1e88
4
+ data.tar.gz: 4a1260c79d1a5077104a84185c1da0caae06495a
5
5
  SHA512:
6
- metadata.gz: 6506eee946a19a98d592dade936308e789940c392b20f466ac7254e700cb7d8c466896b5cfab639179ce7f691a355b15602d38c7e6124384be057a721132a1bd
7
- data.tar.gz: 626ac0b305b02a55fa7261abd15be5d8cc53652f8d458d96811f7647c75a43331d9d4cb4480e6a1f5b225cd2f7a083944d35c4a520c9dd2e78758f9bc8abe435
6
+ metadata.gz: a2bec6eca8a9b4d6f718988e06988605232593c18b4eb2f341c153787b239ab4553c30b5cbdb39ebd79b29671f24ede4dbb45c1c5a186bbc3a62993818d2bdb6
7
+ data.tar.gz: a4c7112597e70985e71c37666143d9a5f725b599a1028cb3655ed64f33175d7f2361a0d4df5430c686c9914decfe0bed68db16385dd83b01ec4a2954766a800d
@@ -1,3 +1,3 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.3
3
+ - 2.0.0
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
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module ConstantContact2
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -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
- entries = raw_info['feed']['entry']
41
- if entries.kind_of?(Array)
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
- @raw_info ||= MultiXml.parse(access_token.get("https://api.constantcontact.com/ws/customers/#{request.params['username'].strip}/settings/emailaddresses").body)
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.should eq("https://oauth2.constantcontact.com")
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].should eq("/oauth2/oauth/siteowner/authorize")
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].should eq('/oauth2/oauth/token')
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.should eq('/auth/constantcontact/callback')
27
+ expect(subject.callback_path).to eq('/auth/constantcontact/callback')
28
28
  end
29
29
  end
30
30
  end
@@ -7,6 +7,8 @@ require 'rack/test'
7
7
  require 'omniauth'
8
8
  require 'omniauth-constantcontact2'
9
9
 
10
+ OmniAuth.config.test_mode = true
11
+
10
12
  Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
11
13
 
12
14
  RSpec.configure do |config|
@@ -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].should == 'https://example.com'
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'].should eq('bar')
16
- subject.authorize_params['baz'].should eq('zip')
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'].should eq('bar')
22
- subject.authorize_params['foo'].should eq('baz')
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'].should eq('bar')
30
- subject.token_params['baz'].should eq('zip')
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'].should eq('bar')
36
- subject.token_params['foo'].should eq('baz')
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.5
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-06-19 00:00:00.000000000 Z
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.2.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