constantcontact 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/constantcontact.gemspec +2 -2
- data/lib/constantcontact.rb +1 -0
- data/lib/constantcontact/api.rb +8 -0
- data/lib/constantcontact/components/activities/add_contacts.rb +1 -1
- data/lib/constantcontact/components/contacts/address.rb +1 -1
- data/lib/constantcontact/components/email_marketing/campaign.rb +2 -2
- data/lib/constantcontact/components/email_marketing/campaign_preview.rb +29 -0
- data/lib/constantcontact/services/email_marketing_service.rb +12 -0
- data/lib/constantcontact/util/config.rb +1 -0
- data/lib/constantcontact/version.rb +1 -1
- data/spec/constantcontact/api_spec.rb +14 -0
- data/spec/constantcontact/services/email_marketing_spec.rb +14 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9bdb8c678b4503bddf05f8aebb1ae8b0c36425d
|
4
|
+
data.tar.gz: 74a762fd6f5a6eda1d050af11f41729eb18592f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c30748e1c437d42217acd0f109152cfbe66a655f41d71821690db3b82547a7a18b03c6a428af1ddfdf832a1a3da4481992bd61d7d8670e9fabc5cebb6b60ba4f
|
7
|
+
data.tar.gz: 63c58d9f0520ea1d9f191e0aec12c52098d8d65779e8cee4cadc91e8ddad2a099d6f4b1c50a5b45f7ead77d081f478a11b28d61d022e1adca6e68943d419a421
|
data/README.md
CHANGED
data/constantcontact.gemspec
CHANGED
@@ -5,12 +5,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "constantcontact"
|
8
|
-
s.version = '2.
|
8
|
+
s.version = '2.2.0'
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.authors = ["ConstantContact"]
|
11
11
|
s.homepage = "http://www.constantcontact.com"
|
12
12
|
s.summary = %q{Constant Contact SDK for Ruby}
|
13
|
-
s.email = "
|
13
|
+
s.email = "webservices@constantcontact.com"
|
14
14
|
s.description = "Ruby library for interactions with Constant Contact v2 API"
|
15
15
|
s.license = "MIT"
|
16
16
|
|
data/lib/constantcontact.rb
CHANGED
@@ -39,6 +39,7 @@ module ConstantContact
|
|
39
39
|
autoload :Note, 'constantcontact/components/contacts/note'
|
40
40
|
autoload :ClickThroughDetails, 'constantcontact/components/email_marketing/click_through_details'
|
41
41
|
autoload :Campaign, 'constantcontact/components/email_marketing/campaign'
|
42
|
+
autoload :CampaignPreview, 'constantcontact/components/email_marketing/campaign_preview'
|
42
43
|
autoload :MessageFooter, 'constantcontact/components/email_marketing/message_footer'
|
43
44
|
autoload :Schedule, 'constantcontact/components/email_marketing/schedule'
|
44
45
|
autoload :TestSend, 'constantcontact/components/email_marketing/test_send'
|
data/lib/constantcontact/api.rb
CHANGED
@@ -191,6 +191,14 @@ module ConstantContact
|
|
191
191
|
end
|
192
192
|
|
193
193
|
|
194
|
+
# Get the preview of an existing campaign
|
195
|
+
# @param [Integer] campaign_id - Valid campaign id
|
196
|
+
# @return [CampaignPreview]
|
197
|
+
def get_email_campaign_preview(campaign_id)
|
198
|
+
Services::EmailMarketingService.get_campaign_preview(campaign_id)
|
199
|
+
end
|
200
|
+
|
201
|
+
|
194
202
|
# Delete an individual campaign
|
195
203
|
# @param [Mixed] campaign - Id of a campaign or a Campaign object
|
196
204
|
# @raise IllegalArgumentException - if a Campaign object or campaign id is not passed
|
@@ -7,7 +7,7 @@
|
|
7
7
|
module ConstantContact
|
8
8
|
module Components
|
9
9
|
class Address < Component
|
10
|
-
attr_accessor :id, :line1, :line2, :line3, :city, :address_type, :state_code,
|
10
|
+
attr_accessor :id, :line1, :line2, :line3, :city, :address_type, :state, :state_code,
|
11
11
|
:country_code, :postal_code, :sub_postal_code
|
12
12
|
|
13
13
|
# Factory method to create an Address object from a json string
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# campaign.rb
|
3
3
|
# ConstantContact
|
4
4
|
#
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
@@ -16,7 +16,7 @@ module ConstantContact
|
|
16
16
|
:click_through_details, :permalink_url
|
17
17
|
|
18
18
|
|
19
|
-
# Factory method to create
|
19
|
+
# Factory method to create a Campaign object from an array
|
20
20
|
# @param [Hash] props - properties to create object from
|
21
21
|
# @return [Campaign]
|
22
22
|
def self.create(props)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#
|
2
|
+
# campaign_preview.rb
|
3
|
+
# ConstantContact
|
4
|
+
#
|
5
|
+
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
|
+
|
7
|
+
module ConstantContact
|
8
|
+
module Components
|
9
|
+
class CampaignPreview < Component
|
10
|
+
attr_accessor :from_email, :preview_email_content, :preview_text_content,
|
11
|
+
:reply_to_email, :subject
|
12
|
+
|
13
|
+
|
14
|
+
# Factory method to create a CampaignPreview object from an array
|
15
|
+
# @param [Hash] props - properties to create object from
|
16
|
+
# @return [CampaignPreview]
|
17
|
+
def self.create(props)
|
18
|
+
obj = CampaignPreview.new
|
19
|
+
if props
|
20
|
+
props.each do |key, value|
|
21
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
22
|
+
end
|
23
|
+
end
|
24
|
+
obj
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -52,6 +52,18 @@ module ConstantContact
|
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
|
+
# Get the preview of the given campaign
|
56
|
+
# @param [Integer] campaign_id - Valid campaign id
|
57
|
+
# @return [CampaignPreview]
|
58
|
+
def get_campaign_preview(campaign_id)
|
59
|
+
url = Util::Config.get('endpoints.base_url') +
|
60
|
+
sprintf(Util::Config.get('endpoints.campaign_preview'), campaign_id)
|
61
|
+
url = build_url(url)
|
62
|
+
response = RestClient.get(url, get_headers())
|
63
|
+
Components::CampaignPreview.create(JSON.parse(response.body))
|
64
|
+
end
|
65
|
+
|
66
|
+
|
55
67
|
# Delete an email campaign
|
56
68
|
# @param [Integer] campaign_id - Valid campaign id
|
57
69
|
# @return [Boolean]
|
@@ -35,6 +35,7 @@ module ConstantContact
|
|
35
35
|
|
36
36
|
:campaigns => 'emailmarketing/campaigns',
|
37
37
|
:campaign => 'emailmarketing/campaigns/%s',
|
38
|
+
:campaign_preview => 'emailmarketing/campaigns/%s/preview',
|
38
39
|
:campaign_schedules => 'emailmarketing/campaigns/%s/schedules',
|
39
40
|
:campaign_schedule => 'emailmarketing/campaigns/%s/schedules/%s',
|
40
41
|
:campaign_test_sends => 'emailmarketing/campaigns/%s/tests',
|
@@ -729,6 +729,20 @@ describe ConstantContact::Api do
|
|
729
729
|
end
|
730
730
|
end
|
731
731
|
|
732
|
+
describe "#get_email_campaign_preview" do
|
733
|
+
it "gets the preview of an existing campaign" do
|
734
|
+
json_response = load_file('email_campaign_preview_response.json')
|
735
|
+
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
736
|
+
|
737
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
738
|
+
RestClient.stub(:get).and_return(response)
|
739
|
+
|
740
|
+
campaign_preview = @api.get_email_campaign_preview(1)
|
741
|
+
campaign_preview.should be_kind_of(ConstantContact::Components::CampaignPreview)
|
742
|
+
campaign_preview.subject.should eq('Subject Test')
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
732
746
|
describe "#add_email_campaign" do
|
733
747
|
it "creates a new campaign" do
|
734
748
|
json = load_file('email_campaign_response.json')
|
@@ -40,6 +40,20 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
describe "#get_campaign_preview" do
|
44
|
+
it "gets the preview of the given campaign" do
|
45
|
+
json_response = load_file('email_campaign_preview_response.json')
|
46
|
+
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
47
|
+
|
48
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
49
|
+
RestClient.stub(:get).and_return(response)
|
50
|
+
|
51
|
+
campaign_preview = ConstantContact::Services::EmailMarketingService.get_campaign_preview(1)
|
52
|
+
campaign_preview.should be_kind_of(ConstantContact::Components::CampaignPreview)
|
53
|
+
campaign_preview.subject.should eq('Subject Test')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
43
57
|
describe "#add_campaign" do
|
44
58
|
it "adds a campaign" do
|
45
59
|
json = load_file('email_campaign_response.json')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constantcontact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ConstantContact
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -85,7 +85,7 @@ dependencies:
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '2.14'
|
87
87
|
description: Ruby library for interactions with Constant Contact v2 API
|
88
|
-
email:
|
88
|
+
email: webservices@constantcontact.com
|
89
89
|
executables: []
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/constantcontact/components/contacts/email_address.rb
|
114
114
|
- lib/constantcontact/components/contacts/note.rb
|
115
115
|
- lib/constantcontact/components/email_marketing/campaign.rb
|
116
|
+
- lib/constantcontact/components/email_marketing/campaign_preview.rb
|
116
117
|
- lib/constantcontact/components/email_marketing/click_through_details.rb
|
117
118
|
- lib/constantcontact/components/email_marketing/message_footer.rb
|
118
119
|
- lib/constantcontact/components/email_marketing/schedule.rb
|