createsend 4.1.2 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/HISTORY.md +29 -0
  3. data/README.md +4 -4
  4. data/RELEASE.md +1 -1
  5. data/Rakefile +1 -1
  6. data/createsend.gemspec +1 -1
  7. data/lib/createsend/campaign.rb +1 -1
  8. data/lib/createsend/client.rb +25 -3
  9. data/lib/createsend/createsend.rb +3 -1
  10. data/lib/createsend/journey.rb +58 -0
  11. data/lib/createsend/list.rb +13 -12
  12. data/lib/createsend/segment.rb +3 -2
  13. data/lib/createsend/subscriber.rb +15 -10
  14. data/lib/createsend/version.rb +1 -1
  15. data/lib/createsend.rb +1 -0
  16. data/samples/authentication_sample.rb +64 -0
  17. data/samples/clients_sample.rb +79 -0
  18. data/samples/journey_sample.rb +87 -0
  19. data/samples/lists_sample.rb +41 -0
  20. data/samples/segments_sample.rb +21 -0
  21. data/samples/subscribes_sample.rb +22 -0
  22. data/test/administrator_test.rb +3 -3
  23. data/test/campaign_test.rb +6 -5
  24. data/test/client_test.rb +67 -36
  25. data/test/createsend_test.rb +4 -4
  26. data/test/fixtures/active_subscribers.json +5 -0
  27. data/test/fixtures/bounced_subscribers.json +1 -0
  28. data/test/fixtures/campaign_summary.json +2 -1
  29. data/test/fixtures/campaigns.json +37 -26
  30. data/test/fixtures/deleted_subscribers.json +5 -0
  31. data/test/fixtures/drafts.json +4 -2
  32. data/test/fixtures/journey_bounces.json +35 -0
  33. data/test/fixtures/journey_clicks.json +35 -0
  34. data/test/fixtures/journey_opens.json +55 -0
  35. data/test/fixtures/journey_recipients.json +27 -0
  36. data/test/fixtures/journey_summary.json +18 -0
  37. data/test/fixtures/journey_unsubscribes.json +26 -0
  38. data/test/fixtures/journeys.json +20 -0
  39. data/test/fixtures/scheduled_campaigns.json +4 -2
  40. data/test/fixtures/segment_subscribers.json +2 -0
  41. data/test/fixtures/subscriber_details.json +1 -0
  42. data/test/fixtures/subscriber_details_with_track_pref.json +23 -0
  43. data/test/fixtures/tags.json +10 -0
  44. data/test/fixtures/unconfirmed_subscribers.json +6 -2
  45. data/test/fixtures/unsubscribed_subscribers.json +6 -1
  46. data/test/helper.rb +3 -2
  47. data/test/journey_test.rb +156 -0
  48. data/test/list_test.rb +16 -9
  49. data/test/person_test.rb +3 -3
  50. data/test/segment_test.rb +2 -1
  51. data/test/subscriber_test.rb +22 -12
  52. metadata +25 -9
