createsend 4.1.2 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/HISTORY.md +29 -0
- data/README.md +4 -4
- data/RELEASE.md +1 -1
- data/Rakefile +1 -1
- data/createsend.gemspec +1 -1
- data/lib/createsend/campaign.rb +1 -1
- data/lib/createsend/client.rb +25 -3
- data/lib/createsend/createsend.rb +3 -1
- data/lib/createsend/journey.rb +58 -0
- data/lib/createsend/list.rb +13 -12
- data/lib/createsend/segment.rb +3 -2
- data/lib/createsend/subscriber.rb +15 -10
- data/lib/createsend/version.rb +1 -1
- data/lib/createsend.rb +1 -0
- data/samples/authentication_sample.rb +64 -0
- data/samples/clients_sample.rb +79 -0
- data/samples/journey_sample.rb +87 -0
- data/samples/lists_sample.rb +41 -0
- data/samples/segments_sample.rb +21 -0
- data/samples/subscribes_sample.rb +22 -0
- data/test/administrator_test.rb +3 -3
- data/test/campaign_test.rb +6 -5
- data/test/client_test.rb +67 -36
- data/test/createsend_test.rb +4 -4
- data/test/fixtures/active_subscribers.json +5 -0
- data/test/fixtures/bounced_subscribers.json +1 -0
- data/test/fixtures/campaign_summary.json +2 -1
- data/test/fixtures/campaigns.json +37 -26
- data/test/fixtures/deleted_subscribers.json +5 -0
- data/test/fixtures/drafts.json +4 -2
- data/test/fixtures/journey_bounces.json +35 -0
- data/test/fixtures/journey_clicks.json +35 -0
- data/test/fixtures/journey_opens.json +55 -0
- data/test/fixtures/journey_recipients.json +27 -0
- data/test/fixtures/journey_summary.json +18 -0
- data/test/fixtures/journey_unsubscribes.json +26 -0
- data/test/fixtures/journeys.json +20 -0
- data/test/fixtures/scheduled_campaigns.json +4 -2
- data/test/fixtures/segment_subscribers.json +2 -0
- data/test/fixtures/subscriber_details.json +1 -0
- data/test/fixtures/subscriber_details_with_track_pref.json +23 -0
- data/test/fixtures/tags.json +10 -0
- data/test/fixtures/unconfirmed_subscribers.json +6 -2
- data/test/fixtures/unsubscribed_subscribers.json +6 -1
- data/test/helper.rb +3 -2
- data/test/journey_test.rb +156 -0
- data/test/list_test.rb +16 -9
- data/test/person_test.rb +3 -3
- data/test/segment_test.rb +2 -1
- data/test/subscriber_test.rb +22 -12
- metadata +25 -9
@@ -0,0 +1,41 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'createsend'
|
3
|
+
|
4
|
+
class ListsSample
|
5
|
+
def initialize
|
6
|
+
raise 'CREATESEND_ACCESS_TOKEN env var missing' if ENV['CREATESEND_ACCESS_TOKEN'].nil?
|
7
|
+
raise 'CREATESEND_REFRESH_TOKEN env var missing' if ENV['CREATESEND_REFRESH_TOKEN'].nil?
|
8
|
+
raise 'CREATESEND_LIST_ID env var missing' if ENV['CREATESEND_LIST_ID'].nil?
|
9
|
+
|
10
|
+
auth = {:access_token => ENV['CREATESEND_ACCESS_TOKEN'], :refresh_token => ENV['CREATESEND_REFRESH_TOKEN']}
|
11
|
+
@list = CreateSend::List.new auth, ENV['CREATESEND_LIST_ID']
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_active_subscribers
|
15
|
+
@list.active
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_bounced_subscribers
|
19
|
+
@list.bounced
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_unsubscribed_subscribers
|
23
|
+
@list.unsubscribed
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_unconfirmed_subscribers
|
27
|
+
@list.unconfirmed
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_deleted_subscribers
|
31
|
+
@list.deleted
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
sample = ListsSample.new
|
36
|
+
|
37
|
+
puts "All active subscribers: #{sample.get_active_subscribers.to_json}\n\n"
|
38
|
+
puts "All bounced subscribers: #{sample.get_bounced_subscribers.to_json}\n\n"
|
39
|
+
puts "All unsubscribed subscribers: #{sample.get_unsubscribed_subscribers.to_json}\n\n"
|
40
|
+
puts "All unconfirmed subscribers: #{sample.get_unconfirmed_subscribers.to_json}\n\n"
|
41
|
+
puts "All deleted subscribers: #{sample.get_deleted_subscribers.to_json}\n\n"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'createsend'
|
3
|
+
|
4
|
+
class SegmentsSample
|
5
|
+
def initialize
|
6
|
+
raise 'CREATESEND_ACCESS_TOKEN env var missing' if ENV['CREATESEND_ACCESS_TOKEN'].nil?
|
7
|
+
raise 'CREATESEND_REFRESH_TOKEN env var missing' if ENV['CREATESEND_REFRESH_TOKEN'].nil?
|
8
|
+
raise 'CREATESEND_SEGMENT_ID env var missing' if ENV['CREATESEND_SEGMENT_ID'].nil?
|
9
|
+
|
10
|
+
auth = {:access_token => ENV['CREATESEND_ACCESS_TOKEN'], :refresh_token => ENV['CREATESEND_REFRESH_TOKEN']}
|
11
|
+
@segment = CreateSend::Segment.new auth, ENV['CREATESEND_SEGMENT_ID']
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_active_subscribers
|
15
|
+
@segment.subscribers
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
sample = SegmentsSample.new
|
20
|
+
|
21
|
+
puts "All active subscribers: #{sample.get_active_subscribers.to_json}\n\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'createsend'
|
3
|
+
|
4
|
+
class SubscribersSample
|
5
|
+
def initialize
|
6
|
+
raise 'CREATESEND_ACCESS_TOKEN env var missing' if ENV['CREATESEND_ACCESS_TOKEN'].nil?
|
7
|
+
raise 'CREATESEND_REFRESH_TOKEN env var missing' if ENV['CREATESEND_REFRESH_TOKEN'].nil?
|
8
|
+
raise 'CREATESEND_LIST_ID env var missing' if ENV['CREATESEND_LIST_ID'].nil?
|
9
|
+
raise 'CREATESEND_EMAIL_ADDRESS env var missing' if ENV['CREATESEND_EMAIL_ADDRESS'].nil?
|
10
|
+
|
11
|
+
auth = {:access_token => ENV['CREATESEND_ACCESS_TOKEN'], :refresh_token => ENV['CREATESEND_REFRESH_TOKEN']}
|
12
|
+
@subscriber = CreateSend::Subscriber.get auth, ENV['CREATESEND_LIST_ID'], ENV['CREATESEND_EMAIL_ADDRESS']
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_subscriber
|
16
|
+
@subscriber
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
sample = SubscribersSample.new
|
21
|
+
|
22
|
+
puts "detailed subscribers: #{sample.get_subscriber.to_json}\n\n"
|
data/test/administrator_test.rb
CHANGED
@@ -8,7 +8,7 @@ class AdministratorTest < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
should "get a administrator by email address" do
|
10
10
|
email = "admin@example.com"
|
11
|
-
stub_get(@auth, "admins.json?email=#{
|
11
|
+
stub_get(@auth, "admins.json?email=#{ERB::Util.url_encode(email)}", "admin_details.json")
|
12
12
|
admin = CreateSend::Administrator.get @auth, email
|
13
13
|
admin.EmailAddress.should == email
|
14
14
|
admin.Name.should == "Admin One"
|
@@ -24,13 +24,13 @@ class AdministratorTest < Test::Unit::TestCase
|
|
24
24
|
should "update an administrator" do
|
25
25
|
email = "admin@example.com"
|
26
26
|
new_email = "new_email_address@example.com"
|
27
|
-
stub_put(@auth, "admins.json?email=#{
|
27
|
+
stub_put(@auth, "admins.json?email=#{ERB::Util.url_encode(email)}", nil)
|
28
28
|
@admin.update new_email, "Admin Name"
|
29
29
|
@admin.email_address.should == new_email
|
30
30
|
end
|
31
31
|
|
32
32
|
should "delete an admin" do
|
33
|
-
stub_delete(@auth, "admins.json?email=#{
|
33
|
+
stub_delete(@auth, "admins.json?email=#{ERB::Util.url_encode(@admin.email_address)}", nil)
|
34
34
|
@admin.delete
|
35
35
|
end
|
36
36
|
end
|
data/test/campaign_test.rb
CHANGED
@@ -137,6 +137,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
137
137
|
should "get the summary for a campaign" do
|
138
138
|
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/summary.json", "campaign_summary.json")
|
139
139
|
summary = @campaign.summary
|
140
|
+
summary.Name.should == "Campaign Name"
|
140
141
|
summary.Recipients.should == 5
|
141
142
|
summary.TotalOpened.should == 10
|
142
143
|
summary.Clicks.should == 0
|
@@ -191,7 +192,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
191
192
|
|
192
193
|
should "get the opens for a campaign" do
|
193
194
|
min_date = "2010-01-01"
|
194
|
-
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/opens.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{
|
195
|
+
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/opens.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}", "campaign_opens.json")
|
195
196
|
opens = @campaign.opens min_date
|
196
197
|
opens.Results.size.should == 5
|
197
198
|
opens.Results.first.EmailAddress.should == "subs+6576576576@example.com"
|
@@ -215,7 +216,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
215
216
|
|
216
217
|
should "get the subscriber clicks for a campaign" do
|
217
218
|
min_date = "2010-01-01"
|
218
|
-
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/clicks.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{
|
219
|
+
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/clicks.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}", "campaign_clicks.json")
|
219
220
|
clicks = @campaign.clicks min_date
|
220
221
|
clicks.Results.size.should == 3
|
221
222
|
clicks.Results.first.EmailAddress.should == "subs+6576576576@example.com"
|
@@ -240,7 +241,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
240
241
|
|
241
242
|
should "get the unsubscribes for a campaign" do
|
242
243
|
min_date = "2010-01-01"
|
243
|
-
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/unsubscribes.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{
|
244
|
+
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/unsubscribes.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}", "campaign_unsubscribes.json")
|
244
245
|
unsubscribes = @campaign.unsubscribes min_date
|
245
246
|
unsubscribes.Results.size.should == 1
|
246
247
|
unsubscribes.Results.first.EmailAddress.should == "subs+6576576576@example.com"
|
@@ -258,7 +259,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
258
259
|
|
259
260
|
should "get the spam complaints for a campaign" do
|
260
261
|
min_date = "2010-01-01"
|
261
|
-
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/spam.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{
|
262
|
+
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/spam.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}", "campaign_spam.json")
|
262
263
|
spam = @campaign.spam min_date
|
263
264
|
spam.Results.size.should == 1
|
264
265
|
spam.Results.first.EmailAddress.should == "subs+6576576576@example.com"
|
@@ -275,7 +276,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
275
276
|
|
276
277
|
should "get the bounces for a campaign" do
|
277
278
|
min_date = "2010-01-01"
|
278
|
-
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/bounces.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{
|
279
|
+
stub_get(@auth, "campaigns/#{@campaign.campaign_id}/bounces.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}", "campaign_bounces.json")
|
279
280
|
bounces = @campaign.bounces min_date
|
280
281
|
bounces.Results.size.should == 2
|
281
282
|
bounces.Results.first.EmailAddress.should == "asdf@softbouncemyemail.com"
|
data/test/client_test.rb
CHANGED
@@ -26,51 +26,74 @@ class ClientTest < Test::Unit::TestCase
|
|
26
26
|
end
|
27
27
|
|
28
28
|
should "get all campaigns" do
|
29
|
-
stub_get(@auth, "clients/#{@client.client_id}/campaigns.json", "campaigns.json")
|
29
|
+
stub_get(@auth, "clients/#{@client.client_id}/campaigns.json?page=1&pagesize=1000&orderdirection=desc&sentfromdate=&senttodate=&tags=", "campaigns.json")
|
30
30
|
campaigns = @client.campaigns
|
31
|
-
campaigns.size.should == 2
|
32
|
-
campaigns.
|
33
|
-
campaigns.
|
34
|
-
campaigns.
|
35
|
-
campaigns.
|
36
|
-
campaigns.
|
37
|
-
campaigns.
|
38
|
-
campaigns.
|
39
|
-
|
40
|
-
campaigns.first
|
41
|
-
|
31
|
+
campaigns.Results.size.should == 2
|
32
|
+
campaigns.ResultsOrderedBy == 'sentdate'
|
33
|
+
campaigns.OrderDirection = 'desc'
|
34
|
+
campaigns.PageNumber == 1
|
35
|
+
campaigns.PageSize == 1000
|
36
|
+
campaigns.RecordsOnThisPage == 2
|
37
|
+
campaigns.TotalNumberOfRecords == 2
|
38
|
+
campaigns.NumberOfPages == 1
|
39
|
+
|
40
|
+
campaign = campaigns.Results.first
|
41
|
+
campaign.CampaignID.should == 'fc0ce7105baeaf97f47c99be31d02a91'
|
42
|
+
campaign.WebVersionURL.should == 'http://createsend.com/t/r-765E86829575EE2C'
|
43
|
+
campaign.WebVersionTextURL.should == 'http://createsend.com/t/r-765E86829575EE2C/t'
|
44
|
+
campaign.Subject.should == 'Campaign One'
|
45
|
+
campaign.Name.should == 'Campaign One'
|
46
|
+
campaign.SentDate.should == '2010-10-12 12:58:00'
|
47
|
+
campaign.TotalRecipients.should == 2245
|
48
|
+
campaign.FromName.should == 'My Name'
|
49
|
+
campaign.FromEmail.should == 'myemail@example.com'
|
50
|
+
campaign.ReplyTo.should == 'myemail@example.com'
|
51
|
+
campaign.Tags.should == []
|
42
52
|
end
|
43
53
|
|
44
54
|
should "get scheduled campaigns" do
|
45
55
|
stub_get(@auth, "clients/#{@client.client_id}/scheduled.json", "scheduled_campaigns.json")
|
46
56
|
campaigns = @client.scheduled
|
47
57
|
campaigns.size.should == 2
|
48
|
-
campaigns.first
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
campaign = campaigns.first
|
59
|
+
campaign.DateScheduled.should == "2011-05-25 10:40:00"
|
60
|
+
campaign.ScheduledTimeZone.should == "(GMT+10:00) Canberra, Melbourne, Sydney"
|
61
|
+
campaign.CampaignID.should == "827dbbd2161ea9989fa11ad562c66937"
|
62
|
+
campaign.Name.should == "Magic Issue One"
|
63
|
+
campaign.Subject.should == "Magic Issue One"
|
64
|
+
campaign.DateCreated.should == "2011-05-24 10:37:00"
|
65
|
+
campaign.PreviewURL.should == "http://createsend.com/t/r-DD543521A87C9B8B"
|
66
|
+
campaign.PreviewTextURL.should == "http://createsend.com/t/r-DD543521A87C9B8B/t"
|
67
|
+
campaign.FromName.should == 'My Name'
|
68
|
+
campaign.FromEmail.should == 'myemail@example.com'
|
69
|
+
campaign.ReplyTo.should == 'myemail@example.com'
|
70
|
+
campaign.Tags.should == ['tagexample']
|
59
71
|
end
|
60
72
|
|
61
73
|
should "get all drafts" do
|
62
74
|
stub_get(@auth, "clients/#{@client.client_id}/drafts.json", "drafts.json")
|
63
75
|
drafts = @client.drafts
|
64
76
|
drafts.size.should == 2
|
65
|
-
drafts.first
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
77
|
+
draft = drafts.first
|
78
|
+
draft.CampaignID.should == '7c7424792065d92627139208c8c01db1'
|
79
|
+
draft.Name.should == 'Draft One'
|
80
|
+
draft.Subject.should == 'Draft One'
|
81
|
+
draft.DateCreated.should == '2010-08-19 16:08:00'
|
82
|
+
draft.PreviewURL.should == 'http://createsend.com/t/r-E97A7BB2E6983DA1'
|
83
|
+
draft.PreviewTextURL.should == 'http://createsend.com/t/r-E97A7BB2E6983DA1/t'
|
84
|
+
draft.FromName.should == 'My Name'
|
85
|
+
draft.FromEmail.should == 'myemail@example.com'
|
86
|
+
draft.ReplyTo.should == 'myemail@example.com'
|
87
|
+
draft.Tags.should == ['tagexample']
|
88
|
+
end
|
89
|
+
|
90
|
+
should "get all client tags" do
|
91
|
+
stub_get(@auth, "clients/#{@client.client_id}/tags.json", "tags.json")
|
92
|
+
tags = @client.tags
|
93
|
+
tags.size.should == 2
|
94
|
+
tag = tags.first
|
95
|
+
tag.Name.should == 'Tag One'
|
96
|
+
tag.NumberOfCampaigns.should == '120'
|
74
97
|
end
|
75
98
|
|
76
99
|
should "get all lists" do
|
@@ -83,7 +106,7 @@ class ClientTest < Test::Unit::TestCase
|
|
83
106
|
|
84
107
|
should "get all lists to which a subscriber with a particular email address belongs" do
|
85
108
|
email = "valid@example.com"
|
86
|
-
stub_get(@auth, "clients/#{@client.client_id}/listsforemail.json?email=#{
|
109
|
+
stub_get(@auth, "clients/#{@client.client_id}/listsforemail.json?email=#{ERB::Util.url_encode(email)}", "listsforemail.json")
|
87
110
|
lists = @client.lists_for_email(email)
|
88
111
|
lists.size.should == 2
|
89
112
|
lists.first.ListID.should == 'ab4a2b57c7c8f1ba62f898a1af1a575b'
|
@@ -131,7 +154,7 @@ class ClientTest < Test::Unit::TestCase
|
|
131
154
|
|
132
155
|
should "unsuppress an email address" do
|
133
156
|
email = "example@example.com"
|
134
|
-
stub_put(@auth, "clients/#{@client.client_id}/unsuppress.json?email=#{
|
157
|
+
stub_put(@auth, "clients/#{@client.client_id}/unsuppress.json?email=#{ERB::Util.url_encode(email)}", nil)
|
135
158
|
result = @client.unsuppress email
|
136
159
|
end
|
137
160
|
|
@@ -155,7 +178,7 @@ class ClientTest < Test::Unit::TestCase
|
|
155
178
|
|
156
179
|
should "set primary contact" do
|
157
180
|
email = 'person@blackhole.com'
|
158
|
-
stub_put(@auth, "clients/#{@client.client_id}/primarycontact.json?email=#{
|
181
|
+
stub_put(@auth, "clients/#{@client.client_id}/primarycontact.json?email=#{ERB::Util.url_encode(email)}", 'client_set_primary_contact.json')
|
159
182
|
result = @client.set_primary_contact email
|
160
183
|
result.EmailAddress.should == email
|
161
184
|
end
|
@@ -217,6 +240,14 @@ class ClientTest < Test::Unit::TestCase
|
|
217
240
|
stub_delete(@auth, "clients/#{@client.client_id}.json", nil)
|
218
241
|
@client.delete
|
219
242
|
end
|
220
|
-
|
243
|
+
|
244
|
+
should "get all journeys" do
|
245
|
+
stub_get(@auth, "clients/#{@client.client_id}/journeys.json", "journeys.json")
|
246
|
+
lists = @client.journeys
|
247
|
+
lists.size.should == 3
|
248
|
+
lists.first.ListID.should == 'a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a'
|
249
|
+
lists.first.Name.should == 'Journey One'
|
250
|
+
lists.first.Status.should == 'Not started'
|
251
|
+
end
|
221
252
|
end
|
222
253
|
end
|
data/test/createsend_test.rb
CHANGED
@@ -82,7 +82,7 @@ class CreateSendTest < Test::Unit::TestCase
|
|
82
82
|
FakeWeb.register_uri(:post, "https://api.createsend.com/oauth/token", options)
|
83
83
|
new_access_token, new_expires_in, new_refresh_token = CreateSend::CreateSend.refresh_access_token refresh_token
|
84
84
|
|
85
|
-
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{
|
85
|
+
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{ERB::Util.url_encode(refresh_token)}"
|
86
86
|
new_access_token.should == "SlAV32hkKG2e12e"
|
87
87
|
new_expires_in.should == 1209600
|
88
88
|
new_refresh_token.should == "tGzv3JOkF0XG5Qx2TlKWIA"
|
@@ -97,7 +97,7 @@ class CreateSendTest < Test::Unit::TestCase
|
|
97
97
|
lambda { access_token, expires_in, refresh_token = CreateSend::CreateSend.refresh_access_token(
|
98
98
|
refresh_token) }.should raise_error(
|
99
99
|
Exception, 'Error refreshing access token: invalid_grant - Specified refresh_token was invalid or expired')
|
100
|
-
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{
|
100
|
+
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{ERB::Util.url_encode(refresh_token)}"
|
101
101
|
end
|
102
102
|
|
103
103
|
end
|
@@ -120,7 +120,7 @@ class CreateSendTest < Test::Unit::TestCase
|
|
120
120
|
cs = CreateSend::CreateSend.new @auth
|
121
121
|
new_access_token, new_expires_in, new_refresh_token = cs.refresh_token
|
122
122
|
|
123
|
-
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{
|
123
|
+
FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{ERB::Util.url_encode(@auth[:refresh_token])}"
|
124
124
|
new_access_token.should == "SlAV32hkKG2e12e"
|
125
125
|
new_expires_in.should == 1209600
|
126
126
|
new_refresh_token.should == "tGzv3JOkF0XG5Qx2TlKWIA"
|
@@ -246,7 +246,7 @@ class CreateSendTest < Test::Unit::TestCase
|
|
246
246
|
|
247
247
|
should "set primary contact" do
|
248
248
|
email = 'admin@blackhole.com'
|
249
|
-
stub_put(@auth, "primarycontact.json?email=#{
|
249
|
+
stub_put(@auth, "primarycontact.json?email=#{ERB::Util.url_encode(email)}", 'admin_set_primary_contact.json')
|
250
250
|
result = @cs.set_primary_contact email
|
251
251
|
result.EmailAddress.should == email
|
252
252
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
"EmailAddress": "subs+7t8787Y@example.com",
|
5
5
|
"Name": "Person One",
|
6
6
|
"Date": "2010-10-25 10:28:00",
|
7
|
+
"ListJoinedDate": "2010-10-25 10:28:00",
|
7
8
|
"State": "Active",
|
8
9
|
"CustomFields": [
|
9
10
|
{
|
@@ -33,6 +34,7 @@
|
|
33
34
|
"EmailAddress": "subs+7878787y8ggg@example.com",
|
34
35
|
"Name": "Person Two",
|
35
36
|
"Date": "2010-10-25 12:17:00",
|
37
|
+
"ListJoinedDate": "2010-10-25 12:17:00",
|
36
38
|
"State": "Active",
|
37
39
|
"CustomFields": [
|
38
40
|
{
|
@@ -46,6 +48,7 @@
|
|
46
48
|
"EmailAddress": "subs+7890909i0ggg@example.com",
|
47
49
|
"Name": "Person Three",
|
48
50
|
"Date": "2010-10-25 12:52:00",
|
51
|
+
"ListJoinedDate": "2010-10-25 12:52:00",
|
49
52
|
"State": "Active",
|
50
53
|
"CustomFields": [
|
51
54
|
{
|
@@ -59,6 +62,7 @@
|
|
59
62
|
"EmailAddress": "subs@example.com",
|
60
63
|
"Name": "Person Four",
|
61
64
|
"Date": "2010-10-27 13:13:00",
|
65
|
+
"ListJoinedDate": "2010-10-27 13:13:00",
|
62
66
|
"State": "Active",
|
63
67
|
"CustomFields": [],
|
64
68
|
"ReadsEmailWith": ""
|
@@ -67,6 +71,7 @@
|
|
67
71
|
"EmailAddress": "joey@example.com",
|
68
72
|
"Name": "Person Five",
|
69
73
|
"Date": "2010-10-27 13:13:00",
|
74
|
+
"ListJoinedDate": "2010-10-27 13:13:00",
|
70
75
|
"State": "Active",
|
71
76
|
"CustomFields": [],
|
72
77
|
"ReadsEmailWith": "Gmail"
|
@@ -11,5 +11,6 @@
|
|
11
11
|
"WebVersionURL": "http://createsend.com/t/r-3A433FC72FFE3B8B",
|
12
12
|
"WebVersionTextURL": "http://createsend.com/t/r-3A433FC72FFE3B8B/t",
|
13
13
|
"WorldviewURL": "http://client.createsend.com/reports/wv/r/3A433FC72FFE3B8B",
|
14
|
-
"SpamComplaints": 23
|
14
|
+
"SpamComplaints": 23,
|
15
|
+
"Name": "Campaign Name"
|
15
16
|
}
|
@@ -1,26 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
{
|
2
|
+
"Results": [
|
3
|
+
{
|
4
|
+
"WebVersionURL": "http://createsend.com/t/r-765E86829575EE2C",
|
5
|
+
"WebVersionTextURL": "http://createsend.com/t/r-765E86829575EE2C/t",
|
6
|
+
"CampaignID": "fc0ce7105baeaf97f47c99be31d02a91",
|
7
|
+
"Subject": "Campaign One",
|
8
|
+
"Name": "Campaign One",
|
9
|
+
"FromName": "My Name",
|
10
|
+
"FromEmail": "myemail@example.com",
|
11
|
+
"ReplyTo": "myemail@example.com",
|
12
|
+
"SentDate": "2010-10-12 12:58:00",
|
13
|
+
"TotalRecipients": 2245,
|
14
|
+
"Tags": []
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"WebVersionURL": "http://createsend.com/t/r-DD543566A87C9B8B",
|
18
|
+
"WebVersionTextURL": "http://createsend.com/t/r-DD543566A87C9B8B/t",
|
19
|
+
"CampaignID": "072472b88c853ae5dedaeaf549a8d607",
|
20
|
+
"Subject": "Campaign Two",
|
21
|
+
"Name": "Campaign Two",
|
22
|
+
"FromName": "My Name",
|
23
|
+
"FromEmail": "myemail@example.com",
|
24
|
+
"ReplyTo": "myemail@example.com",
|
25
|
+
"SentDate": "2010-10-06 16:20:00",
|
26
|
+
"TotalRecipients": 11222,
|
27
|
+
"Tags": ["tagexample"]
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"ResultsOrderedBy": "sentdate",
|
31
|
+
"OrderDirection": "desc",
|
32
|
+
"PageNumber": 1,
|
33
|
+
"PageSize": 1000,
|
34
|
+
"RecordsOnThisPage": 2,
|
35
|
+
"TotalNumberOfRecords": 2,
|
36
|
+
"NumberOfPages": 1
|
37
|
+
}
|
@@ -4,6 +4,7 @@
|
|
4
4
|
"EmailAddress": "subscriber@example.com",
|
5
5
|
"Name": "Deleted One",
|
6
6
|
"Date": "2010-10-25 13:11:00",
|
7
|
+
"ListJoinedDate": "2010-10-25 13:11:00",
|
7
8
|
"State": "Deleted",
|
8
9
|
"CustomFields": [],
|
9
10
|
"ReadsEmailWith": "Gmail"
|
@@ -12,6 +13,7 @@
|
|
12
13
|
"EmailAddress": "subscriberone@example.com",
|
13
14
|
"Name": "Subscriber",
|
14
15
|
"Date": "2010-10-25 13:04:00",
|
16
|
+
"ListJoinedDate": "2010-10-25 13:04:00",
|
15
17
|
"State": "Deleted",
|
16
18
|
"CustomFields": [
|
17
19
|
{
|
@@ -25,6 +27,7 @@
|
|
25
27
|
"EmailAddress": "example+1@example.com",
|
26
28
|
"Name": "Example One",
|
27
29
|
"Date": "2010-10-26 10:56:00",
|
30
|
+
"ListJoinedDate": "2010-10-26 10:56:00",
|
28
31
|
"State": "Deleted",
|
29
32
|
"CustomFields": [],
|
30
33
|
"ReadsEmailWith": ""
|
@@ -33,6 +36,7 @@
|
|
33
36
|
"EmailAddress": "example+2@example.com",
|
34
37
|
"Name": "Example Two",
|
35
38
|
"Date": "2010-10-26 10:56:00",
|
39
|
+
"ListJoinedDate": "2010-10-26 10:56:00",
|
36
40
|
"State": "Deleted",
|
37
41
|
"CustomFields": [],
|
38
42
|
"ReadsEmailWith": ""
|
@@ -41,6 +45,7 @@
|
|
41
45
|
"EmailAddress": "example+3@example.com",
|
42
46
|
"Name": "Example Three",
|
43
47
|
"Date": "2010-10-26 10:56:00",
|
48
|
+
"ListJoinedDate": "2010-10-26 10:56:00",
|
44
49
|
"State": "Deleted",
|
45
50
|
"CustomFields": [],
|
46
51
|
"ReadsEmailWith": "Gmail"
|
data/test/fixtures/drafts.json
CHANGED
@@ -8,7 +8,8 @@
|
|
8
8
|
"ReplyTo": "myemail@example.com",
|
9
9
|
"DateCreated": "2010-08-19 16:08:00",
|
10
10
|
"PreviewURL": "http://createsend.com/t/r-E97A7BB2E6983DA1",
|
11
|
-
"PreviewTextURL": "http://createsend.com/t/r-E97A7BB2E6983DA1/t"
|
11
|
+
"PreviewTextURL": "http://createsend.com/t/r-E97A7BB2E6983DA1/t",
|
12
|
+
"Tags": ["tagexample"]
|
12
13
|
},
|
13
14
|
{
|
14
15
|
"CampaignID": "2e928e982065d92627139208c8c01db1",
|
@@ -19,6 +20,7 @@
|
|
19
20
|
"ReplyTo": "myemail@example.com",
|
20
21
|
"DateCreated": "2010-08-19 16:08:00",
|
21
22
|
"PreviewURL": "http://createsend.com/t/r-E97A7BB2E6983DA1",
|
22
|
-
"PreviewTextURL": "http://createsend.com/t/r-E97A7BB2E6983DA1/t"
|
23
|
+
"PreviewTextURL": "http://createsend.com/t/r-E97A7BB2E6983DA1/t",
|
24
|
+
"Tags": []
|
23
25
|
}
|
24
26
|
]
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"Results": [
|
3
|
+
{
|
4
|
+
"EmailAddress": "example+1@example.com",
|
5
|
+
"BounceType": "4",
|
6
|
+
"Date": "2019-07-29 10:33:00",
|
7
|
+
"Reason": "Soft Bounce - Mailbox Full"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"EmailAddress": "example+2@example.com",
|
11
|
+
"BounceType": "1",
|
12
|
+
"Date": "2019-07-29 10:35:00",
|
13
|
+
"Reason": "Hard Bounce"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"EmailAddress": "example+3@example.com",
|
17
|
+
"BounceType": "1",
|
18
|
+
"Date": "2019-07-29 10:35:00",
|
19
|
+
"Reason": "Hard Bounce"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"EmailAddress": "example+4@example.com",
|
23
|
+
"BounceType": "1",
|
24
|
+
"Date": "2019-07-29 10:35:00",
|
25
|
+
"Reason": "Hard Bounce"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"ResultsOrderedBy": "Date",
|
29
|
+
"OrderDirection": "ASC",
|
30
|
+
"PageNumber": 1,
|
31
|
+
"PageSize": 1000,
|
32
|
+
"RecordsOnThisPage": 4,
|
33
|
+
"TotalNumberOfRecords": 4,
|
34
|
+
"NumberOfPages": 1
|
35
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"Results": [
|
3
|
+
{
|
4
|
+
"EmailAddress": "example+1@example.com",
|
5
|
+
"Date": "2019-07-29 10:33:00",
|
6
|
+
"URL": "http://test.com",
|
7
|
+
"IPAddress": "192.168.0.3",
|
8
|
+
"Latitude": -33.8683,
|
9
|
+
"Longitude": 151.2086,
|
10
|
+
"City": "Sydney",
|
11
|
+
"Region": "New South Wales",
|
12
|
+
"CountryCode": "AU",
|
13
|
+
"CountryName": "Australia"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"EmailAddress": "example+2@example.com",
|
17
|
+
"Date": "2019-07-29 10:35:00",
|
18
|
+
"URL": "http://test.com",
|
19
|
+
"IPAddress": "192.168.0.3",
|
20
|
+
"Latitude": -33.8683,
|
21
|
+
"Longitude": 151.2086,
|
22
|
+
"City": "Sydney",
|
23
|
+
"Region": "New South Wales",
|
24
|
+
"CountryCode": "AU",
|
25
|
+
"CountryName": "Australia"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"ResultsOrderedBy": "Date",
|
29
|
+
"OrderDirection": "ASC",
|
30
|
+
"PageNumber": 1,
|
31
|
+
"PageSize": 2,
|
32
|
+
"RecordsOnThisPage": 2,
|
33
|
+
"TotalNumberOfRecords": 5,
|
34
|
+
"NumberOfPages": 3
|
35
|
+
}
|