constantcontact 1.3.2 → 2.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/README.md +5 -5
- data/constantcontact.gemspec +2 -2
- data/lib/constantcontact/api.rb +223 -307
- data/lib/constantcontact/services/account_service.rb +5 -7
- data/lib/constantcontact/services/activity_service.rb +16 -24
- data/lib/constantcontact/services/base_service.rb +3 -4
- data/lib/constantcontact/services/campaign_schedule_service.rb +12 -18
- data/lib/constantcontact/services/campaign_tracking_service.rb +14 -21
- data/lib/constantcontact/services/contact_service.rb +14 -21
- data/lib/constantcontact/services/contact_tracking_service.rb +14 -21
- data/lib/constantcontact/services/email_marketing_service.rb +10 -15
- data/lib/constantcontact/services/event_spot_service.rb +56 -85
- data/lib/constantcontact/services/library_service.rb +32 -48
- data/lib/constantcontact/services/list_service.rb +10 -15
- data/lib/constantcontact/util/config.rb +5 -3
- data/lib/constantcontact/version.rb +3 -3
- data/spec/constantcontact/api_spec.rb +121 -103
- data/spec/constantcontact/services/account_service_spec.rb +15 -1
- data/spec/constantcontact/services/activity_service_spec.rb +9 -14
- data/spec/constantcontact/services/base_service_spec.rb +2 -1
- data/spec/constantcontact/services/campaign_schedule_service_spec.rb +6 -6
- data/spec/constantcontact/services/campaign_tracking_service_spec.rb +7 -7
- data/spec/constantcontact/services/contact_service_spec.rb +7 -7
- data/spec/constantcontact/services/contact_tracking_service_spec.rb +7 -7
- data/spec/constantcontact/services/email_marketing_spec.rb +5 -5
- data/spec/constantcontact/services/event_spot_spec.rb +27 -27
- data/spec/constantcontact/services/library_service_spec.rb +16 -16
- data/spec/constantcontact/services/list_service_spec.rb +5 -5
- metadata +2 -2
@@ -7,6 +7,20 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::AccountService do
|
10
|
+
describe "#get_account_info" do
|
11
|
+
it "gets a summary of account information" do
|
12
|
+
json_response = load_file('account_info_response.json')
|
13
|
+
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
14
|
+
|
15
|
+
response = RestClient::Response.create(json_response, net_http_resp, {})
|
16
|
+
RestClient.stub(:get).and_return(response)
|
17
|
+
|
18
|
+
result = ConstantContact::Services::AccountService.get_account_info()
|
19
|
+
result.should be_kind_of(ConstantContact::Components::AccountInfo)
|
20
|
+
result.website.should eq('http://www.example.com')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
10
24
|
describe "#get_verified_email_addresses" do
|
11
25
|
it "gets all verified email addresses associated with an account" do
|
12
26
|
json_response = load_file('verified_email_addresses_response.json')
|
@@ -16,7 +30,7 @@ describe ConstantContact::Services::AccountService do
|
|
16
30
|
RestClient.stub(:get).and_return(response)
|
17
31
|
|
18
32
|
params = {}
|
19
|
-
email_addresses = ConstantContact::Services::AccountService.get_verified_email_addresses(
|
33
|
+
email_addresses = ConstantContact::Services::AccountService.get_verified_email_addresses(params)
|
20
34
|
|
21
35
|
email_addresses.should be_kind_of(Array)
|
22
36
|
email_addresses.first.should be_kind_of(ConstantContact::Components::VerifiedEmailAddress)
|
@@ -15,7 +15,7 @@ describe ConstantContact::Services::ActivityService do
|
|
15
15
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
16
16
|
RestClient.stub(:get).and_return(response)
|
17
17
|
|
18
|
-
activities = ConstantContact::Services::ActivityService.get_activities(
|
18
|
+
activities = ConstantContact::Services::ActivityService.get_activities()
|
19
19
|
activities.first.should be_kind_of(ConstantContact::Components::Activity)
|
20
20
|
activities.first.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
21
21
|
end
|
@@ -29,7 +29,7 @@ describe ConstantContact::Services::ActivityService do
|
|
29
29
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
30
30
|
RestClient.stub(:get).and_return(response)
|
31
31
|
|
32
|
-
activity = ConstantContact::Services::ActivityService.get_activity('
|
32
|
+
activity = ConstantContact::Services::ActivityService.get_activity('a07e1ilbm7shdg6ikeo')
|
33
33
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
34
34
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
35
35
|
end
|
@@ -75,8 +75,7 @@ describe ConstantContact::Services::ActivityService do
|
|
75
75
|
|
76
76
|
add_contact = ConstantContact::Components::AddContacts.new(contacts, lists)
|
77
77
|
|
78
|
-
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity(
|
79
|
-
'token', add_contact)
|
78
|
+
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity(add_contact)
|
80
79
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
81
80
|
activity.type.should eq('ADD_CONTACTS')
|
82
81
|
end
|
@@ -93,7 +92,7 @@ describe ConstantContact::Services::ActivityService do
|
|
93
92
|
RestClient.stub(:post).and_return(response)
|
94
93
|
|
95
94
|
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity_from_file(
|
96
|
-
'
|
95
|
+
'contacts.txt', content, lists)
|
97
96
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
98
97
|
activity.type.should eq('ADD_CONTACTS')
|
99
98
|
end
|
@@ -112,8 +111,7 @@ describe ConstantContact::Services::ActivityService do
|
|
112
111
|
response = RestClient::Response.create(json_clear_lists, net_http_resp, {})
|
113
112
|
RestClient.stub(:post).and_return(response)
|
114
113
|
|
115
|
-
activity = ConstantContact::Services::ActivityService.add_clear_lists_activity(
|
116
|
-
'token', lists)
|
114
|
+
activity = ConstantContact::Services::ActivityService.add_clear_lists_activity(lists)
|
117
115
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
118
116
|
activity.type.should eq('CLEAR_CONTACTS_FROM_LISTS')
|
119
117
|
end
|
@@ -130,7 +128,7 @@ describe ConstantContact::Services::ActivityService do
|
|
130
128
|
email_addresses = ["djellesma@constantcontact.com"]
|
131
129
|
|
132
130
|
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity(
|
133
|
-
|
131
|
+
email_addresses, lists)
|
134
132
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
135
133
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
136
134
|
end
|
@@ -147,7 +145,7 @@ describe ConstantContact::Services::ActivityService do
|
|
147
145
|
RestClient.stub(:post).and_return(response)
|
148
146
|
|
149
147
|
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(
|
150
|
-
'
|
148
|
+
'contacts.txt', content, lists)
|
151
149
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
152
150
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
153
151
|
end
|
@@ -164,8 +162,7 @@ describe ConstantContact::Services::ActivityService do
|
|
164
162
|
|
165
163
|
export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request))
|
166
164
|
|
167
|
-
activity = ConstantContact::Services::ActivityService.add_export_contacts_activity(
|
168
|
-
'token', export_contacts)
|
165
|
+
activity = ConstantContact::Services::ActivityService.add_export_contacts_activity(export_contacts)
|
169
166
|
activity.should be_kind_of(ConstantContact::Components::Activity)
|
170
167
|
activity.type.should eq('EXPORT_CONTACTS')
|
171
168
|
end
|
@@ -192,9 +189,7 @@ describe ConstantContact::Services::ActivityService do
|
|
192
189
|
end
|
193
190
|
end
|
194
191
|
|
195
|
-
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity(
|
196
|
-
'token', email_addresses, lists)
|
197
|
-
|
192
|
+
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity(email_addresses, lists)
|
198
193
|
activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS')
|
199
194
|
end
|
200
195
|
end
|
@@ -10,7 +10,8 @@ describe ConstantContact::Services::BaseService do
|
|
10
10
|
describe "#get_headers" do
|
11
11
|
it "gets a hash of headers" do
|
12
12
|
token = 'foo'
|
13
|
-
|
13
|
+
ConstantContact::Services::BaseService.access_token = token
|
14
|
+
headers = ConstantContact::Services::BaseService.send(:get_headers)
|
14
15
|
|
15
16
|
expect(headers).to be_a Hash
|
16
17
|
expect(headers[:content_type]).to be_a String
|
@@ -18,7 +18,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
18
18
|
new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
19
19
|
|
20
20
|
schedule = ConstantContact::Services::CampaignScheduleService.add_schedule(
|
21
|
-
|
21
|
+
campaign_id, new_schedule)
|
22
22
|
schedule.should be_kind_of(ConstantContact::Components::Schedule)
|
23
23
|
schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
24
24
|
end
|
@@ -34,7 +34,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
34
34
|
RestClient.stub(:get).and_return(response)
|
35
35
|
|
36
36
|
schedules = ConstantContact::Services::CampaignScheduleService.get_schedules(
|
37
|
-
|
37
|
+
campaign_id)
|
38
38
|
schedules.first.should be_kind_of(ConstantContact::Components::Schedule)
|
39
39
|
schedules.first.scheduled_date.should eq('2012-12-16T11:07:43.626Z')
|
40
40
|
end
|
@@ -52,7 +52,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
52
52
|
RestClient.stub(:get).and_return(response)
|
53
53
|
|
54
54
|
schedule = ConstantContact::Services::CampaignScheduleService.get_schedule(
|
55
|
-
|
55
|
+
campaign_id, schedule_id)
|
56
56
|
schedule.should be_kind_of(ConstantContact::Components::Schedule)
|
57
57
|
schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
58
58
|
end
|
@@ -68,7 +68,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
68
68
|
RestClient.stub(:delete).and_return(response)
|
69
69
|
|
70
70
|
result = ConstantContact::Services::CampaignScheduleService.delete_schedule(
|
71
|
-
|
71
|
+
campaign_id, schedule_id)
|
72
72
|
result.should be_true
|
73
73
|
end
|
74
74
|
end
|
@@ -84,7 +84,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
84
84
|
schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
85
85
|
|
86
86
|
result = ConstantContact::Services::CampaignScheduleService.update_schedule(
|
87
|
-
|
87
|
+
campaign_id, schedule)
|
88
88
|
result.should be_kind_of(ConstantContact::Components::Schedule)
|
89
89
|
result.scheduled_date.should eq('2013-05-10T11:07:43.626Z')
|
90
90
|
end
|
@@ -102,7 +102,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
102
102
|
test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request))
|
103
103
|
|
104
104
|
result = ConstantContact::Services::CampaignScheduleService.send_test(
|
105
|
-
|
105
|
+
campaign_id, test_send)
|
106
106
|
result.should be_kind_of(ConstantContact::Components::TestSend)
|
107
107
|
result.personal_message.should eq('This is a test send of the email campaign message.')
|
108
108
|
end
|
@@ -17,7 +17,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
17
17
|
response = RestClient::Response.create(json, net_http_resp, {})
|
18
18
|
RestClient.stub(:get).and_return(response)
|
19
19
|
|
20
|
-
set = ConstantContact::Services::CampaignTrackingService.get_bounces(
|
20
|
+
set = ConstantContact::Services::CampaignTrackingService.get_bounces(campaign_id, params)
|
21
21
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
22
22
|
set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity)
|
23
23
|
set.results.first.activity_type.should eq('EMAIL_BOUNCE')
|
@@ -34,7 +34,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
34
34
|
response = RestClient::Response.create(json, net_http_resp, {})
|
35
35
|
RestClient.stub(:get).and_return(response)
|
36
36
|
|
37
|
-
set = ConstantContact::Services::CampaignTrackingService.get_clicks(
|
37
|
+
set = ConstantContact::Services::CampaignTrackingService.get_clicks(campaign_id, params)
|
38
38
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
39
39
|
set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity)
|
40
40
|
set.results.first.activity_type.should eq('EMAIL_CLICK')
|
@@ -51,7 +51,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
51
51
|
response = RestClient::Response.create(json, net_http_resp, {})
|
52
52
|
RestClient.stub(:get).and_return(response)
|
53
53
|
|
54
|
-
set = ConstantContact::Services::CampaignTrackingService.get_forwards(
|
54
|
+
set = ConstantContact::Services::CampaignTrackingService.get_forwards(campaign_id, params)
|
55
55
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
56
56
|
set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity)
|
57
57
|
set.results.first.activity_type.should eq('EMAIL_FORWARD')
|
@@ -68,7 +68,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
68
68
|
response = RestClient::Response.create(json, net_http_resp, {})
|
69
69
|
RestClient.stub(:get).and_return(response)
|
70
70
|
|
71
|
-
set = ConstantContact::Services::CampaignTrackingService.get_opens(
|
71
|
+
set = ConstantContact::Services::CampaignTrackingService.get_opens(campaign_id, params)
|
72
72
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
73
73
|
set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity)
|
74
74
|
set.results.first.activity_type.should eq('EMAIL_OPEN')
|
@@ -85,7 +85,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
85
85
|
response = RestClient::Response.create(json, net_http_resp, {})
|
86
86
|
RestClient.stub(:get).and_return(response)
|
87
87
|
|
88
|
-
set = ConstantContact::Services::CampaignTrackingService.get_sends(
|
88
|
+
set = ConstantContact::Services::CampaignTrackingService.get_sends(campaign_id, params)
|
89
89
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
90
90
|
set.results.first.should be_kind_of(ConstantContact::Components::SendActivity)
|
91
91
|
set.results.first.activity_type.should eq('EMAIL_SEND')
|
@@ -102,7 +102,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
102
102
|
response = RestClient::Response.create(json, net_http_resp, {})
|
103
103
|
RestClient.stub(:get).and_return(response)
|
104
104
|
|
105
|
-
set = ConstantContact::Services::CampaignTrackingService.get_unsubscribes(
|
105
|
+
set = ConstantContact::Services::CampaignTrackingService.get_unsubscribes(campaign_id, params)
|
106
106
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
107
107
|
set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity)
|
108
108
|
set.results.first.activity_type.should eq('EMAIL_UNSUBSCRIBE')
|
@@ -118,7 +118,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
118
118
|
response = RestClient::Response.create(json, net_http_resp, {})
|
119
119
|
RestClient.stub(:get).and_return(response)
|
120
120
|
|
121
|
-
summary = ConstantContact::Services::CampaignTrackingService.get_summary(
|
121
|
+
summary = ConstantContact::Services::CampaignTrackingService.get_summary(campaign_id)
|
122
122
|
summary.should be_kind_of(ConstantContact::Components::TrackingSummary)
|
123
123
|
summary.sends.should eq(15)
|
124
124
|
end
|
@@ -14,7 +14,7 @@ describe ConstantContact::Services::ContactService do
|
|
14
14
|
|
15
15
|
response = RestClient::Response.create(json, net_http_resp, {})
|
16
16
|
RestClient.stub(:get).and_return(response)
|
17
|
-
contacts = ConstantContact::Services::ContactService.get_contacts(
|
17
|
+
contacts = ConstantContact::Services::ContactService.get_contacts()
|
18
18
|
contact = contacts.results[0]
|
19
19
|
|
20
20
|
contacts.should be_kind_of(ConstantContact::Components::ResultSet)
|
@@ -29,7 +29,7 @@ describe ConstantContact::Services::ContactService do
|
|
29
29
|
|
30
30
|
response = RestClient::Response.create(json, net_http_resp, {})
|
31
31
|
RestClient.stub(:get).and_return(response)
|
32
|
-
contact = ConstantContact::Services::ContactService.get_contact(
|
32
|
+
contact = ConstantContact::Services::ContactService.get_contact(1)
|
33
33
|
|
34
34
|
contact.should be_kind_of(ConstantContact::Components::Contact)
|
35
35
|
end
|
@@ -43,7 +43,7 @@ describe ConstantContact::Services::ContactService do
|
|
43
43
|
response = RestClient::Response.create(json, net_http_resp, {})
|
44
44
|
RestClient.stub(:post).and_return(response)
|
45
45
|
new_contact = ConstantContact::Components::Contact.create(JSON.parse(json))
|
46
|
-
contact = ConstantContact::Services::ContactService.add_contact(
|
46
|
+
contact = ConstantContact::Services::ContactService.add_contact(new_contact)
|
47
47
|
|
48
48
|
contact.should be_kind_of(ConstantContact::Components::Contact)
|
49
49
|
contact.status.should eq('ACTIVE')
|
@@ -58,7 +58,7 @@ describe ConstantContact::Services::ContactService do
|
|
58
58
|
response = RestClient::Response.create('', net_http_resp, {})
|
59
59
|
RestClient.stub(:delete).and_return(response)
|
60
60
|
|
61
|
-
result = ConstantContact::Services::ContactService.delete_contact(
|
61
|
+
result = ConstantContact::Services::ContactService.delete_contact(contact_id)
|
62
62
|
result.should be_true
|
63
63
|
end
|
64
64
|
end
|
@@ -71,7 +71,7 @@ describe ConstantContact::Services::ContactService do
|
|
71
71
|
response = RestClient::Response.create('', net_http_resp, {})
|
72
72
|
RestClient.stub(:delete).and_return(response)
|
73
73
|
|
74
|
-
result = ConstantContact::Services::ContactService.delete_contact_from_lists(
|
74
|
+
result = ConstantContact::Services::ContactService.delete_contact_from_lists(contact_id)
|
75
75
|
result.should be_true
|
76
76
|
end
|
77
77
|
end
|
@@ -85,7 +85,7 @@ describe ConstantContact::Services::ContactService do
|
|
85
85
|
response = RestClient::Response.create('', net_http_resp, {})
|
86
86
|
RestClient.stub(:delete).and_return(response)
|
87
87
|
|
88
|
-
result = ConstantContact::Services::ContactService.delete_contact_from_list(
|
88
|
+
result = ConstantContact::Services::ContactService.delete_contact_from_list(contact_id, list_id)
|
89
89
|
result.should be_true
|
90
90
|
end
|
91
91
|
end
|
@@ -98,7 +98,7 @@ describe ConstantContact::Services::ContactService do
|
|
98
98
|
response = RestClient::Response.create(json, net_http_resp, {})
|
99
99
|
RestClient.stub(:put).and_return(response)
|
100
100
|
contact = ConstantContact::Components::Contact.create(JSON.parse(json))
|
101
|
-
result = ConstantContact::Services::ContactService.update_contact(
|
101
|
+
result = ConstantContact::Services::ContactService.update_contact(contact)
|
102
102
|
|
103
103
|
result.should be_kind_of(ConstantContact::Components::Contact)
|
104
104
|
result.status.should eq('ACTIVE')
|
@@ -17,7 +17,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
17
17
|
response = RestClient::Response.create(json, net_http_resp, {})
|
18
18
|
RestClient.stub(:get).and_return(response)
|
19
19
|
|
20
|
-
set = ConstantContact::Services::ContactTrackingService.get_bounces(
|
20
|
+
set = ConstantContact::Services::ContactTrackingService.get_bounces(contact_id, params)
|
21
21
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
22
22
|
set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity)
|
23
23
|
set.results.first.activity_type.should eq('EMAIL_BOUNCE')
|
@@ -34,7 +34,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
34
34
|
response = RestClient::Response.create(json, net_http_resp, {})
|
35
35
|
RestClient.stub(:get).and_return(response)
|
36
36
|
|
37
|
-
set = ConstantContact::Services::ContactTrackingService.get_clicks(
|
37
|
+
set = ConstantContact::Services::ContactTrackingService.get_clicks(contact_id, params)
|
38
38
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
39
39
|
set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity)
|
40
40
|
set.results.first.activity_type.should eq('EMAIL_CLICK')
|
@@ -51,7 +51,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
51
51
|
response = RestClient::Response.create(json, net_http_resp, {})
|
52
52
|
RestClient.stub(:get).and_return(response)
|
53
53
|
|
54
|
-
set = ConstantContact::Services::ContactTrackingService.get_forwards(
|
54
|
+
set = ConstantContact::Services::ContactTrackingService.get_forwards(contact_id, params)
|
55
55
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
56
56
|
set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity)
|
57
57
|
set.results.first.activity_type.should eq('EMAIL_FORWARD')
|
@@ -68,7 +68,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
68
68
|
response = RestClient::Response.create(json, net_http_resp, {})
|
69
69
|
RestClient.stub(:get).and_return(response)
|
70
70
|
|
71
|
-
set = ConstantContact::Services::ContactTrackingService.get_opens(
|
71
|
+
set = ConstantContact::Services::ContactTrackingService.get_opens(contact_id, params)
|
72
72
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
73
73
|
set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity)
|
74
74
|
set.results.first.activity_type.should eq('EMAIL_OPEN')
|
@@ -85,7 +85,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
85
85
|
response = RestClient::Response.create(json, net_http_resp, {})
|
86
86
|
RestClient.stub(:get).and_return(response)
|
87
87
|
|
88
|
-
set = ConstantContact::Services::ContactTrackingService.get_sends(
|
88
|
+
set = ConstantContact::Services::ContactTrackingService.get_sends(contact_id, params)
|
89
89
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
90
90
|
set.results.first.should be_kind_of(ConstantContact::Components::SendActivity)
|
91
91
|
set.results.first.activity_type.should eq('EMAIL_SEND')
|
@@ -102,7 +102,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
102
102
|
response = RestClient::Response.create(json, net_http_resp, {})
|
103
103
|
RestClient.stub(:get).and_return(response)
|
104
104
|
|
105
|
-
set = ConstantContact::Services::ContactTrackingService.get_unsubscribes(
|
105
|
+
set = ConstantContact::Services::ContactTrackingService.get_unsubscribes(contact_id, params)
|
106
106
|
set.should be_kind_of(ConstantContact::Components::ResultSet)
|
107
107
|
set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity)
|
108
108
|
set.results.first.activity_type.should eq('EMAIL_UNSUBSCRIBE')
|
@@ -118,7 +118,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
118
118
|
response = RestClient::Response.create(json, net_http_resp, {})
|
119
119
|
RestClient.stub(:get).and_return(response)
|
120
120
|
|
121
|
-
summary = ConstantContact::Services::CampaignTrackingService.get_summary(
|
121
|
+
summary = ConstantContact::Services::CampaignTrackingService.get_summary(contact_id)
|
122
122
|
summary.should be_kind_of(ConstantContact::Components::TrackingSummary)
|
123
123
|
summary.sends.should eq(15)
|
124
124
|
end
|
@@ -15,7 +15,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
15
15
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
16
16
|
RestClient.stub(:get).and_return(response)
|
17
17
|
|
18
|
-
campaigns = ConstantContact::Services::EmailMarketingService.get_campaigns(
|
18
|
+
campaigns = ConstantContact::Services::EmailMarketingService.get_campaigns()
|
19
19
|
campaigns.should be_kind_of(ConstantContact::Components::ResultSet)
|
20
20
|
campaigns.results.first.should be_kind_of(ConstantContact::Components::Campaign)
|
21
21
|
campaigns.results.first.name.should eq('1357157252225')
|
@@ -30,7 +30,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
30
30
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
31
31
|
RestClient.stub(:get).and_return(response)
|
32
32
|
|
33
|
-
campaign = ConstantContact::Services::EmailMarketingService.get_campaign(
|
33
|
+
campaign = ConstantContact::Services::EmailMarketingService.get_campaign(1)
|
34
34
|
campaign.should be_kind_of(ConstantContact::Components::Campaign)
|
35
35
|
campaign.name.should eq('Campaign Name')
|
36
36
|
end
|
@@ -45,7 +45,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
45
45
|
RestClient.stub(:post).and_return(response)
|
46
46
|
new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
47
47
|
|
48
|
-
campaign = ConstantContact::Services::EmailMarketingService.add_campaign(
|
48
|
+
campaign = ConstantContact::Services::EmailMarketingService.add_campaign(new_campaign)
|
49
49
|
campaign.should be_kind_of(ConstantContact::Components::Campaign)
|
50
50
|
campaign.name.should eq('Campaign Name')
|
51
51
|
end
|
@@ -60,7 +60,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
60
60
|
RestClient.stub(:delete).and_return(response)
|
61
61
|
campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
62
62
|
|
63
|
-
result = ConstantContact::Services::EmailMarketingService.delete_campaign(
|
63
|
+
result = ConstantContact::Services::EmailMarketingService.delete_campaign(campaign)
|
64
64
|
result.should be_true
|
65
65
|
end
|
66
66
|
end
|
@@ -74,7 +74,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
74
74
|
RestClient.stub(:put).and_return(response)
|
75
75
|
campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
76
76
|
|
77
|
-
result = ConstantContact::Services::EmailMarketingService.update_campaign(
|
77
|
+
result = ConstantContact::Services::EmailMarketingService.update_campaign(campaign)
|
78
78
|
result.should be_kind_of(ConstantContact::Components::Campaign)
|
79
79
|
result.name.should eq('Campaign Name')
|
80
80
|
end
|
@@ -14,7 +14,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
14
14
|
|
15
15
|
response = RestClient::Response.create(json, net_http_resp, {})
|
16
16
|
RestClient.stub(:get).and_return(response)
|
17
|
-
events = ConstantContact::Services::EventSpotService.get_events(
|
17
|
+
events = ConstantContact::Services::EventSpotService.get_events()
|
18
18
|
events.should be_kind_of(ConstantContact::Components::ResultSet)
|
19
19
|
events.results.collect{|e| e.should be_kind_of(ConstantContact::Components::Event) }
|
20
20
|
end
|
@@ -27,7 +27,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
27
27
|
|
28
28
|
response = RestClient::Response.create(json, net_http_resp, {})
|
29
29
|
RestClient.stub(:get).and_return(response)
|
30
|
-
event = ConstantContact::Services::EventSpotService.get_event(
|
30
|
+
event = ConstantContact::Services::EventSpotService.get_event(1)
|
31
31
|
|
32
32
|
event.should be_kind_of(ConstantContact::Components::Event)
|
33
33
|
end
|
@@ -41,7 +41,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
41
41
|
response = RestClient::Response.create(json, net_http_resp, {})
|
42
42
|
RestClient.stub(:post).and_return(response)
|
43
43
|
event = ConstantContact::Components::Event.create(JSON.parse(json))
|
44
|
-
added = ConstantContact::Services::EventSpotService.add_event(
|
44
|
+
added = ConstantContact::Services::EventSpotService.add_event(event)
|
45
45
|
|
46
46
|
added.should respond_to(:id)
|
47
47
|
added.id.should_not be_empty
|
@@ -59,7 +59,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
59
59
|
RestClient.stub(:patch).and_return(response)
|
60
60
|
|
61
61
|
event = ConstantContact::Components::Event.create(JSON.parse(json))
|
62
|
-
updated = ConstantContact::Services::EventSpotService.publish_event(
|
62
|
+
updated = ConstantContact::Services::EventSpotService.publish_event(event)
|
63
63
|
updated.should be_kind_of(ConstantContact::Components::Event)
|
64
64
|
updated.should respond_to(:status)
|
65
65
|
updated.status.should eq("ACTIVE")
|
@@ -77,7 +77,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
77
77
|
RestClient.stub(:patch).and_return(response)
|
78
78
|
|
79
79
|
event = ConstantContact::Components::Event.create(JSON.parse(json))
|
80
|
-
updated = ConstantContact::Services::EventSpotService.cancel_event(
|
80
|
+
updated = ConstantContact::Services::EventSpotService.cancel_event(event)
|
81
81
|
updated.should be_kind_of(ConstantContact::Components::Event)
|
82
82
|
updated.should respond_to(:status)
|
83
83
|
updated.status.should eq("CANCELLED")
|
@@ -93,7 +93,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
93
93
|
response = RestClient::Response.create(fees_json, net_http_resp, {})
|
94
94
|
RestClient.stub(:get).and_return(response)
|
95
95
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
96
|
-
fees = ConstantContact::Services::EventSpotService.get_fees(
|
96
|
+
fees = ConstantContact::Services::EventSpotService.get_fees(event)
|
97
97
|
#fees.should be_kind_of(ConstantContact::Components::ResultSet)
|
98
98
|
#fees.results.collect{|f| f.should be_kind_of(ConstantContact::Components::Fee) }
|
99
99
|
|
@@ -113,7 +113,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
113
113
|
|
114
114
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
115
115
|
fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json))
|
116
|
-
retrieved = ConstantContact::Services::EventSpotService.get_fee(
|
116
|
+
retrieved = ConstantContact::Services::EventSpotService.get_fee(event, fee)
|
117
117
|
retrieved.should be_kind_of(ConstantContact::Components::EventFee)
|
118
118
|
end
|
119
119
|
end
|
@@ -129,7 +129,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
129
129
|
|
130
130
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
131
131
|
fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json))
|
132
|
-
added = ConstantContact::Services::EventSpotService.add_fee(
|
132
|
+
added = ConstantContact::Services::EventSpotService.add_fee(event, fee)
|
133
133
|
added.should be_kind_of(ConstantContact::Components::EventFee)
|
134
134
|
added.id.should_not be_empty
|
135
135
|
end
|
@@ -148,7 +148,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
148
148
|
|
149
149
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
150
150
|
fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json))
|
151
|
-
updated = ConstantContact::Services::EventSpotService.update_fee(
|
151
|
+
updated = ConstantContact::Services::EventSpotService.update_fee(event, fee)
|
152
152
|
updated.should be_kind_of(ConstantContact::Components::EventFee)
|
153
153
|
updated.fee.should_not eq(fee.fee)
|
154
154
|
updated.fee.should eq(fee.fee + 1)
|
@@ -166,7 +166,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
166
166
|
|
167
167
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
168
168
|
fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json))
|
169
|
-
ConstantContact::Services::EventSpotService.delete_fee(
|
169
|
+
ConstantContact::Services::EventSpotService.delete_fee(event, fee).should be_true
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -180,7 +180,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
180
180
|
RestClient.stub(:get).and_return(response)
|
181
181
|
|
182
182
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
183
|
-
registrants = ConstantContact::Services::EventSpotService.get_registrants(
|
183
|
+
registrants = ConstantContact::Services::EventSpotService.get_registrants(event)
|
184
184
|
registrants.should be_kind_of(ConstantContact::Components::ResultSet)
|
185
185
|
registrants.results.collect{|r| r .should be_kind_of(ConstantContact::Components::Registrant) }
|
186
186
|
end
|
@@ -197,7 +197,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
197
197
|
|
198
198
|
event = ConstantContact::Components::Event.create(JSON.parse(event_json))
|
199
199
|
registrant = ConstantContact::Components::Registrant.create(JSON.parse(registrant_json))
|
200
|
-
retrieved = ConstantContact::Services::EventSpotService.get_registrant(
|
200
|
+
retrieved = ConstantContact::Services::EventSpotService.get_registrant(event, registrant)
|
201
201
|
retrieved.should be_kind_of(ConstantContact::Components::Registrant)
|
202
202
|
retrieved.id.should_not be_empty
|
203
203
|
end
|
@@ -211,7 +211,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
211
211
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
212
212
|
RestClient.stub(:get).and_return(response)
|
213
213
|
|
214
|
-
results = ConstantContact::Services::EventSpotService.get_event_items(
|
214
|
+
results = ConstantContact::Services::EventSpotService.get_event_items(1)
|
215
215
|
results.should be_kind_of(Array)
|
216
216
|
results.first.should be_kind_of(ConstantContact::Components::EventItem)
|
217
217
|
results.first.name.should eq('Running Belt')
|
@@ -226,7 +226,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
226
226
|
response = RestClient::Response.create(json, net_http_resp, {})
|
227
227
|
RestClient.stub(:get).and_return(response)
|
228
228
|
|
229
|
-
result = ConstantContact::Services::EventSpotService.get_event_item(
|
229
|
+
result = ConstantContact::Services::EventSpotService.get_event_item(1, 1)
|
230
230
|
result.should be_kind_of(ConstantContact::Components::EventItem)
|
231
231
|
result.name.should eq('Running Belt')
|
232
232
|
end
|
@@ -241,7 +241,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
241
241
|
RestClient.stub(:post).and_return(response)
|
242
242
|
event_item = ConstantContact::Components::EventItem.create(JSON.parse(json))
|
243
243
|
|
244
|
-
result = ConstantContact::Services::EventSpotService.add_event_item(
|
244
|
+
result = ConstantContact::Services::EventSpotService.add_event_item(1, event_item)
|
245
245
|
result.should be_kind_of(ConstantContact::Components::EventItem)
|
246
246
|
result.name.should eq('Running Belt')
|
247
247
|
end
|
@@ -254,7 +254,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
254
254
|
response = RestClient::Response.create('', net_http_resp, {})
|
255
255
|
RestClient.stub(:delete).and_return(response)
|
256
256
|
|
257
|
-
result = ConstantContact::Services::EventSpotService.delete_event_item(
|
257
|
+
result = ConstantContact::Services::EventSpotService.delete_event_item(1, 1)
|
258
258
|
result.should be_true
|
259
259
|
end
|
260
260
|
end
|
@@ -268,7 +268,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
268
268
|
RestClient.stub(:put).and_return(response)
|
269
269
|
event_item = ConstantContact::Components::EventItem.create(JSON.parse(json))
|
270
270
|
|
271
|
-
result = ConstantContact::Services::EventSpotService.update_event_item(
|
271
|
+
result = ConstantContact::Services::EventSpotService.update_event_item(1, event_item)
|
272
272
|
result.should be_kind_of(ConstantContact::Components::EventItem)
|
273
273
|
result.name.should eq('Running Belt')
|
274
274
|
end
|
@@ -282,7 +282,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
282
282
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
283
283
|
RestClient.stub(:get).and_return(response)
|
284
284
|
|
285
|
-
results = ConstantContact::Services::EventSpotService.get_event_item_attributes(
|
285
|
+
results = ConstantContact::Services::EventSpotService.get_event_item_attributes(1, 1)
|
286
286
|
results.should be_kind_of(Array)
|
287
287
|
results.first.should be_kind_of(ConstantContact::Components::EventItemAttribute)
|
288
288
|
results.first.name.should eq('Royal Blue')
|
@@ -297,7 +297,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
297
297
|
response = RestClient::Response.create(json, net_http_resp, {})
|
298
298
|
RestClient.stub(:get).and_return(response)
|
299
299
|
|
300
|
-
result = ConstantContact::Services::EventSpotService.get_event_item_attribute(
|
300
|
+
result = ConstantContact::Services::EventSpotService.get_event_item_attribute(1, 1, 1)
|
301
301
|
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
|
302
302
|
result.name.should eq('Hi-Vis Green')
|
303
303
|
end
|
@@ -312,7 +312,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
312
312
|
RestClient.stub(:post).and_return(response)
|
313
313
|
event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json))
|
314
314
|
|
315
|
-
result = ConstantContact::Services::EventSpotService.add_event_item_attribute(
|
315
|
+
result = ConstantContact::Services::EventSpotService.add_event_item_attribute(1, 1, event_item_attribute)
|
316
316
|
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
|
317
317
|
result.name.should eq('Hi-Vis Green')
|
318
318
|
end
|
@@ -325,7 +325,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
325
325
|
response = RestClient::Response.create('', net_http_resp, {})
|
326
326
|
RestClient.stub(:delete).and_return(response)
|
327
327
|
|
328
|
-
result = ConstantContact::Services::EventSpotService.delete_event_item_attribute(
|
328
|
+
result = ConstantContact::Services::EventSpotService.delete_event_item_attribute(1, 1, 1)
|
329
329
|
result.should be_true
|
330
330
|
end
|
331
331
|
end
|
@@ -339,7 +339,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
339
339
|
RestClient.stub(:put).and_return(response)
|
340
340
|
event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json))
|
341
341
|
|
342
|
-
result = ConstantContact::Services::EventSpotService.update_event_item_attribute(
|
342
|
+
result = ConstantContact::Services::EventSpotService.update_event_item_attribute(1, 1, event_item_attribute)
|
343
343
|
result.should be_kind_of(ConstantContact::Components::EventItemAttribute)
|
344
344
|
result.name.should eq('Hi-Vis Green')
|
345
345
|
end
|
@@ -353,7 +353,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
353
353
|
response = RestClient::Response.create(json_response, net_http_resp, {})
|
354
354
|
RestClient.stub(:get).and_return(response)
|
355
355
|
|
356
|
-
results = ConstantContact::Services::EventSpotService.get_promocodes(
|
356
|
+
results = ConstantContact::Services::EventSpotService.get_promocodes(1)
|
357
357
|
results.should be_kind_of(Array)
|
358
358
|
results.first.should be_kind_of(ConstantContact::Components::Promocode)
|
359
359
|
results.first.code_name.should eq('REDUCED_FEE')
|
@@ -368,7 +368,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
368
368
|
response = RestClient::Response.create(json, net_http_resp, {})
|
369
369
|
RestClient.stub(:get).and_return(response)
|
370
370
|
|
371
|
-
result = ConstantContact::Services::EventSpotService.get_promocode(
|
371
|
+
result = ConstantContact::Services::EventSpotService.get_promocode(1, 1)
|
372
372
|
result.should be_kind_of(ConstantContact::Components::Promocode)
|
373
373
|
result.code_name.should eq('TOTAL_FEE')
|
374
374
|
end
|
@@ -383,7 +383,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
383
383
|
RestClient.stub(:post).and_return(response)
|
384
384
|
promocode = ConstantContact::Components::Promocode.create(JSON.parse(json))
|
385
385
|
|
386
|
-
result = ConstantContact::Services::EventSpotService.add_promocode(
|
386
|
+
result = ConstantContact::Services::EventSpotService.add_promocode(1, promocode)
|
387
387
|
result.should be_kind_of(ConstantContact::Components::Promocode)
|
388
388
|
result.code_name.should eq('TOTAL_FEE')
|
389
389
|
end
|
@@ -396,7 +396,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
396
396
|
response = RestClient::Response.create('', net_http_resp, {})
|
397
397
|
RestClient.stub(:delete).and_return(response)
|
398
398
|
|
399
|
-
result = ConstantContact::Services::EventSpotService.delete_promocode(
|
399
|
+
result = ConstantContact::Services::EventSpotService.delete_promocode(1, 1)
|
400
400
|
result.should be_true
|
401
401
|
end
|
402
402
|
end
|
@@ -410,7 +410,7 @@ describe ConstantContact::Services::EventSpotService do
|
|
410
410
|
RestClient.stub(:put).and_return(response)
|
411
411
|
promocode = ConstantContact::Components::Promocode.create(JSON.parse(json))
|
412
412
|
|
413
|
-
result = ConstantContact::Services::EventSpotService.update_promocode(
|
413
|
+
result = ConstantContact::Services::EventSpotService.update_promocode(1, promocode)
|
414
414
|
result.should be_kind_of(ConstantContact::Components::Promocode)
|
415
415
|
result.code_name.should eq('TOTAL_FEE')
|
416
416
|
end
|