@@ -0,0 +1,55 @@
1
+ {
2
+ "Results": [
3
+ {
4
+ "EmailAddress": "example+1@example.com",
5
+ "Date": "2019-07-29 10:33:00",
6
+ "IPAddress": "192.168.0.3",
7
+ "Latitude": -33.8683,
8
+ "Longitude": 151.2086,
9
+ "City": "Sydney",
10
+ "Region": "New South Wales",
11
+ "CountryCode": "AU",
12
+ "CountryName": "Australia"
13
+ },
14
+ {
15
+ "EmailAddress": "example+2@example.com",
16
+ "Date": "2019-07-29 10:35:00",
17
+ "IPAddress": "192.168.0.3",
18
+ "Latitude": -33.8683,
19
+ "Longitude": 151.2086,
20
+ "City": "Sydney",
21
+ "Region": "New South Wales",
22
+ "CountryCode": "AU",
23
+ "CountryName": "Australia"
24
+ },
25
+ {
26
+ "EmailAddress": "example+3@example.com",
27
+ "Date": "2019-07-29 10:35:00",
28
+ "IPAddress": "192.168.0.3",
29
+ "Latitude": -33.8683,
30
+ "Longitude": 151.2086,
31
+ "City": "Sydney",
32
+ "Region": "New South Wales",
33
+ "CountryCode": "AU",
34
+ "CountryName": "Australia"
35
+ },
36
+ {
37
+ "EmailAddress": "example+4@example.com",
38
+ "Date": "2019-07-29 10:35:00",
39
+ "IPAddress": "192.168.0.3",
40
+ "Latitude": -33.8683,
41
+ "Longitude": 151.2086,
42
+ "City": "Sydney",
43
+ "Region": "New South Wales",
44
+ "CountryCode": "AU",
45
+ "CountryName": "Australia"
46
+ }
47
+ ],
48
+ "ResultsOrderedBy": "Date",
49
+ "OrderDirection": "ASC",
50
+ "PageNumber": 1,
51
+ "PageSize": 1000,
52
+ "RecordsOnThisPage": 4,
53
+ "TotalNumberOfRecords": 4,
54
+ "NumberOfPages": 1
55
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "Results": [
3
+ {
4
+ "EmailAddress": "example+1@example.com",
5
+ "SentDate": "2019-07-12 09:45:00"
6
+ },
7
+ {
8
+ "EmailAddress": "example+2@example.com",
9
+ "SentDate": "2019-07-12 10:45:00"
10
+ },
11
+ {
12
+ "EmailAddress": "example+3@example.com",
13
+ "SentDate": "2019-07-13 09:00:00"
14
+ },
15
+ {
16
+ "EmailAddress": "example+4@example.com",
17
+ "SentDate": "2019-07-16 11:45:00"
18
+ }
19
+ ],
20
+ "ResultsOrderedBy": "SentDate",
21
+ "OrderDirection": "ASC",
22
+ "PageNumber": 2,
23
+ "PageSize": 10,
24
+ "RecordsOnThisPage": 4,
25
+ "TotalNumberOfRecords": 14,
26
+ "NumberOfPages": 2
27
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "JourneyID": "a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
3
+ "Name": "New journey",
4
+ "TriggerType": "On Subscription",
5
+ "Status": "Active",
6
+ "Emails": [
7
+ {
8
+ "EmailID": "b1b1b1b1b1b1b1b1b1b1",
9
+ "Name": "New Email",
10
+ "Bounced": 0,
11
+ "Clicked": 0,
12
+ "Opened": 3,
13
+ "Sent": 1,
14
+ "UniqueOpened": 1,
15
+ "Unsubscribed": 0
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "Results": [
3
+ {
4
+ "EmailAddress": "example+1@example.com",
5
+ "Date": "2019-07-29 10:33:00",
6
+ "IPAddress": "192.168.0.3"
7
+ },
8
+ {
9
+ "EmailAddress": "example+2@example.com",
10
+ "Date": "2019-07-29 10:35:00",
11
+ "IPAddress": "192.168.0.3"
12
+ },
13
+ {
14
+ "EmailAddress": "example+3@example.com",
15
+ "Date": "2019-07-29 10:35:00",
16
+ "IPAddress": "192.168.0.3"
17
+ }
18
+ ],
19
+ "ResultsOrderedBy": "Date",
20
+ "OrderDirection": "ASC",
21
+ "PageNumber": 1,
22
+ "PageSize": 1000,
23
+ "RecordsOnThisPage": 4,
24
+ "TotalNumberOfRecords": 4,
25
+ "NumberOfPages": 1
26
+ }
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ "ListID": "a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a",
4
+ "JourneyID": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b",
5
+ "Name": "Journey One",
6
+ "Status": "Not started"
7
+ },
8
+ {
9
+ "ListID": "c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c",
10
+ "JourneyID": "d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d",
11
+ "Name": "Journey Two",
12
+ "Status": "Active"
13
+ },
14
+ {
15
+ "ListID": "c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c",
16
+ "JourneyID": "e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e",
17
+ "Name": "Journey Three",
18
+ "Status": "Paused"
19
+ }
20
+ ]
@@ -10,7 +10,8 @@
10
10
  "ReplyTo": "myemail@example.com",
11
11
  "DateCreated": "2011-05-24 10:37:00",
12
12
  "PreviewURL": "http://createsend.com/t/r-DD543521A87C9B8B",
13
- "PreviewTextURL": "http://createsend.com/t/r-DD543521A87C9B8B/t"
13
+ "PreviewTextURL": "http://createsend.com/t/r-DD543521A87C9B8B/t",
14
+ "Tags": ["tagexample"]
14
15
  },
