constantcontact 2.0.0 → 2.0.1
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/auth/oauth2.rb +1 -1
- data/lib/constantcontact/components/account/account_address.rb +26 -0
- data/lib/constantcontact/components/account/account_info.rb +9 -2
- data/lib/constantcontact/version.rb +1 -1
- data/spec/constantcontact/api_spec.rb +94 -93
- data/spec/constantcontact/services/account_service_spec.rb +8 -2
- data/spec/constantcontact/services/activity_service_spec.rb +13 -9
- data/spec/constantcontact/services/campaign_schedule_service_spec.rb +10 -6
- data/spec/constantcontact/services/campaign_tracking_service_spec.rb +11 -7
- data/spec/constantcontact/services/contact_service_spec.rb +11 -7
- data/spec/constantcontact/services/contact_tracking_service_spec.rb +11 -7
- data/spec/constantcontact/services/email_marketing_spec.rb +9 -5
- data/spec/constantcontact/services/event_spot_spec.rb +31 -27
- data/spec/constantcontact/services/library_service_spec.rb +20 -16
- data/spec/constantcontact/services/list_service_spec.rb +9 -5
- metadata +8 -7
@@ -7,17 +7,23 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::AccountService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_account_info" do
|
11
15
|
it "gets a summary of account information" do
|
12
16
|
json_response = load_file('account_info_response.json')
|
13
17
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
14
18
|
|
15
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
19
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
16
20
|
RestClient.stub(:get).and_return(response)
|
17
21
|
|
18
22
|
result = ConstantContact::Services::AccountService.get_account_info()
|
19
23
|
result.should be_kind_of(ConstantContact::Components::AccountInfo)
|
20
24
|
result.website.should eq('http://www.example.com')
|
25
|
+
result.organization_addresses.first.should be_kind_of(ConstantContact::Components::AccountAddress)
|
26
|
+
result.organization_addresses.first.city.should eq('Anytown')
|
21
27
|
end
|
22
28
|
end
|
23
29
|
|
@@ -26,7 +32,7 @@ describe ConstantContact::Services::AccountService do
|
|
26
32
|
json_response = load_file('verified_email_addresses_response.json')
|
27
33
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
28
34
|
|
29
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
35
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
30
36
|
RestClient.stub(:get).and_return(response)
|
31
37
|
|
32
38
|
params = {}
|
@@ -7,12 +7,16 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::ActivityService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_activities" do
|
11
15
|
it "gets a set of activities" do
|
12
16
|
json_response = load_file('activities_response.json')
|
13
17
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
14
18
|
|
15
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
19
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
16
20
|
RestClient.stub(:get).and_return(response)
|
17
21
|
|
18
22
|
activities = ConstantContact::Services::ActivityService.get_activities()
|
@@ -26,7 +30,7 @@ describe ConstantContact::Services::ActivityService do
|
|
26
30
|
json_response = load_file('activity_response.json')
|
27
31
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
28
32
|
|
29
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
33
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
30
34
|
RestClient.stub(:get).and_return(response)
|
31
35
|
|
32
36
|
activity = ConstantContact::Services::ActivityService.get_activity('a07e1ilbm7shdg6ikeo')
|
@@ -42,7 +46,7 @@ describe ConstantContact::Services::ActivityService do
|
|
42
46
|
json_contacts = load_file('contacts_response.json')
|
43
47
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
44
48
|
|
45
|
-
response = RestClient::Response.create(json_add_contacts, net_http_resp, {})
|
49
|
+
response = RestClient::Response.create(json_add_contacts, net_http_resp, {}, @request)
|
46
50
|
RestClient.stub(:post).and_return(response)
|
47
51
|
|
48
52
|
import = ConstantContact::Components::AddContactsImportData.new
|
@@ -88,7 +92,7 @@ describe ConstantContact::Services::ActivityService do
|
|
88
92
|
lists = 'list1, list2'
|
89
93
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
90
94
|
|
91
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
95
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
92
96
|
RestClient.stub(:post).and_return(response)
|
93
97
|
|
94
98
|
activity = ConstantContact::Services::ActivityService.create_add_contacts_activity_from_file(
|
@@ -108,7 +112,7 @@ describe ConstantContact::Services::ActivityService do
|
|
108
112
|
|
109
113
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
110
114
|
|
111
|
-
response = RestClient::Response.create(json_clear_lists, net_http_resp, {})
|
115
|
+
response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request)
|
112
116
|
RestClient.stub(:post).and_return(response)
|
113
117
|
|
114
118
|
activity = ConstantContact::Services::ActivityService.add_clear_lists_activity(lists)
|
@@ -123,7 +127,7 @@ describe ConstantContact::Services::ActivityService do
|
|
123
127
|
lists = 'list1, list2'
|
124
128
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
125
129
|
|
126
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
130
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
127
131
|
RestClient.stub(:post).and_return(response)
|
128
132
|
email_addresses = ["djellesma@constantcontact.com"]
|
129
133
|
|
@@ -141,7 +145,7 @@ describe ConstantContact::Services::ActivityService do
|
|
141
145
|
lists = 'list1, list2'
|
142
146
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
143
147
|
|
144
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
148
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
145
149
|
RestClient.stub(:post).and_return(response)
|
146
150
|
|
147
151
|
activity = ConstantContact::Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(
|
@@ -157,7 +161,7 @@ describe ConstantContact::Services::ActivityService do
|
|
157
161
|
json_response = load_file('export_contacts_response.json')
|
158
162
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
159
163
|
|
160
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
164
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
161
165
|
RestClient.stub(:post).and_return(response)
|
162
166
|
|
163
167
|
export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request))
|
@@ -174,7 +178,7 @@ describe ConstantContact::Services::ActivityService do
|
|
174
178
|
json_response = load_file('remove_contacts_from_lists_response.json')
|
175
179
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
176
180
|
|
177
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
181
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
178
182
|
RestClient.stub(:post).and_return(response)
|
179
183
|
|
180
184
|
request_object = JSON.parse(json_request)
|
@@ -7,13 +7,17 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::CampaignScheduleService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#add_schedule" do
|
11
15
|
it "creates a new schedule for a campaign" do
|
12
16
|
campaign_id = 1
|
13
17
|
json = load_file('schedule_response.json')
|
14
18
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
15
19
|
|
16
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
20
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
17
21
|
RestClient.stub(:post).and_return(response)
|
18
22
|
new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
19
23
|
|
@@ -30,7 +34,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
30
34
|
json = load_file('schedules_response.json')
|
31
35
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
32
36
|
|
33
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
37
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
34
38
|
RestClient.stub(:get).and_return(response)
|
35
39
|
|
36
40
|
schedules = ConstantContact::Services::CampaignScheduleService.get_schedules(
|
@@ -48,7 +52,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
48
52
|
json = load_file('schedule_response.json')
|
49
53
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
50
54
|
|
51
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
55
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
52
56
|
RestClient.stub(:get).and_return(response)
|
53
57
|
|
54
58
|
schedule = ConstantContact::Services::CampaignScheduleService.get_schedule(
|
@@ -64,7 +68,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
64
68
|
schedule_id = 1
|
65
69
|
net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content')
|
66
70
|
|
67
|
-
response = RestClient::Response.create('', net_http_resp, {})
|
71
|
+
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
68
72
|
RestClient.stub(:delete).and_return(response)
|
69
73
|
|
70
74
|
result = ConstantContact::Services::CampaignScheduleService.delete_schedule(
|
@@ -79,7 +83,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
79
83
|
json = load_file('schedule_response.json')
|
80
84
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
81
85
|
|
82
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
86
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
83
87
|
RestClient.stub(:put).and_return(response)
|
84
88
|
schedule = ConstantContact::Components::Schedule.create(JSON.parse(json))
|
85
89
|
|
@@ -97,7 +101,7 @@ describe ConstantContact::Services::CampaignScheduleService do
|
|
97
101
|
json_response = load_file('test_send_response.json')
|
98
102
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
99
103
|
|
100
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
104
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
101
105
|
RestClient.stub(:post).and_return(response)
|
102
106
|
test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request))
|
103
107
|
|
@@ -7,6 +7,10 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::CampaignTrackingService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_bounces" do
|
11
15
|
it "gets bounces for a given campaign" do
|
12
16
|
campaign_id = 1
|
@@ -14,7 +18,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
14
18
|
json = load_file('campaign_tracking_bounces_response.json')
|
15
19
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
16
20
|
|
17
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
21
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
18
22
|
RestClient.stub(:get).and_return(response)
|
19
23
|
|
20
24
|
set = ConstantContact::Services::CampaignTrackingService.get_bounces(campaign_id, params)
|
@@ -31,7 +35,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
31
35
|
json = load_file('campaign_tracking_clicks_response.json')
|
32
36
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
33
37
|
|
34
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
38
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
35
39
|
RestClient.stub(:get).and_return(response)
|
36
40
|
|
37
41
|
set = ConstantContact::Services::CampaignTrackingService.get_clicks(campaign_id, params)
|
@@ -48,7 +52,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
48
52
|
json = load_file('campaign_tracking_forwards_response.json')
|
49
53
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
50
54
|
|
51
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
55
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
52
56
|
RestClient.stub(:get).and_return(response)
|
53
57
|
|
54
58
|
set = ConstantContact::Services::CampaignTrackingService.get_forwards(campaign_id, params)
|
@@ -65,7 +69,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
65
69
|
json = load_file('campaign_tracking_opens_response.json')
|
66
70
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
67
71
|
|
68
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
72
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
69
73
|
RestClient.stub(:get).and_return(response)
|
70
74
|
|
71
75
|
set = ConstantContact::Services::CampaignTrackingService.get_opens(campaign_id, params)
|
@@ -82,7 +86,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
82
86
|
json = load_file('campaign_tracking_sends_response.json')
|
83
87
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
84
88
|
|
85
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
89
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
86
90
|
RestClient.stub(:get).and_return(response)
|
87
91
|
|
88
92
|
set = ConstantContact::Services::CampaignTrackingService.get_sends(campaign_id, params)
|
@@ -99,7 +103,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
99
103
|
json = load_file('campaign_tracking_unsubscribes_response.json')
|
100
104
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
101
105
|
|
102
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
106
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
103
107
|
RestClient.stub(:get).and_return(response)
|
104
108
|
|
105
109
|
set = ConstantContact::Services::CampaignTrackingService.get_unsubscribes(campaign_id, params)
|
@@ -115,7 +119,7 @@ describe ConstantContact::Services::CampaignTrackingService do
|
|
115
119
|
json = load_file('campaign_tracking_summary_response.json')
|
116
120
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
117
121
|
|
118
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
122
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
119
123
|
RestClient.stub(:get).and_return(response)
|
120
124
|
|
121
125
|
summary = ConstantContact::Services::CampaignTrackingService.get_summary(campaign_id)
|
@@ -7,12 +7,16 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::ContactService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_contacts" do
|
11
15
|
it "returns an array of contacts" do
|
12
16
|
json = load_file('contacts_response.json')
|
13
17
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
14
18
|
|
15
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
19
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
16
20
|
RestClient.stub(:get).and_return(response)
|
17
21
|
contacts = ConstantContact::Services::ContactService.get_contacts()
|
18
22
|
contact = contacts.results[0]
|
@@ -27,7 +31,7 @@ describe ConstantContact::Services::ContactService do
|
|
27
31
|
json = load_file('contact_response.json')
|
28
32
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
29
33
|
|
30
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
34
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
31
35
|
RestClient.stub(:get).and_return(response)
|
32
36
|
contact = ConstantContact::Services::ContactService.get_contact(1)
|
33
37
|
|
@@ -40,7 +44,7 @@ describe ConstantContact::Services::ContactService do
|
|
40
44
|
json = load_file('contact_response.json')
|
41
45
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
42
46
|
|
43
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
47
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
44
48
|
RestClient.stub(:post).and_return(response)
|
45
49
|
new_contact = ConstantContact::Components::Contact.create(JSON.parse(json))
|
46
50
|
contact = ConstantContact::Services::ContactService.add_contact(new_contact)
|
@@ -55,7 +59,7 @@ describe ConstantContact::Services::ContactService do
|
|
55
59
|
contact_id = 196
|
56
60
|
net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content')
|
57
61
|
|
58
|
-
response = RestClient::Response.create('', net_http_resp, {})
|
62
|
+
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
59
63
|
RestClient.stub(:delete).and_return(response)
|
60
64
|
|
61
65
|
result = ConstantContact::Services::ContactService.delete_contact(contact_id)
|
@@ -68,7 +72,7 @@ describe ConstantContact::Services::ContactService do
|
|
68
72
|
contact_id = 196
|
69
73
|
net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content')
|
70
74
|
|
71
|
-
response = RestClient::Response.create('', net_http_resp, {})
|
75
|
+
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
72
76
|
RestClient.stub(:delete).and_return(response)
|
73
77
|
|
74
78
|
result = ConstantContact::Services::ContactService.delete_contact_from_lists(contact_id)
|
@@ -82,7 +86,7 @@ describe ConstantContact::Services::ContactService do
|
|
82
86
|
list_id = 1
|
83
87
|
net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content')
|
84
88
|
|
85
|
-
response = RestClient::Response.create('', net_http_resp, {})
|
89
|
+
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
86
90
|
RestClient.stub(:delete).and_return(response)
|
87
91
|
|
88
92
|
result = ConstantContact::Services::ContactService.delete_contact_from_list(contact_id, list_id)
|
@@ -95,7 +99,7 @@ describe ConstantContact::Services::ContactService do
|
|
95
99
|
json = load_file('contact_response.json')
|
96
100
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
97
101
|
|
98
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
102
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
99
103
|
RestClient.stub(:put).and_return(response)
|
100
104
|
contact = ConstantContact::Components::Contact.create(JSON.parse(json))
|
101
105
|
result = ConstantContact::Services::ContactService.update_contact(contact)
|
@@ -7,6 +7,10 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::ContactTrackingService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_bounces" do
|
11
15
|
it "gets bounces for a given contact" do
|
12
16
|
contact_id = 1
|
@@ -14,7 +18,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
14
18
|
json = load_file('contact_tracking_bounces_response.json')
|
15
19
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
16
20
|
|
17
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
21
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
18
22
|
RestClient.stub(:get).and_return(response)
|
19
23
|
|
20
24
|
set = ConstantContact::Services::ContactTrackingService.get_bounces(contact_id, params)
|
@@ -31,7 +35,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
31
35
|
json = load_file('contact_tracking_clicks_response.json')
|
32
36
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
33
37
|
|
34
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
38
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
35
39
|
RestClient.stub(:get).and_return(response)
|
36
40
|
|
37
41
|
set = ConstantContact::Services::ContactTrackingService.get_clicks(contact_id, params)
|
@@ -48,7 +52,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
48
52
|
json = load_file('contact_tracking_forwards_response.json')
|
49
53
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
50
54
|
|
51
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
55
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
52
56
|
RestClient.stub(:get).and_return(response)
|
53
57
|
|
54
58
|
set = ConstantContact::Services::ContactTrackingService.get_forwards(contact_id, params)
|
@@ -65,7 +69,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
65
69
|
json = load_file('contact_tracking_opens_response.json')
|
66
70
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
67
71
|
|
68
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
72
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
69
73
|
RestClient.stub(:get).and_return(response)
|
70
74
|
|
71
75
|
set = ConstantContact::Services::ContactTrackingService.get_opens(contact_id, params)
|
@@ -82,7 +86,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
82
86
|
json = load_file('contact_tracking_sends_response.json')
|
83
87
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
84
88
|
|
85
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
89
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
86
90
|
RestClient.stub(:get).and_return(response)
|
87
91
|
|
88
92
|
set = ConstantContact::Services::ContactTrackingService.get_sends(contact_id, params)
|
@@ -99,7 +103,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
99
103
|
json = load_file('contact_tracking_unsubscribes_response.json')
|
100
104
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
101
105
|
|
102
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
106
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
103
107
|
RestClient.stub(:get).and_return(response)
|
104
108
|
|
105
109
|
set = ConstantContact::Services::ContactTrackingService.get_unsubscribes(contact_id, params)
|
@@ -115,7 +119,7 @@ describe ConstantContact::Services::ContactTrackingService do
|
|
115
119
|
json = load_file('contact_tracking_summary_response.json')
|
116
120
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
117
121
|
|
118
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
122
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
119
123
|
RestClient.stub(:get).and_return(response)
|
120
124
|
|
121
125
|
summary = ConstantContact::Services::CampaignTrackingService.get_summary(contact_id)
|
@@ -7,12 +7,16 @@
|
|
7
7
|
require 'spec_helper'
|
8
8
|
|
9
9
|
describe ConstantContact::Services::EmailMarketingService do
|
10
|
+
before(:each) do
|
11
|
+
@request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil)
|
12
|
+
end
|
13
|
+
|
10
14
|
describe "#get_campaigns" do
|
11
15
|
it "returns an array of campaigns" do
|
12
16
|
json_response = load_file('email_campaigns_response.json')
|
13
17
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
14
18
|
|
15
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
19
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
16
20
|
RestClient.stub(:get).and_return(response)
|
17
21
|
|
18
22
|
campaigns = ConstantContact::Services::EmailMarketingService.get_campaigns()
|
@@ -27,7 +31,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
27
31
|
json_response = load_file('email_campaign_response.json')
|
28
32
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
29
33
|
|
30
|
-
response = RestClient::Response.create(json_response, net_http_resp, {})
|
34
|
+
response = RestClient::Response.create(json_response, net_http_resp, {}, @request)
|
31
35
|
RestClient.stub(:get).and_return(response)
|
32
36
|
|
33
37
|
campaign = ConstantContact::Services::EmailMarketingService.get_campaign(1)
|
@@ -41,7 +45,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
41
45
|
json = load_file('email_campaign_response.json')
|
42
46
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
43
47
|
|
44
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
48
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
45
49
|
RestClient.stub(:post).and_return(response)
|
46
50
|
new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
47
51
|
|
@@ -56,7 +60,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
56
60
|
json = load_file('email_campaign_response.json')
|
57
61
|
net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content')
|
58
62
|
|
59
|
-
response = RestClient::Response.create('', net_http_resp, {})
|
63
|
+
response = RestClient::Response.create('', net_http_resp, {}, @request)
|
60
64
|
RestClient.stub(:delete).and_return(response)
|
61
65
|
campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
62
66
|
|
@@ -70,7 +74,7 @@ describe ConstantContact::Services::EmailMarketingService do
|
|
70
74
|
json = load_file('email_campaign_response.json')
|
71
75
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK')
|
72
76
|
|
73
|
-
response = RestClient::Response.create(json, net_http_resp, {})
|
77
|
+
response = RestClient::Response.create(json, net_http_resp, {}, @request)
|
74
78
|
RestClient.stub(:put).and_return(response)
|
75
79
|
campaign = ConstantContact::Components::Campaign.create(JSON.parse(json))
|
76
80
|
|