constantcontact 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/README.md +56 -1
- data/constantcontact.gemspec +1 -1
- data/lib/constantcontact/api.rb +111 -97
- data/lib/constantcontact/services/account_service.rb +20 -22
- data/lib/constantcontact/services/activity_service.rb +98 -100
- data/lib/constantcontact/services/base_service.rb +46 -44
- data/lib/constantcontact/services/campaign_schedule_service.rb +72 -74
- data/lib/constantcontact/services/campaign_tracking_service.rb +103 -105
- data/lib/constantcontact/services/contact_service.rb +73 -75
- data/lib/constantcontact/services/contact_tracking_service.rb +103 -105
- data/lib/constantcontact/services/email_marketing_service.rb +64 -66
- data/lib/constantcontact/services/event_spot_service.rb +356 -358
- data/lib/constantcontact/services/library_service.rb +228 -230
- data/lib/constantcontact/services/list_service.rb +55 -57
- data/lib/constantcontact/version.rb +1 -1
- data/spec/constantcontact/api_spec.rb +2 -4
- data/spec/constantcontact/services/account_service_spec.rb +3 -2
- data/spec/constantcontact/services/activity_service_spec.rb +10 -9
- data/spec/constantcontact/services/base_service_spec.rb +7 -5
- data/spec/constantcontact/services/campaign_schedule_service_spec.rb +7 -6
- data/spec/constantcontact/services/campaign_tracking_service_spec.rb +8 -7
- data/spec/constantcontact/services/contact_service_spec.rb +8 -7
- data/spec/constantcontact/services/contact_tracking_service_spec.rb +8 -7
- data/spec/constantcontact/services/email_marketing_spec.rb +7 -6
- data/spec/constantcontact/services/event_spot_spec.rb +28 -27
- data/spec/constantcontact/services/library_service_spec.rb +17 -16
- data/spec/constantcontact/services/list_service_spec.rb +6 -5
- metadata +20 -20
@@ -7,75 +7,73 @@
|
|
7
7
|
module ConstantContact
|
8
8
|
module Services
|
9
9
|
class ListService < BaseService
|
10
|
-
class << self
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
lists
|
11
|
+
# Get lists within an account
|
12
|
+
# @param [Hash] params - query parameters to be appended to the request
|
13
|
+
# @return [Array<ContactList>]
|
14
|
+
def get_lists(params = {})
|
15
|
+
url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')
|
16
|
+
url = build_url(url, params)
|
17
|
+
response = RestClient.get(url, get_headers())
|
18
|
+
lists = []
|
19
|
+
JSON.parse(response.body).each do |contact|
|
20
|
+
lists << Components::ContactList.create(contact)
|
24
21
|
end
|
22
|
+
lists
|
23
|
+
end
|
25
24
|
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
# Add a new list to the Constant Contact account
|
27
|
+
# @param [ContactList] list
|
28
|
+
# @return [ContactList]
|
29
|
+
def add_list(list)
|
30
|
+
url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')
|
31
|
+
url = build_url(url)
|
32
|
+
payload = list.to_json
|
33
|
+
response = RestClient.post(url, payload, get_headers())
|
34
|
+
Components::ContactList.create(JSON.parse(response.body))
|
35
|
+
end
|
37
36
|
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
38
|
+
# Update a Contact List
|
39
|
+
# @param [ContactList] list - ContactList to be updated
|
40
|
+
# @return [ContactList]
|
41
|
+
def update_list(list)
|
42
|
+
url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)
|
43
|
+
url = build_url(url)
|
44
|
+
payload = list.to_json
|
45
|
+
response = RestClient.put(url, payload, get_headers())
|
46
|
+
Components::ContactList.create(JSON.parse(response.body))
|
47
|
+
end
|
49
48
|
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
# Get an individual contact list
|
51
|
+
# @param [Integer] list_id - list id
|
52
|
+
# @return [ContactList]
|
53
|
+
def get_list(list_id)
|
54
|
+
url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)
|
55
|
+
url = build_url(url)
|
56
|
+
response = RestClient.get(url, get_headers())
|
57
|
+
Components::ContactList.create(JSON.parse(response.body))
|
58
|
+
end
|
60
59
|
|
61
60
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
Components::ResultSet.new(contacts, body['meta'])
|
61
|
+
# Get all contacts from an individual list
|
62
|
+
# @param [Integer] list_id - list id to retrieve contacts for
|
63
|
+
# @param [Hash] params - query parameters to attach to request
|
64
|
+
# @return [Array<Contact>]
|
65
|
+
def get_contacts_from_list(list_id, params = nil)
|
66
|
+
url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list_contacts'), list_id)
|
67
|
+
url = build_url(url, params)
|
68
|
+
response = RestClient.get(url, get_headers())
|
69
|
+
contacts = []
|
70
|
+
body = JSON.parse(response.body)
|
71
|
+
body['results'].each do |contact|
|
72
|
+
contacts << Components::Contact.create(contact)
|
76
73
|
end
|
77
|
-
|
74
|
+
Components::ResultSet.new(contacts, body['meta'])
|
78
75
|
end
|
76
|
+
|
79
77
|
end
|
80
78
|
end
|
81
79
|
end
|
@@ -30,7 +30,6 @@ describe ConstantContact::Api do
|
|
30
30
|
|
31
31
|
context "with middle-ware configuration" do
|
32
32
|
before(:all) do
|
33
|
-
ConstantContact::Services::BaseService.api_key = nil
|
34
33
|
ConstantContact::Util::Config.configure do |config|
|
35
34
|
config[:auth][:api_key] = "config_api_key"
|
36
35
|
config[:auth][:api_secret] = "config_api_secret"
|
@@ -42,13 +41,12 @@ describe ConstantContact::Api do
|
|
42
41
|
proc.should raise_error(ArgumentError, ConstantContact::Util::Config.get('errors.access_token_missing'))
|
43
42
|
end
|
44
43
|
it "has the correct implicit api key" do
|
45
|
-
ConstantContact::
|
44
|
+
ConstantContact::Api.new(nil, "access_token").api_key.should == "config_api_key"
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
49
48
|
context "with middle-ware configuration" do
|
50
49
|
before(:all) do
|
51
|
-
ConstantContact::Services::BaseService.api_key = nil
|
52
50
|
ConstantContact::Util::Config.configure do |config|
|
53
51
|
config[:auth][:api_key] = "config_api_key"
|
54
52
|
config[:auth][:api_secret] = "config_api_secret"
|
@@ -57,7 +55,7 @@ describe ConstantContact::Api do
|
|
57
55
|
ConstantContact::Api.new('explicit_api_key', 'access_token')
|
58
56
|
end
|
59
57
|
it "has the correct explicit api key" do
|
60
|
-
ConstantContact::
|
58
|
+
ConstantContact::Api.new('explicit_api_key', "access_token").api_key.should == "explicit_api_key"
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
@@ -9,6 +9,7 @@ require 'spec_helper'
|
|
9
9
|
describe ConstantContact::Services::AccountService do
|
10
10
|
before(:each) do
|
11
11
|
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
@client = ConstantContact::Api.new('explicit_api_key', "access_token")
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "#get_account_info" do
|
@@ -19,7 +20,7 @@ describe ConstantContact::Services::AccountService do
|
|
19
20
|
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
20
21
|
RestClient.stub(:get).and_return(response)
|
21
22
|
|
22
|
-
result = ConstantContact::Services::AccountService.get_account_info()
|
23
|
+
result = ConstantContact::Services::AccountService.new(@client).get_account_info()
|
23
24
|
result.should be_kind_of(ConstantContact::Components::AccountInfo)
|
24
25
|
result.website.should eq('http://www.example.com')
|
25
26
|
result.organization_addresses.first.should be_kind_of(ConstantContact::Components::AccountAddress)
|
@@ -36,7 +37,7 @@ describe ConstantContact::Services::AccountService do
|
|
36
37
|
RestClient.stub(:get).and_return(response)
|
37
38
|
|
38
39
|
params = {}
|
39
|
-
email_addresses = ConstantContact::Services::AccountService.get_verified_email_addresses(params)
|
40
|
+
email_addresses = ConstantContact::Services::AccountService.new(@client).get_verified_email_addresses(params)
|
40
41
|
|
41
42
|
email_addresses.should be_kind_of(Array)
|
42
43
|
email_addresses.first.should be_kind_of(ConstantContact::Components::VerifiedEmailAddress)
|
@@ -9,6 +9,7 @@ require 'spec_helper'
|
|
9
9
|
describe ConstantContact::Services::ActivityService do
|
10
10
|
before(:each) do
|
11
11
|
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
@client = ConstantContact::Api.new('explicit_api_key', "access_token")
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "#get_activities" do
|
@@ -19,7 +20,7 @@ describe ConstantContact::Services::ActivityService do
|
|
19
20
|
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
20
21
|
RestClient.stub(:get).and_return(response)
|
21
22
|
|
22
|
-
activities = ConstantContact::Services::ActivityService.get_activities()
|
23
|
+
activities = ConstantContact::Services::ActivityService.new(@client).get_activities()
|
23
24
|
activities.first.should be_kind_of(ConstantContact::Components::Activity)
|
24
25
|
activities.first.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
25
26
|
end
|
@@ -33,7 +34,7 @@ describe ConstantContact::Services::ActivityService do
|
|
33
34
|
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
34
35
|
RestClient.stub(:get).and_return(response)
|
35
36
|
|
36
|
-
activity = ConstantContact::Services::ActivityService.get_activity('a07e1ilbm7shdg6ikeo')
|
37
|
+
activity = ConstantContact::Services::ActivityService.new(@client).get_activity('a07e1ilbm7shdg6ikeo')
|
37
38
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
38
39
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
39
40
|
end
|
@@ -123,7 +124,7 @@ describe ConstantContact::Services::ActivityService do
|
|
123
124
|
|
124
125
|
JSON.parse(json_request).should eq(JSON.parse(JSON.generate(add_contact)))
|
125
126
|
|
126
|
-
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity(add_contact)
|
127
|
+
activity = ConstantContact::Services::ActivityService.new(@client).create_add_contacts_activity(add_contact)
|
127
128
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
128
129
|
activity.type.should eq('ADD_CONTACTS')
|
129
130
|
end
|
@@ -139,7 +140,7 @@ describe ConstantContact::Services::ActivityService do
|
|
139
140
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
140
141
|
RestClient.stub(:post).and_return(response)
|
141
142
|
|
142
|
-
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity_from_file(
|
143
|
+
activity = ConstantContact::Services::ActivityService.new(@client).create_add_contacts_activity_from_file(
|
143
144
|
'contacts.txt', content, lists)
|
144
145
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
145
146
|
activity.type.should eq('ADD_CONTACTS')
|
@@ -159,7 +160,7 @@ describe ConstantContact::Services::ActivityService do
|
|
159
160
|
response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request)
|
160
161
|
RestClient.stub(:post).and_return(response)
|
161
162
|
|
162
|
-
activity = ConstantContact::Services::ActivityService.add_clear_lists_activity(lists)
|
163
|
+
activity = ConstantContact::Services::ActivityService.new(@client).add_clear_lists_activity(lists)
|
163
164
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
164
165
|
activity.type.should eq('CLEAR_CONTACTS_FROM_LISTS')
|
165
166
|
end
|
@@ -175,7 +176,7 @@ describe ConstantContact::Services::ActivityService do
|
|
175
176
|
RestClient.stub(:post).and_return(response)
|
176
177
|
email_addresses = ["djellesma@constantcontact.com"]
|
177
178
|
|
178
|
-
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity(
|
179
|
+
activity = ConstantContact::Services::ActivityService.new(@client).add_remove_contacts_from_lists_activity(
|
179
180
|
email_addresses, lists)
|
180
181
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
181
182
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
@@ -192,7 +193,7 @@ describe ConstantContact::Services::ActivityService do
|
|
192
193
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
193
194
|
RestClient.stub(:post).and_return(response)
|
194
195
|
|
195
|
-
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(
|
196
|
+
activity = ConstantContact::Services::ActivityService.new(@client).add_remove_contacts_from_lists_activity_from_file(
|
196
197
|
'contacts.txt', content, lists)
|
197
198
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
198
199
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
@@ -210,7 +211,7 @@ describe ConstantContact::Services::ActivityService do
|
|
210
211
|
|
211
212
|
export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request))
|
212
213
|
|
213
|
-
activity = ConstantContact::Services::ActivityService.add_export_contacts_activity(export_contacts)
|
214
|
+
activity = ConstantContact::Services::ActivityService.new(@client).add_export_contacts_activity(export_contacts)
|
214
215
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
215
216
|
activity.type.should eq('EXPORT_CONTACTS')
|
216
217
|
end
|
@@ -237,7 +238,7 @@ describe ConstantContact::Services::ActivityService do
|
|
237
238
|
end
|
238
239
|
end
|
239
240
|
|
240
|
-
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity(email_addresses, lists)
|
241
|
+
activity = ConstantContact::Services::ActivityService.new(@client).add_remove_contacts_from_lists_activity(email_addresses, lists)
|
241
242
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
242
243
|
end
|
243
244
|
end
|
@@ -7,11 +7,13 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::BaseService do
|
10
|
+
before(:each) {
|
11
|
+
@client = ConstantContact::Api.new('api key', "foo")
|
12
|
+
}
|
10
13
|
describe "#get_headers" do
|
11
14
|
it "gets a hash of headers" do
|
12
15
|
token = 'foo'
|
13
|
-
ConstantContact::Services::BaseService.
|
14
|
-
headers = ConstantContact::Services::BaseService.send(:get_headers)
|
16
|
+
headers = ConstantContact::Services::BaseService.new(@client).send(:get_headers)
|
15
17
|
|
16
18
|
expect(headers).to be_a Hash
|
17
19
|
expect(headers[:content_type]).to be_a String
|
@@ -30,7 +32,7 @@ describe ConstantContact::Services::BaseService do
|
|
30
32
|
|
31
33
|
describe "#build_url" do
|
32
34
|
it "combines all the given parameters into the url" do
|
33
|
-
components = ConstantContact::Services::BaseService.send(:build_url, "http://testing.com", :arg1 => 'abc', :arg2 => 123).split('&')
|
35
|
+
components = ConstantContact::Services::BaseService.new(@client).send(:build_url, "http://testing.com", :arg1 => 'abc', :arg2 => 123).split('&')
|
34
36
|
expect(components[0]).to eq('http://testing.com?api_key=api+key')
|
35
37
|
expect(components.length).to eq(3)
|
36
38
|
expect(components.include?('arg1=abc')).to be_true
|
@@ -38,12 +40,12 @@ describe ConstantContact::Services::BaseService do
|
|
38
40
|
end
|
39
41
|
|
40
42
|
it "does not parse the next param when not in next_link format" do
|
41
|
-
url = ConstantContact::Services::BaseService.send(:build_url, "http://testing.com", :next => "abcdef")
|
43
|
+
url = ConstantContact::Services::BaseService.new(@client).send(:build_url, "http://testing.com", :next => "abcdef")
|
42
44
|
expect(url).to eq('http://testing.com?api_key=api+key&next=abcdef')
|
43
45
|
end
|
44
46
|
|
45
47
|
it "parses next id from next param given in next_link format" do
|
46
|
-
url = ConstantContact::Services::BaseService.send(:build_url, "http://testing.com", :next => "/some/path?next=abcdefg")
|
48
|
+
url = ConstantContact::Services::BaseService.new(@client).send(:build_url, "http://testing.com", :next => "/some/path?next=abcdefg")
|
47
49
|
expect(url).to eq('http://testing.com?api_key=api+key&next=abcdefg')
|
48
50
|
end
|
49
51
|
end
|
@@ -9,6 +9,7 @@ require 'spec_helper'
|
|
9
9
|
describe ConstantContact::Services::CampaignScheduleService do
|
10
10
|
before(:each) do
|
11
11
|
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
@client = ConstantContact::Api.new('explicit_api_key', "access_token")
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "#add_schedule" do
|
@@ -21,7 +22,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
21
22
|
RestClient.stub(:post).and_return(response)
|
22
23
|
new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
23
24
|
|
24
|
-
schedule = ConstantContact::Services::CampaignScheduleService.add_schedule(
|
25
|
+
schedule = ConstantContact::Services::CampaignScheduleService.new(@client).add_schedule(
|
25
26
|
campaign_id, new_schedule)
|
26
27
|
schedule.should be_kind_of(ConstantContact::Components::Schedule)
|
27
28
|
schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
@@ -37,7 +38,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
37
38
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
38
39
|
RestClient.stub(:get).and_return(response)
|
39
40
|
|
40
|
-
schedules = ConstantContact::Services::CampaignScheduleService.get_schedules(
|
41
|
+
schedules = ConstantContact::Services::CampaignScheduleService.new(@client).get_schedules(
|
41
42
|
campaign_id)
|
42
43
|
schedules.first.should be_kind_of(ConstantContact::Components::Schedule)
|
43
44
|
schedules.first.scheduled_date.should eq('2012-12-16T11:07:43.626Z')
|
@@ -55,7 +56,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
55
56
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
56
57
|
RestClient.stub(:get).and_return(response)
|
57
58
|
|
58
|
-
schedule = ConstantContact::Services::CampaignScheduleService.get_schedule(
|
59
|
+
schedule = ConstantContact::Services::CampaignScheduleService.new(@client).get_schedule(
|
59
60
|
campaign_id, schedule_id)
|
60
61
|
schedule.should be_kind_of(ConstantContact::Components::Schedule)
|
61
62
|
schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
@@ -71,7 +72,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
71
72
|
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
72
73
|
RestClient.stub(:delete).and_return(response)
|
73
74
|
|
74
|
-
result = ConstantContact::Services::CampaignScheduleService.delete_schedule(
|
75
|
+
result = ConstantContact::Services::CampaignScheduleService.new(@client).delete_schedule(
|
75
76
|
campaign_id, schedule_id)
|
76
77
|
result.should be_true
|
77
78
|
end
|
@@ -87,7 +88,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
87
88
|
RestClient.stub(:put).and_return(response)
|
88
89
|
schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
89
90
|
|
90
|
-
result = ConstantContact::Services::CampaignScheduleService.update_schedule(
|
91
|
+
result = ConstantContact::Services::CampaignScheduleService.new(@client).update_schedule(
|
91
92
|
campaign_id, schedule)
|
92
93
|
result.should be_kind_of(ConstantContact::Components::Schedule)
|
93
94
|
result.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
@@ -105,7 +106,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
105
106
|
RestClient.stub(:post).and_return(response)
|
106
107
|
test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request))
|
107
108
|
|
108
|
-
result = ConstantContact::Services::CampaignScheduleService.send_test(
|
109
|
+
result = ConstantContact::Services::CampaignScheduleService.new(@client).send_test(
|
109
110
|
campaign_id, test_send)
|
110
111
|
result.should be_kind_of(ConstantContact::Components::TestSend)
|
111
112
|
result.personal_message.should eq('This is a test send of the email campaign message.')
|
@@ -9,6 +9,7 @@ require 'spec_helper'
|
|
9
9
|
describe ConstantContact::Services::CampaignTrackingService do
|
10
10
|
before(:each) do
|
11
11
|
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
@client = ConstantContact::Api.new('explicit_api_key', "access_token")
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "#get_bounces" do
|
@@ -21,7 +22,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
21
22
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
22
23
|
RestClient.stub(:get).and_return(response)
|
23
24
|
|
24
|
-
set = ConstantContact::Services::CampaignTrackingService.get_bounces(campaign_id, params)
|
25
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_bounces(campaign_id, params)
|
25
26
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
26
27
|
set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity)
|
27
28
|
set.results.first.activity_type.should eq('EMAIL_BOUNCE')
|
@@ -38,7 +39,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
38
39
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
39
40
|
RestClient.stub(:get).and_return(response)
|
40
41
|
|
41
|
-
set = ConstantContact::Services::CampaignTrackingService.get_clicks(campaign_id, params)
|
42
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_clicks(campaign_id, params)
|
42
43
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
43
44
|
set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity)
|
44
45
|
set.results.first.activity_type.should eq('EMAIL_CLICK')
|
@@ -55,7 +56,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
55
56
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
56
57
|
RestClient.stub(:get).and_return(response)
|
57
58
|
|
58
|
-
set = ConstantContact::Services::CampaignTrackingService.get_forwards(campaign_id, params)
|
59
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_forwards(campaign_id, params)
|
59
60
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
60
61
|
set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity)
|
61
62
|
set.results.first.activity_type.should eq('EMAIL_FORWARD')
|
@@ -72,7 +73,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
72
73
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
73
74
|
RestClient.stub(:get).and_return(response)
|
74
75
|
|
75
|
-
set = ConstantContact::Services::CampaignTrackingService.get_opens(campaign_id, params)
|
76
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_opens(campaign_id, params)
|
76
77
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
77
78
|
set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity)
|
78
79
|
set.results.first.activity_type.should eq('EMAIL_OPEN')
|
@@ -89,7 +90,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
89
90
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
90
91
|
RestClient.stub(:get).and_return(response)
|
91
92
|
|
92
|
-
set = ConstantContact::Services::CampaignTrackingService.get_sends(campaign_id, params)
|
93
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_sends(campaign_id, params)
|
93
94
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
94
95
|
set.results.first.should be_kind_of(ConstantContact::Components::SendActivity)
|
95
96
|
set.results.first.activity_type.should eq('EMAIL_SEND')
|
@@ -106,7 +107,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
106
107
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
107
108
|
RestClient.stub(:get).and_return(response)
|
108
109
|
|
109
|
-
set = ConstantContact::Services::CampaignTrackingService.get_unsubscribes(campaign_id, params)
|
110
|
+
set = ConstantContact::Services::CampaignTrackingService.new(@client).get_unsubscribes(campaign_id, params)
|
110
111
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
111
112
|
set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity)
|
112
113
|
set.results.first.activity_type.should eq('EMAIL_UNSUBSCRIBE')
|
@@ -122,7 +123,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
122
123
|
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
123
124
|
RestClient.stub(:get).and_return(response)
|
124
125
|
|
125
|
-
summary = ConstantContact::Services::CampaignTrackingService.get_summary(campaign_id)
|
126
|
+
summary = ConstantContact::Services::CampaignTrackingService.new(@client).get_summary(campaign_id)
|
126
127
|
summary.should be_kind_of(ConstantContact::Components::TrackingSummary)
|
127
128
|
summary.sends.should eq(15)
|
128
129
|
end
|