15
16
  {
16
17
  "DateScheduled": "2011-05-29 11:20:00",
@@ -23,6 +24,7 @@
23
24
  "ReplyTo": "myemail@example.com",
24
25
  "DateCreated": "2011-05-24 10:39:00",
25
26
  "PreviewURL": "http://createsend.com/t/r-DD913521A87C9B8B",
26
- "PreviewTextURL": "http://createsend.com/t/r-DD913521A87C9B8B/t"
27
+ "PreviewTextURL": "http://createsend.com/t/r-DD913521A87C9B8B/t",
28
+ "Tags": []
27
29
  }
28
30
  ]
@@ -4,6 +4,7 @@
4
4
  "EmailAddress": "personone@example.com",
5
5
  "Name": "Person One",
6
6
  "Date": "2010-10-27 13:13:00",
7
+ "ListJoinedDate": "2010-10-27 13:13:00",
7
8
  "State": "Active",
8
9
  "CustomFields": []
9
10
  },
@@ -11,6 +12,7 @@
11
12
  "EmailAddress": "persontwo@example.com",
12
13
  "Name": "Person Two",
13
14
  "Date": "2010-10-27 13:13:00",
15
+ "ListJoinedDate": "2010-10-27 13:13:00",
14
16
  "State": "Active",
15
17
  "CustomFields": []
16
18
  }
@@ -2,6 +2,7 @@
2
2
  "EmailAddress": "subscriber@example.com",
3
3
  "Name": "Subscriber One",
4
4
  "Date": "2010-10-25 10:28:00",
5
+ "ListJoinedDate": "2010-10-25 10:28:00",
5
6
  "State": "Active",
6
7
  "CustomFields": [
7
8
  {
@@ -0,0 +1,23 @@
1
+ {
2
+ "EmailAddress": "subscriber@example.com",
3
+ "Name": "Subscriber One",
4
+ "Date": "2010-10-25 10:28:00",
5
+ "ListJoinedDate": "2010-10-25 10:28:00",
6
+ "State": "Active",
7
+ "CustomFields": [
8
+ {
9
+ "Key": "website",
10
+ "Value": "http://example.com"
11
+ },
12
+ {
13
+ "Key": "age",
14
+ "Value": "24"
15
+ },
16
+ {
17
+ "Key": "subscription date",
18
+ "Value": "2010-03-09"
19
+ }
20
+ ],
21
+ "ReadsEmailWith": "Gmail",
22
+ "ConsentToTrack": "Yes"
23
+ }
@@ -0,0 +1,10 @@
1
+ [
2
+ {
3
+ "Name": "Tag One",
4
+ "NumberOfCampaigns": "120"
5
+ },
6
+ {
7
+ "Name": "Tag Two",
8
+ "NumberOfCampaigns": "62"
9
+ }
10
+ ]
@@ -4,6 +4,7 @@
4
4
  "EmailAddress": "subs+7t8787Y@example.com",
5
5
  "Name": "Unconfirmed One",
6
6
  "Date": "2010-10-25 10:28:00",
7
+ "ListJoinedDate": "2010-10-25 10:28:00",
7
8
  "State": "Unconfirmed",
8
9
  "CustomFields": [
9
10
  {
@@ -11,12 +12,14 @@
11
12
  "Value": "http://example.com"
12
13
  }
13
14
  ],
14
- "ReadsEmailWith": ""
15
+ "ReadsEmailWith": "",
16
+ "ConsentToTrack": "Yes"
15
17
  },
16
18
  {
17
19
  "EmailAddress": "subs+7878787y8ggg@example.com",
18
20
  "Name": "Unconfirmed Two",
19
21
  "Date": "2010-10-25 12:17:00",
22
+ "ListJoinedDate": "2010-10-25 12:17:00",
20
23
  "State": "Unconfirmed",
21
24
  "CustomFields": [
22
25
  {
@@ -24,7 +27,8 @@
24
27
  "Value": "http://subdomain.example.com"
25
28
  }
26
29
  ],
27
- "ReadsEmailWith": ""
30
+ "ReadsEmailWith": "",
31
+ "ConsentToTrack": "No"
28
32
  }
29
33
  ],
