createsend 6.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +13 -0
- data/README.md +1 -1
- data/lib/createsend/list.rb +13 -12
- data/lib/createsend/subscriber.rb +8 -4
- data/lib/createsend/version.rb +1 -1
- data/samples/lists_sample.rb +12 -2
- data/samples/subscribers_sample.rb +51 -0
- data/test/administrator_test.rb +5 -5
- data/test/campaign_test.rb +114 -114
- data/test/client_test.rb +110 -110
- data/test/createsend_test.rb +47 -47
- data/test/fixtures/subscriber_details.json +1 -0
- data/test/fixtures/{subscriber_details_with_track_pref.json → subscriber_details_with_track_and_sms_pref.json} +3 -1
- data/test/fixtures/unconfirmed_subscribers.json +4 -2
- data/test/journey_test.rb +86 -86
- data/test/list_test.rb +130 -129
- data/test/person_test.rb +6 -6
- data/test/segment_test.rb +23 -23
- data/test/subscriber_test.rb +55 -52
- data/test/template_test.rb +5 -5
- data/test/transactional_classic_email_test.rb +6 -6
- data/test/transactional_smart_email_test.rb +19 -19
- data/test/transactional_timeline_test.rb +25 -25
- metadata +5 -5
- data/samples/subscribes_sample.rb +0 -22
@@ -13,7 +13,8 @@
|
|
13
13
|
}
|
14
14
|
],
|
15
15
|
"ReadsEmailWith": "",
|
16
|
-
"ConsentToTrack": "Yes"
|
16
|
+
"ConsentToTrack": "Yes",
|
17
|
+
"ConsentToSendSms": "No"
|
17
18
|
},
|
18
19
|
{
|
19
20
|
"EmailAddress": "subs+7878787y8ggg@example.com",
|
@@ -28,7 +29,8 @@
|
|
28
29
|
}
|
29
30
|
],
|
30
31
|
"ReadsEmailWith": "",
|
31
|
-
"ConsentToTrack": "No"
|
32
|
+
"ConsentToTrack": "No",
|
33
|
+
"ConsentToSendSms": "No"
|
32
34
|
}
|
33
35
|
],
|
34
36
|
"ResultsOrderedBy": "email",
|
data/test/journey_test.rb
CHANGED
@@ -10,19 +10,19 @@ class JourneyTest < Test::Unit::TestCase
|
|
10
10
|
stub_get(@auth, "journeys/#{@journey.journey_id}.json", "journey_summary.json")
|
11
11
|
|
12
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
|
13
|
+
summary.Name.should be == 'New journey'
|
14
|
+
summary.TriggerType.should be == 'On Subscription'
|
15
|
+
summary.Status.should be == 'Active'
|
16
|
+
|
17
|
+
summary.Emails.size.should be == 1
|
18
|
+
summary.Emails.first.EmailID.should be == 'b1b1b1b1b1b1b1b1b1b1'
|
19
|
+
summary.Emails.first.Name.should be == 'New Email'
|
20
|
+
summary.Emails.first.Bounced.should be == 0
|
21
|
+
summary.Emails.first.Clicked.should be == 0
|
22
|
+
summary.Emails.first.Opened.should be == 3
|
23
|
+
summary.Emails.first.Sent.should be == 1
|
24
|
+
summary.Emails.first.UniqueOpened.should be == 1
|
25
|
+
summary.Emails.first.Unsubscribed.should be == 0
|
26
26
|
end
|
27
27
|
|
28
28
|
should "return a paged list of recipients of a particular email" do
|
@@ -34,17 +34,17 @@ class JourneyTest < Test::Unit::TestCase
|
|
34
34
|
"&orderdirection=asc", "journey_recipients.json")
|
35
35
|
|
36
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
|
37
|
+
recipients.Results.size.should be == 4
|
38
|
+
recipients.Results.first.EmailAddress.should be == 'example+1@example.com'
|
39
|
+
recipients.Results.first.SentDate.should be == '2019-07-12 09:45:00'
|
40
|
+
|
41
|
+
recipients.ResultsOrderedBy.should be == 'SentDate'
|
42
|
+
recipients.OrderDirection.should be == 'ASC'
|
43
|
+
recipients.PageNumber.should be == 2
|
44
|
+
recipients.PageSize.should be == 10
|
45
|
+
recipients.RecordsOnThisPage.should be == 4
|
46
|
+
recipients.TotalNumberOfRecords.should be == 14
|
47
|
+
recipients.NumberOfPages.should be == 2
|
48
48
|
end
|
49
49
|
|
50
50
|
should "return a paged list of subscribers who opened given journey email" do
|
@@ -56,24 +56,24 @@ class JourneyTest < Test::Unit::TestCase
|
|
56
56
|
"&orderdirection=asc", "journey_opens.json")
|
57
57
|
|
58
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
|
59
|
+
opens.Results.size.should be == 4
|
60
|
+
opens.Results.last.EmailAddress.should be == "example+4@example.com"
|
61
|
+
opens.Results.last.Date.should be == "2019-07-29 10:35:00"
|
62
|
+
opens.Results.last.IPAddress.should be == "192.168.0.3"
|
63
|
+
opens.Results.last.Latitude.should be == -33.8683
|
64
|
+
opens.Results.last.Longitude.should be == 151.2086
|
65
|
+
opens.Results.last.City.should be == "Sydney"
|
66
|
+
opens.Results.last.Region.should be == "New South Wales"
|
67
|
+
opens.Results.last.CountryCode.should be == "AU"
|
68
|
+
opens.Results.last.CountryName.should be == "Australia"
|
69
|
+
|
70
|
+
opens.ResultsOrderedBy.should be == "Date"
|
71
|
+
opens.OrderDirection.should be == "ASC"
|
72
|
+
opens.PageNumber.should be == 1
|
73
|
+
opens.PageSize.should be == 1000
|
74
|
+
opens.RecordsOnThisPage.should be == 4
|
75
|
+
opens.TotalNumberOfRecords.should be == 4
|
76
|
+
opens.NumberOfPages.should be == 1
|
77
77
|
end
|
78
78
|
|
79
79
|
should "return a paged list of subscribers who clicked on a journey email" do
|
@@ -85,25 +85,25 @@ class JourneyTest < Test::Unit::TestCase
|
|
85
85
|
"&orderdirection=asc", "journey_clicks.json")
|
86
86
|
|
87
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
|
88
|
+
clicks.Results.size.should be == 2
|
89
|
+
clicks.Results.first.EmailAddress.should be == "example+1@example.com"
|
90
|
+
clicks.Results.first.Date.should be == "2019-07-29 10:33:00"
|
91
|
+
clicks.Results.first.URL.should be == "http://test.com"
|
92
|
+
clicks.Results.first.IPAddress.should be == "192.168.0.3"
|
93
|
+
clicks.Results.first.Latitude.should be == -33.8683
|
94
|
+
clicks.Results.first.Longitude.should be == 151.2086
|
95
|
+
clicks.Results.first.City.should be == "Sydney"
|
96
|
+
clicks.Results.first.Region.should be == "New South Wales"
|
97
|
+
clicks.Results.first.CountryCode.should be == "AU"
|
98
|
+
clicks.Results.first.CountryName.should be == "Australia"
|
99
|
+
|
100
|
+
clicks.ResultsOrderedBy.should be == "Date"
|
101
|
+
clicks.OrderDirection.should be == "ASC"
|
102
|
+
clicks.PageNumber.should be == 1
|
103
|
+
clicks.PageSize.should be == 2
|
104
|
+
clicks.RecordsOnThisPage.should be == 2
|
105
|
+
clicks.TotalNumberOfRecords.should be == 5
|
106
|
+
clicks.NumberOfPages.should be == 3
|
107
107
|
end
|
108
108
|
|
109
109
|
should "return a paged list of subscribers who unsubscribed from a journey email" do
|
@@ -115,18 +115,18 @@ class JourneyTest < Test::Unit::TestCase
|
|
115
115
|
"&orderdirection=desc", "journey_unsubscribes.json")
|
116
116
|
|
117
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
|
118
|
+
unsubscribes.Results.size.should be == 3
|
119
|
+
unsubscribes.Results.first.EmailAddress.should be == "example+1@example.com"
|
120
|
+
unsubscribes.Results.first.Date.should be == "2019-07-29 10:33:00"
|
121
|
+
unsubscribes.Results.first.IPAddress.should be == "192.168.0.3"
|
122
|
+
|
123
|
+
unsubscribes.ResultsOrderedBy.should be == "Date"
|
124
|
+
unsubscribes.OrderDirection.should be == "ASC"
|
125
|
+
unsubscribes.PageNumber.should be == 1
|
126
|
+
unsubscribes.PageSize.should be == 1000
|
127
|
+
unsubscribes.RecordsOnThisPage.should be == 4
|
128
|
+
unsubscribes.TotalNumberOfRecords.should be == 4
|
129
|
+
unsubscribes.NumberOfPages.should be == 1
|
130
130
|
end
|
131
131
|
|
132
132
|
should "return a paged list of emails that bounced for a journey email" do
|
@@ -138,19 +138,19 @@ class JourneyTest < Test::Unit::TestCase
|
|
138
138
|
"&orderdirection=desc", "journey_bounces.json")
|
139
139
|
|
140
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
|
141
|
+
bounces.Results.size.should be == 4
|
142
|
+
bounces.Results.first.EmailAddress.should be == "example+1@example.com"
|
143
|
+
bounces.Results.first.BounceType.should be == "4"
|
144
|
+
bounces.Results.first.Date.should be == "2019-07-29 10:33:00"
|
145
|
+
bounces.Results.first.Reason.should be == "Soft Bounce - Mailbox Full"
|
146
|
+
|
147
|
+
bounces.ResultsOrderedBy.should be == "Date"
|
148
|
+
bounces.OrderDirection.should be == "ASC"
|
149
|
+
bounces.PageNumber.should be == 1
|
150
|
+
bounces.PageSize.should be == 1000
|
151
|
+
bounces.RecordsOnThisPage.should be == 4
|
152
|
+
bounces.TotalNumberOfRecords.should be == 4
|
153
|
+
bounces.NumberOfPages.should be == 1
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
data/test/list_test.rb
CHANGED
@@ -11,13 +11,13 @@ class ListTest < Test::Unit::TestCase
|
|
11
11
|
should "create a list without passing in unsubscribe setting" do
|
12
12
|
stub_post(@auth, "lists/#{@client_id}.json", "create_list.json")
|
13
13
|
list_id = CreateSend::List.create @auth, @client_id, "List One", "", false, ""
|
14
|
-
list_id.should == "e3c5f034d68744f7881fdccf13c2daee"
|
14
|
+
list_id.should be == "e3c5f034d68744f7881fdccf13c2daee"
|
15
15
|
end
|
16
16
|
|
17
17
|
should "create a list passing in unsubscribe setting" do
|
18
18
|
stub_post(@auth, "lists/#{@client_id}.json", "create_list.json")
|
19
19
|
list_id = CreateSend::List.create @auth, @client_id, "List One", "", false, "", "OnlyThisList"
|
20
|
-
list_id.should == "e3c5f034d68744f7881fdccf13c2daee"
|
20
|
+
list_id.should be == "e3c5f034d68744f7881fdccf13c2daee"
|
21
21
|
end
|
22
22
|
|
23
23
|
should "update a list without passing in unsubscribe setting" do
|
@@ -44,11 +44,11 @@ class ListTest < Test::Unit::TestCase
|
|
44
44
|
stub_post(@auth, "lists/#{@list.list_id}/customfields.json", "create_custom_field.json")
|
45
45
|
personalisation_tag = @list.create_custom_field "new date field", "Date"
|
46
46
|
request = FakeWeb.last_request.body
|
47
|
-
request.include?("\"FieldName\":\"new date field\"").should == true
|
48
|
-
request.include?("\"DataType\":\"Date\"").should == true
|
49
|
-
request.include?("\"Options\":[]").should == true
|
50
|
-
request.include?("\"VisibleInPreferenceCenter\":true").should == true
|
51
|
-
personalisation_tag.should == "[newdatefield]"
|
47
|
+
request.include?("\"FieldName\":\"new date field\"").should be == true
|
48
|
+
request.include?("\"DataType\":\"Date\"").should be == true
|
49
|
+
request.include?("\"Options\":[]").should be == true
|
50
|
+
request.include?("\"VisibleInPreferenceCenter\":true").should be == true
|
51
|
+
personalisation_tag.should be == "[newdatefield]"
|
52
52
|
end
|
53
53
|
|
54
54
|
should "create a custom field with options and visible_in_preference_center" do
|
@@ -57,11 +57,11 @@ class ListTest < Test::Unit::TestCase
|
|
57
57
|
personalisation_tag = @list.create_custom_field("newsletter format",
|
58
58
|
"MultiSelectOne", options, false)
|
59
59
|
request = FakeWeb.last_request.body
|
60
|
-
request.include?("\"FieldName\":\"newsletter format\"").should == true
|
61
|
-
request.include?("\"DataType\":\"MultiSelectOne\"").should == true
|
62
|
-
request.include?("\"Options\":[\"one\",\"two\"]").should == true
|
63
|
-
request.include?("\"VisibleInPreferenceCenter\":false").should == true
|
64
|
-
personalisation_tag.should == "[newdatefield]"
|
60
|
+
request.include?("\"FieldName\":\"newsletter format\"").should be == true
|
61
|
+
request.include?("\"DataType\":\"MultiSelectOne\"").should be == true
|
62
|
+
request.include?("\"Options\":[\"one\",\"two\"]").should be == true
|
63
|
+
request.include?("\"VisibleInPreferenceCenter\":false").should be == true
|
64
|
+
personalisation_tag.should be == "[newdatefield]"
|
65
65
|
end
|
66
66
|
|
67
67
|
should "update a custom field" do
|
@@ -69,9 +69,9 @@ class ListTest < Test::Unit::TestCase
|
|
69
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
|
-
request.include?("\"FieldName\":\"my renamed custom field\"").should == true
|
73
|
-
request.include?("\"VisibleInPreferenceCenter\":true").should == true
|
74
|
-
personalisation_tag.should == "[myrenamedcustomfield]"
|
72
|
+
request.include?("\"FieldName\":\"my renamed custom field\"").should be == true
|
73
|
+
request.include?("\"VisibleInPreferenceCenter\":true").should be == true
|
74
|
+
personalisation_tag.should be == "[myrenamedcustomfield]"
|
75
75
|
end
|
76
76
|
|
77
77
|
should "delete a custom field" do
|
@@ -90,174 +90,175 @@ class ListTest < Test::Unit::TestCase
|
|
90
90
|
should "get the details of a list" do
|
91
91
|
stub_get(@auth, "lists/#{@list.list_id}.json", "list_details.json")
|
92
92
|
details = @list.details
|
93
|
-
details.ConfirmedOptIn.should == false
|
94
|
-
details.Title.should == "a non-basic list :)"
|
95
|
-
details.UnsubscribePage.should == ""
|
96
|
-
details.ListID.should == "2fe4c8f0373ce320e2200596d7ef168f"
|
97
|
-
details.ConfirmationSuccessPage.should == ""
|
98
|
-
details.UnsubscribeSetting.should == "AllClientLists"
|
93
|
+
details.ConfirmedOptIn.should be == false
|
94
|
+
details.Title.should be == "a non-basic list :)"
|
95
|
+
details.UnsubscribePage.should be == ""
|
96
|
+
details.ListID.should be == "2fe4c8f0373ce320e2200596d7ef168f"
|
97
|
+
details.ConfirmationSuccessPage.should be == ""
|
98
|
+
details.UnsubscribeSetting.should be == "AllClientLists"
|
99
99
|
end
|
100
100
|
|
101
101
|
should "get the custom fields for a list" do
|
102
102
|
stub_get(@auth, "lists/#{@list.list_id}/customfields.json", "custom_fields.json")
|
103
103
|
cfs = @list.custom_fields
|
104
|
-
cfs.size.should == 3
|
105
|
-
cfs.first.FieldName.should == "website"
|
106
|
-
cfs.first.Key.should == "[website]"
|
107
|
-
cfs.first.DataType.should == "Text"
|
108
|
-
cfs.first.FieldOptions.should == []
|
109
|
-
cfs.first.VisibleInPreferenceCenter.should == true
|
104
|
+
cfs.size.should be == 3
|
105
|
+
cfs.first.FieldName.should be == "website"
|
106
|
+
cfs.first.Key.should be == "[website]"
|
107
|
+
cfs.first.DataType.should be == "Text"
|
108
|
+
cfs.first.FieldOptions.should be == []
|
109
|
+
cfs.first.VisibleInPreferenceCenter.should be == true
|
110
110
|
end
|
111
111
|
|
112
112
|
should "get the segments for a list" do
|
113
113
|
stub_get(@auth, "lists/#{@list.list_id}/segments.json", "segments.json")
|
114
114
|
segments = @list.segments
|
115
|
-
segments.size.should == 2
|
116
|
-
segments.first.ListID.should == 'a58ee1d3039b8bec838e6d1482a8a965'
|
117
|
-
segments.first.SegmentID.should == '46aa5e01fd43381863d4e42cf277d3a9'
|
118
|
-
segments.first.Title.should == 'Segment One'
|
115
|
+
segments.size.should be == 2
|
116
|
+
segments.first.ListID.should be == 'a58ee1d3039b8bec838e6d1482a8a965'
|
117
|
+
segments.first.SegmentID.should be == '46aa5e01fd43381863d4e42cf277d3a9'
|
118
|
+
segments.first.Title.should be == 'Segment One'
|
119
119
|
end
|
120
120
|
|
121
121
|
should "get the stats for a list" do
|
122
122
|
stub_get(@auth, "lists/#{@list.list_id}/stats.json", "list_stats.json")
|
123
123
|
stats = @list.stats
|
124
|
-
stats.TotalActiveSubscribers.should == 6
|
125
|
-
stats.TotalUnsubscribes.should == 2
|
126
|
-
stats.TotalDeleted.should == 0
|
127
|
-
stats.TotalBounces.should == 0
|
124
|
+
stats.TotalActiveSubscribers.should be == 6
|
125
|
+
stats.TotalUnsubscribes.should be == 2
|
126
|
+
stats.TotalDeleted.should be == 0
|
127
|
+
stats.TotalBounces.should be == 0
|
128
128
|
end
|
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=#{ERB::Util.url_encode(min_date)}&includetrackingpreference=false",
|
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&includesmspreference=false",
|
133
133
|
"active_subscribers.json")
|
134
134
|
res = @list.active min_date
|
135
|
-
res.ResultsOrderedBy.should == "email"
|
136
|
-
res.OrderDirection.should == "asc"
|
137
|
-
res.PageNumber.should == 1
|
138
|
-
res.PageSize.should == 1000
|
139
|
-
res.RecordsOnThisPage.should == 5
|
140
|
-
res.TotalNumberOfRecords.should == 5
|
141
|
-
res.NumberOfPages.should == 1
|
142
|
-
res.Results.size.should == 5
|
143
|
-
res.Results.first.EmailAddress.should == "subs+7t8787Y@example.com"
|
144
|
-
res.Results.first.Name.should =="Person One"
|
145
|
-
res.Results.first.Date.should == "2010-10-25 10:28:00"
|
146
|
-
res.Results.first.ListJoinedDate.should == "2010-10-25 10:28:00"
|
147
|
-
res.Results.first.State.should == "Active"
|
148
|
-
res.Results.first.CustomFields.size.should == 5
|
149
|
-
res.Results.first.CustomFields[0].Key.should == "website"
|
150
|
-
res.Results.first.CustomFields[0].Value.should == "http://example.com"
|
151
|
-
res.Results.first.CustomFields[1].Key.should == "multi select field"
|
152
|
-
res.Results.first.CustomFields[1].Value.should == "option one"
|
153
|
-
res.Results.first.CustomFields[2].Key.should == "multi select field"
|
154
|
-
res.Results.first.CustomFields[2].Value.should == "option two"
|
155
|
-
res.Results.first.ReadsEmailWith.should == "Gmail"
|
135
|
+
res.ResultsOrderedBy.should be == "email"
|
136
|
+
res.OrderDirection.should be == "asc"
|
137
|
+
res.PageNumber.should be == 1
|
138
|
+
res.PageSize.should be == 1000
|
139
|
+
res.RecordsOnThisPage.should be == 5
|
140
|
+
res.TotalNumberOfRecords.should be == 5
|
141
|
+
res.NumberOfPages.should be == 1
|
142
|
+
res.Results.size.should be == 5
|
143
|
+
res.Results.first.EmailAddress.should be == "subs+7t8787Y@example.com"
|
144
|
+
res.Results.first.Name.should be =="Person One"
|
145
|
+
res.Results.first.Date.should be == "2010-10-25 10:28:00"
|
146
|
+
res.Results.first.ListJoinedDate.should be == "2010-10-25 10:28:00"
|
147
|
+
res.Results.first.State.should be == "Active"
|
148
|
+
res.Results.first.CustomFields.size.should be == 5
|
149
|
+
res.Results.first.CustomFields[0].Key.should be == "website"
|
150
|
+
res.Results.first.CustomFields[0].Value.should be == "http://example.com"
|
151
|
+
res.Results.first.CustomFields[1].Key.should be == "multi select field"
|
152
|
+
res.Results.first.CustomFields[1].Value.should be == "option one"
|
153
|
+
res.Results.first.CustomFields[2].Key.should be == "multi select field"
|
154
|
+
res.Results.first.CustomFields[2].Value.should be == "option two"
|
155
|
+
res.Results.first.ReadsEmailWith.should be == "Gmail"
|
156
156
|
end
|
157
157
|
|
158
158
|
should "get the unconfirmed subscribers for a list" do
|
159
159
|
min_date = "2010-01-01"
|
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
|
+
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&includesmspreference=true",
|
161
161
|
"unconfirmed_subscribers.json")
|
162
|
-
res = @list.unconfirmed(min_date, 1, 1000, "email", "asc", true)
|
163
|
-
res.ResultsOrderedBy.should == "email"
|
164
|
-
res.OrderDirection.should == "asc"
|
165
|
-
res.PageNumber.should == 1
|
166
|
-
res.PageSize.should == 1000
|
167
|
-
res.RecordsOnThisPage.should == 2
|
168
|
-
res.TotalNumberOfRecords.should == 2
|
169
|
-
res.NumberOfPages.should == 1
|
170
|
-
res.Results.size.should == 2
|
171
|
-
res.Results.first.EmailAddress.should == "subs+7t8787Y@example.com"
|
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"
|
175
|
-
res.Results.first.State.should == "Unconfirmed"
|
176
|
-
res.Results.first.ConsentToTrack.should == "Yes"
|
162
|
+
res = @list.unconfirmed(min_date, 1, 1000, "email", "asc", true, include_sms_preference:true)
|
163
|
+
res.ResultsOrderedBy.should be == "email"
|
164
|
+
res.OrderDirection.should be == "asc"
|
165
|
+
res.PageNumber.should be == 1
|
166
|
+
res.PageSize.should be == 1000
|
167
|
+
res.RecordsOnThisPage.should be == 2
|
168
|
+
res.TotalNumberOfRecords.should be == 2
|
169
|
+
res.NumberOfPages.should be == 1
|
170
|
+
res.Results.size.should be == 2
|
171
|
+
res.Results.first.EmailAddress.should be == "subs+7t8787Y@example.com"
|
172
|
+
res.Results.first.Name.should be =="Unconfirmed One"
|
173
|
+
res.Results.first.Date.should be =="2010-10-25 10:28:00"
|
174
|
+
res.Results.first.ListJoinedDate.should be =="2010-10-25 10:28:00"
|
175
|
+
res.Results.first.State.should be == "Unconfirmed"
|
176
|
+
res.Results.first.ConsentToTrack.should be == "Yes"
|
177
|
+
res.Results.first.ConsentToSendSms.should be == "No"
|
177
178
|
end
|
178
179
|
|
179
180
|
should "get the unsubscribed subscribers for a list" do
|
180
181
|
min_date = "2010-01-01"
|
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",
|
182
|
+
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&includesmspreference=false",
|
182
183
|
"unsubscribed_subscribers.json")
|
183
184
|
res = @list.unsubscribed min_date
|
184
|
-
res.ResultsOrderedBy.should == "email"
|
185
|
-
res.OrderDirection.should == "asc"
|
186
|
-
res.PageNumber.should == 1
|
187
|
-
res.PageSize.should == 1000
|
188
|
-
res.RecordsOnThisPage.should == 5
|
189
|
-
res.TotalNumberOfRecords.should == 5
|
190
|
-
res.NumberOfPages.should == 1
|
191
|
-
res.Results.size.should == 5
|
192
|
-
res.Results.first.EmailAddress.should == "subscriber@example.com"
|
193
|
-
res.Results.first.Name.should == "Unsub One"
|
194
|
-
res.Results.first.Date.should == "2010-10-25 13:11:00"
|
195
|
-
res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
|
196
|
-
res.Results.first.State.should == "Unsubscribed"
|
197
|
-
res.Results.first.CustomFields.size.should == 0
|
198
|
-
res.Results.first.ReadsEmailWith.should == "Gmail"
|
185
|
+
res.ResultsOrderedBy.should be == "email"
|
186
|
+
res.OrderDirection.should be == "asc"
|
187
|
+
res.PageNumber.should be == 1
|
188
|
+
res.PageSize.should be == 1000
|
189
|
+
res.RecordsOnThisPage.should be == 5
|
190
|
+
res.TotalNumberOfRecords.should be == 5
|
191
|
+
res.NumberOfPages.should be == 1
|
192
|
+
res.Results.size.should be == 5
|
193
|
+
res.Results.first.EmailAddress.should be == "subscriber@example.com"
|
194
|
+
res.Results.first.Name.should be == "Unsub One"
|
195
|
+
res.Results.first.Date.should be == "2010-10-25 13:11:00"
|
196
|
+
res.Results.first.ListJoinedDate.should be == "2010-10-25 13:11:00"
|
197
|
+
res.Results.first.State.should be == "Unsubscribed"
|
198
|
+
res.Results.first.CustomFields.size.should be == 0
|
199
|
+
res.Results.first.ReadsEmailWith.should be == "Gmail"
|
199
200
|
end
|
200
201
|
|
201
202
|
should "get the deleted subscribers for a list" do
|
202
203
|
min_date = "2010-01-01"
|
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",
|
204
|
+
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&includesmspreference=false",
|
204
205
|
"deleted_subscribers.json")
|
205
206
|
res = @list.deleted min_date
|
206
|
-
res.ResultsOrderedBy.should == "email"
|
207
|
-
res.OrderDirection.should == "asc"
|
208
|
-
res.PageNumber.should == 1
|
209
|
-
res.PageSize.should == 1000
|
210
|
-
res.RecordsOnThisPage.should == 5
|
211
|
-
res.TotalNumberOfRecords.should == 5
|
212
|
-
res.NumberOfPages.should == 1
|
213
|
-
res.Results.size.should == 5
|
214
|
-
res.Results.first.EmailAddress.should == "subscriber@example.com"
|
215
|
-
res.Results.first.Name.should == "Deleted One"
|
216
|
-
res.Results.first.Date.should == "2010-10-25 13:11:00"
|
217
|
-
res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
|
218
|
-
res.Results.first.State.should == "Deleted"
|
219
|
-
res.Results.first.CustomFields.size.should == 0
|
220
|
-
res.Results.first.ReadsEmailWith.should == "Gmail"
|
207
|
+
res.ResultsOrderedBy.should be == "email"
|
208
|
+
res.OrderDirection.should be == "asc"
|
209
|
+
res.PageNumber.should be == 1
|
210
|
+
res.PageSize.should be == 1000
|
211
|
+
res.RecordsOnThisPage.should be == 5
|
212
|
+
res.TotalNumberOfRecords.should be == 5
|
213
|
+
res.NumberOfPages.should be == 1
|
214
|
+
res.Results.size.should be == 5
|
215
|
+
res.Results.first.EmailAddress.should be == "subscriber@example.com"
|
216
|
+
res.Results.first.Name.should be == "Deleted One"
|
217
|
+
res.Results.first.Date.should be == "2010-10-25 13:11:00"
|
218
|
+
res.Results.first.ListJoinedDate.should be == "2010-10-25 13:11:00"
|
219
|
+
res.Results.first.State.should be == "Deleted"
|
220
|
+
res.Results.first.CustomFields.size.should be == 0
|
221
|
+
res.Results.first.ReadsEmailWith.should be == "Gmail"
|
221
222
|
end
|
222
223
|
|
223
224
|
should "get the bounced subscribers for a list" do
|
224
225
|
min_date = "2010-01-01"
|
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",
|
226
|
+
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&includesmspreference=false",
|
226
227
|
"bounced_subscribers.json")
|
227
228
|
res = @list.bounced min_date
|
228
|
-
res.ResultsOrderedBy.should == "email"
|
229
|
-
res.OrderDirection.should == "asc"
|
230
|
-
res.PageNumber.should == 1
|
231
|
-
res.PageSize.should == 1000
|
232
|
-
res.RecordsOnThisPage.should == 1
|
233
|
-
res.TotalNumberOfRecords.should == 1
|
234
|
-
res.NumberOfPages.should == 1
|
235
|
-
res.Results.size.should == 1
|
236
|
-
res.Results.first.EmailAddress.should == "bouncedsubscriber@example.com"
|
237
|
-
res.Results.first.Name.should == "Bounced One"
|
238
|
-
res.Results.first.Date.should == "2010-10-25 13:11:00"
|
239
|
-
res.Results.first.ListJoinedDate.should == "2010-10-25 13:11:00"
|
240
|
-
res.Results.first.State.should == "Bounced"
|
241
|
-
res.Results.first.CustomFields.size.should == 0
|
242
|
-
res.Results.first.ReadsEmailWith.should == ""
|
229
|
+
res.ResultsOrderedBy.should be == "email"
|
230
|
+
res.OrderDirection.should be == "asc"
|
231
|
+
res.PageNumber.should be == 1
|
232
|
+
res.PageSize.should be == 1000
|
233
|
+
res.RecordsOnThisPage.should be == 1
|
234
|
+
res.TotalNumberOfRecords.should be == 1
|
235
|
+
res.NumberOfPages.should be == 1
|
236
|
+
res.Results.size.should be == 1
|
237
|
+
res.Results.first.EmailAddress.should be == "bouncedsubscriber@example.com"
|
238
|
+
res.Results.first.Name.should be == "Bounced One"
|
239
|
+
res.Results.first.Date.should be == "2010-10-25 13:11:00"
|
240
|
+
res.Results.first.ListJoinedDate.should be == "2010-10-25 13:11:00"
|
241
|
+
res.Results.first.State.should be == "Bounced"
|
242
|
+
res.Results.first.CustomFields.size.should be == 0
|
243
|
+
res.Results.first.ReadsEmailWith.should be == ""
|
243
244
|
end
|
244
245
|
|
245
246
|
should "get the webhooks for a list" do
|
246
247
|
stub_get(@auth, "lists/#{@list.list_id}/webhooks.json", "list_webhooks.json")
|
247
248
|
hooks = @list.webhooks
|
248
|
-
hooks.size.should == 2
|
249
|
-
hooks.first.WebhookID.should == "943678317049bc13"
|
250
|
-
hooks.first.Events.size.should == 1
|
251
|
-
hooks.first.Events.first.should == "Deactivate"
|
252
|
-
hooks.first.Url.should == "http://www.postbin.org/d9w8ud9wud9w"
|
253
|
-
hooks.first.Status.should == "Active"
|
254
|
-
hooks.first.PayloadFormat.should == "Json"
|
249
|
+
hooks.size.should be == 2
|
250
|
+
hooks.first.WebhookID.should be == "943678317049bc13"
|
251
|
+
hooks.first.Events.size.should be == 1
|
252
|
+
hooks.first.Events.first.should be == "Deactivate"
|
253
|
+
hooks.first.Url.should be == "http://www.postbin.org/d9w8ud9wud9w"
|
254
|
+
hooks.first.Status.should be == "Active"
|
255
|
+
hooks.first.PayloadFormat.should be == "Json"
|
255
256
|
end
|
256
257
|
|
257
258
|
should "create a webhook for a list" do
|
258
259
|
stub_post(@auth, "lists/#{@list.list_id}/webhooks.json", "create_list_webhook.json")
|
259
260
|
webhook_id = @list.create_webhook ["Unsubscribe", "Spam"], "http://example.com/unsub", "json"
|
260
|
-
webhook_id.should == "6a783d359bd44ef62c6ca0d3eda4412a"
|
261
|
+
webhook_id.should be == "6a783d359bd44ef62c6ca0d3eda4412a"
|
261
262
|
end
|
262
263
|
|
263
264
|
should "test a webhook for a list" do
|
data/test/person_test.rb
CHANGED
@@ -11,16 +11,16 @@ class PersonTest < Test::Unit::TestCase
|
|
11
11
|
email = "person@example.com"
|
12
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
|
-
person.EmailAddress.should == email
|
15
|
-
person.Name.should == "Person One"
|
16
|
-
person.AccessLevel.should == 1023
|
17
|
-
person.Status.should == "Active"
|
14
|
+
person.EmailAddress.should be == email
|
15
|
+
person.Name.should be == "Person One"
|
16
|
+
person.AccessLevel.should be == 1023
|
17
|
+
person.Status.should be == "Active"
|
18
18
|
end
|
19
19
|
|
20
20
|
should "add a person" do
|
21
21
|
stub_post(@auth, "clients/#{@client_id}/people.json", "add_person.json")
|
22
22
|
result = CreateSend::Person.add @auth, @client_id, "person@example.com", "Person", 0, "Password"
|
23
|
-
result.EmailAddress.should == "person@example.com"
|
23
|
+
result.EmailAddress.should be == "person@example.com"
|
24
24
|
end
|
25
25
|
|
26
26
|
should "update a person" do
|
@@ -28,7 +28,7 @@ class PersonTest < Test::Unit::TestCase
|
|
28
28
|
new_email = "new_email_address@example.com"
|
29
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
|
-
@person.email_address.should == new_email
|
31
|
+
@person.email_address.should be == new_email
|
32
32
|
end
|
33
33
|
|
34
34
|
should "delete a person" do
|