30
34
  "ResultsOrderedBy": "email",
@@ -4,6 +4,7 @@
4
4
  "EmailAddress": "subscriber@example.com",
5
5
  "Name": "Unsub One",
6
6
  "Date": "2010-10-25 13:11:00",
7
+ "ListJoinedDate": "2010-10-25 13:11:00",
7
8
  "State": "Unsubscribed",
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": "Unsubscribed",
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": "Unsubscribed",
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": "Unsubscribed",
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": "Unsubscribed",
45
50
  "CustomFields": [],
46
51
  "ReadsEmailWith": "Gmail"
@@ -53,4 +58,4 @@
53
58
  "RecordsOnThisPage": 5,
54
59
  "TotalNumberOfRecords": 5,
55
60
  "NumberOfPages": 1
56
- }
61
+ }
data/test/helper.rb CHANGED
@@ -30,7 +30,7 @@ def createsend_url(auth, url)
30
30
  if not url =~ /^http/
31
31
  auth_section = ''
32
32
  auth_section = "#{auth[:api_key]}:x@" if auth and auth.has_key? :api_key
33
- result = "https://#{auth_section}api.createsend.com/api/v3.1/#{url}"
33
+ result = "https://#{auth_section}api.createsend.com/api/v3.3/#{url}"
34
34
  else
35
35
  result = url
36
36
  end
@@ -42,7 +42,8 @@ def stub_request(method, auth, url, filename, status=nil)
42
42
  options.merge!({:body => fixture_file(filename)}) if filename
43
43
  options.merge!({:status => status}) if status
44
44
  options.merge!(:content_type => "application/json; charset=utf-8")
45
- FakeWeb.register_uri(method, createsend_url(auth, url), options)
45
+ createsend_url = createsend_url(auth, url)
46
+ FakeWeb.register_uri(method, createsend_url, options)
46
47
  end
47
48
 
48
49
  def stub_get(*args); stub_request(:get, *args) end
@@ -0,0 +1,156 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class JourneyTest < Test::Unit::TestCase
4
+ multiple_contexts "authenticated_using_oauth_context", "authenticated_using_api_key_context" do
5
+ setup do
6
+ @journey = CreateSend::Journey.new @auth, 'a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1'
7
+ end
8
+
9
+ should "get the summary for a journey" do
10
+ stub_get(@auth, "journeys/#{@journey.journey_id}.json", "journey_summary.json")
11
+
12
+ summary = @journey.summary
13
+ summary.Name.should == 'New journey'
14
+ summary.TriggerType.should == 'On Subscription'
15
+ summary.Status.should == 'Active'
16
+
17
+ summary.Emails.size.should == 1
18
+ summary.Emails.first.EmailID.should == 'b1b1b1b1b1b1b1b1b1b1'
19
+ summary.Emails.first.Name.should == 'New Email'
20
+ summary.Emails.first.Bounced.should == 0
21
+ summary.Emails.first.Clicked.should == 0
22
+ summary.Emails.first.Opened.should == 3
23
+ summary.Emails.first.Sent.should == 1
24
+ summary.Emails.first.UniqueOpened.should == 1
25
+ summary.Emails.first.Unsubscribed.should == 0
26
+ end
27
+
28
+ should "return a paged list of recipients of a particular email" do
29
+ journey_date = "2019-07-12 09:22"
30
+ stub_get(@auth, "journeys/email/b1b1b1b1b1b1b1b1b1b1/recipients.json" \
31
+ "?date=#{ERB::Util.url_encode(journey_date)}" \
32
+ "&page=2" \
33
+ "&pagesize=5" \
34
+ "&orderdirection=asc", "journey_recipients.json")
35
+
36
+ recipients = @journey.email_recipients email_id = 'b1b1b1b1b1b1b1b1b1b1', date = journey_date, page = 2, page_size = 5, order_direction = 'asc'
37
+ recipients.Results.size.should == 4
38
+ recipients.Results.first.EmailAddress.should == 'example+1@example.com'
39
+ recipients.Results.first.SentDate.should == '2019-07-12 09:45:00'
40
+
41
+ recipients.ResultsOrderedBy.should == 'SentDate'
42
+ recipients.OrderDirection.should == 'ASC'
43
+ recipients.PageNumber.should == 2
44
+ recipients.PageSize.should == 10
45
+ recipients.RecordsOnThisPage.should == 4
46
+ recipients.TotalNumberOfRecords.should == 14
47
+ recipients.NumberOfPages.should == 2
48
+ end
49
+
50
+ should "return a paged list of subscribers who opened given journey email" do
51
+ journey_date = "2019-02-08 09:22"
52
+ stub_get(@auth, "journeys/email/b1b1b1b1b1b1b1b1b1b1/opens.json" \
53
+ "?date=#{ERB::Util.url_encode(journey_date)}" \
54
+ "&page=2" \
55
+ "&pagesize=5" \
56
+ "&orderdirection=asc", "journey_opens.json")
57
+
58
+ opens = @journey.email_opens email = 'b1b1b1b1b1b1b1b1b1b1', date = journey_date, page = 2, page_size = 5, order_direction = 'asc'
59
+ opens.Results.size.should == 4
60
+ opens.Results.last.EmailAddress.should == "example+4@example.com"
61
+ opens.Results.last.Date.should == "2019-07-29 10:35:00"
62
+ opens.Results.last.IPAddress.should == "192.168.0.3"
63
+ opens.Results.last.Latitude.should == -33.8683
64
+ opens.Results.last.Longitude.should == 151.2086
65
+ opens.Results.last.City.should == "Sydney"
66
+ opens.Results.last.Region.should == "New South Wales"
67
+ opens.Results.last.CountryCode.should == "AU"
68
+ opens.Results.last.CountryName.should == "Australia"
69
+
70
+ opens.ResultsOrderedBy.should == "Date"
71
+ opens.OrderDirection.should == "ASC"
72
+ opens.PageNumber.should == 1
73
+ opens.PageSize.should == 1000
74
+ opens.RecordsOnThisPage.should == 4
75
+ opens.TotalNumberOfRecords.should == 4
76
+ opens.NumberOfPages.should == 1
77
+ end
78
+
79
+ should "return a paged list of subscribers who clicked on a journey email" do
80
+ journey_date = "2019-07-29 10:30"
81
+ stub_get(@auth, "journeys/email/b1b1b1b1b1b1b1b1b1b1/clicks.json" \
82
+ "?date=#{ERB::Util.url_encode(journey_date)}" \
83
+ "&page=1" \
84
+ "&pagesize=2" \
85
+ "&orderdirection=asc", "journey_clicks.json")
86
+
87
+ clicks = @journey.email_clicks email = 'b1b1b1b1b1b1b1b1b1b1', date = journey_date, page = 1, page_size = 2, order_direction = 'asc'
88
+ clicks.Results.size.should == 2
89
+ clicks.Results.first.EmailAddress.should == "example+1@example.com"
90
+ clicks.Results.first.Date.should == "2019-07-29 10:33:00"
91
+ clicks.Results.first.URL.should == "http://test.com"
92
+ clicks.Results.first.IPAddress.should == "192.168.0.3"
93
+ clicks.Results.first.Latitude.should == -33.8683
94
+ clicks.Results.first.Longitude.should == 151.2086
95
+ clicks.Results.first.City.should == "Sydney"
96
+ clicks.Results.first.Region.should == "New South Wales"
97
+ clicks.Results.first.CountryCode.should == "AU"
98
+ clicks.Results.first.CountryName.should == "Australia"
99
+
100
+ clicks.ResultsOrderedBy.should == "Date"
101
+ clicks.OrderDirection.should == "ASC"
102
+ clicks.PageNumber.should == 1
103
+ clicks.PageSize.should == 2
104
+ clicks.RecordsOnThisPage.should == 2
105
+ clicks.TotalNumberOfRecords.should == 5
106
+ clicks.NumberOfPages.should == 3
107
+ end
108
+
109
+ should "return a paged list of subscribers who unsubscribed from a journey email" do
110
+ journey_date = "2019-07-29 10:22"
111
+ stub_get(@auth, "journeys/email/b1b1b1b1b1b1b1b1b1b1/unsubscribes.json" \
112
+ "?date=#{ERB::Util.url_encode(journey_date)}" \
113
+ "&page=1" \
114
+ "&pagesize=10" \
115
+ "&orderdirection=desc", "journey_unsubscribes.json")
116
+
117
+ unsubscribes = @journey.email_unsubscribes email = 'b1b1b1b1b1b1b1b1b1b1', date = journey_date, page = 1, page_size = 10, order_direction = 'desc'
118
+ unsubscribes.Results.size.should == 3
119
+ unsubscribes.Results.first.EmailAddress.should == "example+1@example.com"
120
+ unsubscribes.Results.first.Date.should == "2019-07-29 10:33:00"
121
+ unsubscribes.Results.first.IPAddress.should == "192.168.0.3"
122
+
123
+ unsubscribes.ResultsOrderedBy.should == "Date"
124
+ unsubscribes.OrderDirection.should == "ASC"
125
+ unsubscribes.PageNumber.should == 1
126
+ unsubscribes.PageSize.should == 1000
127
+ unsubscribes.RecordsOnThisPage.should == 4
128
+ unsubscribes.TotalNumberOfRecords.should == 4
129
+ unsubscribes.NumberOfPages.should == 1
130
+ end
131
+
132
+ should "return a paged list of emails that bounced for a journey email" do
133
+ journey_date = "2019-07-29 10:31"
134
+ stub_get(@auth, "journeys/email/b1b1b1b1b1b1b1b1b1b1/bounces.json" \
135
+ "?date=#{ERB::Util.url_encode(journey_date)}" \
136
+ "&page=20" \
137
+ "&pagesize=5" \
138
+ "&orderdirection=desc", "journey_bounces.json")
139
+
140
+ bounces = @journey.email_bounces email = 'b1b1b1b1b1b1b1b1b1b1', date = journey_date, page = 20, page_size = 5, order_direction = 'desc'
141
+ bounces.Results.size.should == 4
142
+ bounces.Results.first.EmailAddress.should == "example+1@example.com"
143
+ bounces.Results.first.BounceType.should == "4"
144
+ bounces.Results.first.Date.should == "2019-07-29 10:33:00"
145
+ bounces.Results.first.Reason.should == "Soft Bounce - Mailbox Full"
146
+
147
+ bounces.ResultsOrderedBy.should == "Date"
148
+ bounces.OrderDirection.should == "ASC"
149
+ bounces.PageNumber.should == 1
150
+ bounces.PageSize.should == 1000
151
+ bounces.RecordsOnThisPage.should == 4
152
+ bounces.TotalNumberOfRecords.should == 4
153
+ bounces.NumberOfPages.should == 1
154
+ end
155
+ end
156
+ end
data/test/list_test.rb CHANGED
@@ -66,7 +66,7 @@ class ListTest < Test::Unit::TestCase
66
66
 
67
67
  should "update a custom field" do
68
68
  key = "[mycustomfield]"
69
- stub_put(@auth, "lists/#{@list.list_id}/customfields/#{CGI.escape(key)}.json", "update_custom_field.json")
69
+ stub_put(@auth, "lists/#{@list.list_id}/customfields/#{ERB::Util.url_encode(key)}.json", "update_custom_field.json")
70
70
  personalisation_tag = @list.update_custom_field key, "my renamed custom field", true
71
71
  request = FakeWeb.last_request.body
72
72
  request.include?("\"FieldName\":\"my renamed custom field\"").should == true
@@ -76,14 +76,14 @@ class ListTest < Test::Unit::TestCase
76
76
 
77
77
  should "delete a custom field" do
78
78
  custom_field_key = "[newdatefield]"
79
- stub_delete(@auth, "lists/#{@list.list_id}/customfields/#{CGI.escape(custom_field_key)}.json", nil)
79
+ stub_delete(@auth, "lists/#{@list.list_id}/customfields/#{ERB::Util.url_encode(custom_field_key)}.json", nil)
80
80
  @list.delete_custom_field custom_field_key
81
81
  end
82
82
 
83
83
  should "update the options of a multi-optioned custom field" do
84
84
  custom_field_key = "[newdatefield]"
85
85
  new_options = [ "one", "two", "three" ]
86
- stub_put(@auth, "lists/#{@list.list_id}/customfields/#{CGI.escape(custom_field_key)}/options.json", nil)
86
+ stub_put(@auth, "lists/#{@list.list_id}/customfields/#{ERB::Util.url_encode(custom_field_key)}/options.json", nil)
87
87
  @list.update_custom_field_options custom_field_key, new_options, true
88
88
  end
89
89
 
@@ -129,7 +129,7 @@ class ListTest < Test::Unit::TestCase
129
129
 
130
130
  should "get the active subscribers for a list" do
131
131
  min_date = "2010-01-01"
132
- stub_get(@auth, "lists/#{@list.list_id}/active.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
132
+ stub_get(@auth, "lists/#{@list.list_id}/active.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
133
133
  "active_subscribers.json")
134
134
  res = @list.active min_date
135
135
  res.ResultsOrderedBy.should == "email"
@@ -143,6 +143,7 @@ class ListTest < Test::Unit::TestCase
143
143
  res.Results.first.EmailAddress.should == "subs+7t8787Y@example.com"
144
144
  res.Results.first.Name.should =="Person One"
145
145
  res.Results.first.Date.should == "2010-10-25 10:28:00"
146
+ res.Results.first.ListJoinedDate.should == "2010-10-25 10:28:00"
146
147
  res.Results.first.State.should == "Active"
147
148
  res.Results.first.CustomFields.size.should == 5
148
149
  res.Results.first.CustomFields[0].Key.should == "website"
@@ -156,9 +157,9 @@ class ListTest < Test::Unit::TestCase
156
157
 
157
158
  should "get the unconfirmed subscribers for a list" do
158
159
  min_date = "2010-01-01"
159
- stub_get(@auth, "lists/#{@list.list_id}/unconfirmed.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
160
+ stub_get(@auth, "lists/#{@list.list_id}/unconfirmed.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=true",
160
161
  "unconfirmed_subscribers.json")
161
- res = @list.unconfirmed min_date
162
+ res = @list.unconfirmed(min_date, 1, 1000, "email", "asc", true)
162
163
  res.ResultsOrderedBy.should == "email"
163
164
  res.OrderDirection.should == "asc"
164
165
  res.PageNumber.should == 1
@@ -169,12 +170,15 @@ class ListTest < Test::Unit::TestCase
169
170
  res.Results.size.should == 2
170
171
  res.Results.first.EmailAddress.should == "subs+7t8787Y@example.com"
171
172
  res.Results.first.Name.should =="Unconfirmed One"
173
+ res.Results.first.Date.should =="2010-10-25 10:28:00"
174
+ res.Results.first.ListJoinedDate.should =="2010-10-25 10:28:00"
172
175
  res.Results.first.State.should == "Unconfirmed"
176
+ res.Results.first.ConsentToTrack.should == "Yes"
173
177
  end
174
178
 
175
179
  should "get the unsubscribed subscribers for a list" do
176
180
  min_date = "2010-01-01"
177
- stub_get(@auth, "lists/#{@list.list_id}/unsubscribed.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
181
+ stub_get(@auth, "lists/#{@list.list_id}/unsubscribed.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
178
182
  "unsubscribed_subscribers.json")
179
183
  res = @list.unsubscribed min_date
180
184
  res.ResultsOrderedBy.should == "email"
@@ -188,6 +192,7 @@ class ListTest < Test::Unit::TestCase
188
192
  res.Results.first.EmailAddress.should == "subscriber@example.com"
189
193
  res.Results.first.Name.should == "Unsub One"
190
194
  res.Results.first.Date.should == "2010-10-25 13:11:00"
195
+ res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
191
196
  res.Results.first.State.should == "Unsubscribed"
192
197
  res.Results.first.CustomFields.size.should == 0
193
198
  res.Results.first.ReadsEmailWith.should == "Gmail"
@@ -195,7 +200,7 @@ class ListTest < Test::Unit::TestCase
195
200
 
196
201
  should "get the deleted subscribers for a list" do
197
202
  min_date = "2010-01-01"
198
- stub_get(@auth, "lists/#{@list.list_id}/deleted.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
203
+ stub_get(@auth, "lists/#{@list.list_id}/deleted.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
199
204
  "deleted_subscribers.json")
200
205
  res = @list.deleted min_date
201
206
  res.ResultsOrderedBy.should == "email"
@@ -209,6 +214,7 @@ class ListTest < Test::Unit::TestCase
209
214
  res.Results.first.EmailAddress.should == "subscriber@example.com"
210
215
  res.Results.first.Name.should == "Deleted One"
211
216
  res.Results.first.Date.should == "2010-10-25 13:11:00"
217
+ res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
212
218
  res.Results.first.State.should == "Deleted"
213
219
  res.Results.first.CustomFields.size.should == 0
214
220
  res.Results.first.ReadsEmailWith.should == "Gmail"
@@ -216,7 +222,7 @@ class ListTest < Test::Unit::TestCase
216
222
 
217
223
  should "get the bounced subscribers for a list" do
218
224
  min_date = "2010-01-01"
219
- stub_get(@auth, "lists/#{@list.list_id}/bounced.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
225
+ stub_get(@auth, "lists/#{@list.list_id}/bounced.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
220
226
  "bounced_subscribers.json")
221
227
  res = @list.bounced min_date
222
228
  res.ResultsOrderedBy.should == "email"
@@ -230,6 +236,7 @@ class ListTest < Test::Unit::TestCase
230
236
  res.Results.first.EmailAddress.should == "bouncedsubscriber@example.com"
231
237
  res.Results.first.Name.should == "Bounced One"
232
238
  res.Results.first.Date.should == "2010-10-25 13:11:00"
239
+ res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
233
240
  res.Results.first.State.should == "Bounced"
234
241
  res.Results.first.CustomFields.size.should == 0
235
242
  res.Results.first.ReadsEmailWith.should == ""
data/test/person_test.rb CHANGED
@@ -9,7 +9,7 @@ class PersonTest < Test::Unit::TestCase
9
9
 
10
10
  should "get a person by client id and email address" do
11
11
  email = "person@example.com"
12
- stub_get(@auth, "clients/#{@client_id}/people.json?email=#{CGI.escape(email)}", "person_details.json")
12
+ stub_get(@auth, "clients/#{@client_id}/people.json?email=#{ERB::Util.url_encode(email)}", "person_details.json")
13
13
  person = CreateSend::Person.get @auth, @client_id, email
14
14
  person.EmailAddress.should == email
15
15
  person.Name.should == "Person One"
@@ -26,13 +26,13 @@ class PersonTest < Test::Unit::TestCase
26
26
  should "update a person" do
27
27
  email = "person@example.com"
28
28
  new_email = "new_email_address@example.com"
29
- stub_put(@auth, "clients/#{@client_id}/people.json?email=#{CGI.escape(email)}", nil)
29
+ stub_put(@auth, "clients/#{@client_id}/people.json?email=#{ERB::Util.url_encode(email)}", nil)
30
30
  @person.update new_email, "Person", 1023, "NewPassword"
31
31
  @person.email_address.should == new_email
32
32
  end
33
33
 
34
34
  should "delete a person" do
35
- stub_delete(@auth, "clients/#{@person.client_id}/people.json?email=#{CGI.escape(@person.email_address)}", nil)
35
+ stub_delete(@auth, "clients/#{@person.client_id}/people.json?email=#{ERB::Util.url_encode(@person.email_address)}", nil)
36
36
  @person.delete
37
37
  end
38
38
  end
data/test/segment_test.rb CHANGED
@@ -28,7 +28,7 @@ class SegmentTest < Test::Unit::TestCase
28
28
 
29
29
  should "get the active subscribers for a particular segment in the list" do
30
30
  min_date = "2010-01-01"
31
- stub_get(@auth, "segments/#{@segment.segment_id}/active.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{CGI.escape(min_date)}",
31
+ stub_get(@auth, "segments/#{@segment.segment_id}/active.json?pagesize=1000&orderfield=email&page=1&orderdirection=asc&date=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
32
32
  "segment_subscribers.json")
33
33
  res = @segment.subscribers min_date
34
34
  res.ResultsOrderedBy.should == "email"
@@ -42,6 +42,7 @@ class SegmentTest < Test::Unit::TestCase
42
42
  res.Results.first.EmailAddress.should == "personone@example.com"
43
43
  res.Results.first.Name.should == "Person One"
44
44
  res.Results.first.Date.should == "2010-10-27 13:13:00"
45
+ res.Results.first.ListJoinedDate.should == "2010-10-27 13:13:00"
45
46
  res.Results.first.State.should == "Active"
46
47
  res.Results.first.CustomFields.should == []
47
48
  end