createsend 6.0.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/segment_test.rb CHANGED
@@ -11,7 +11,7 @@ class SegmentTest < Test::Unit::TestCase
11
11
  rule_groups = [ { :Rules => [ { :RuleType => "EmailAddress", :Clause => "CONTAINS example.com" } ] } ]
12
12
  stub_post(@auth, "segments/#{list_id}.json", "create_segment.json")
13
13
  res = CreateSend::Segment.create @auth, list_id, "new segment title", rule_groups
14
- res.should == "0246c2aea610a3545d9780bf6ab89006"
14
+ res.should be == "0246c2aea610a3545d9780bf6ab89006"
15
15
  end
16
16
 
17
17
  should "update a segment" do
@@ -31,20 +31,20 @@ class SegmentTest < Test::Unit::TestCase
31
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
- res.ResultsOrderedBy.should == "email"
35
- res.OrderDirection.should == "asc"
36
- res.PageNumber.should == 1
37
- res.PageSize.should == 1000
38
- res.RecordsOnThisPage.should == 2
39
- res.TotalNumberOfRecords.should == 2
40
- res.NumberOfPages.should == 1
41
- res.Results.size.should == 2
42
- res.Results.first.EmailAddress.should == "personone@example.com"
43
- res.Results.first.Name.should == "Person One"
44
- res.Results.first.Date.should == "2010-10-27 13:13:00"
45
- res.Results.first.ListJoinedDate.should == "2010-10-27 13:13:00"
46
- res.Results.first.State.should == "Active"
47
- res.Results.first.CustomFields.should == []
34
+ res.ResultsOrderedBy.should be == "email"
35
+ res.OrderDirection.should be == "asc"
36
+ res.PageNumber.should be == 1
37
+ res.PageSize.should be == 1000
38
+ res.RecordsOnThisPage.should be == 2
39
+ res.TotalNumberOfRecords.should be == 2
40
+ res.NumberOfPages.should be == 1
41
+ res.Results.size.should be == 2
42
+ res.Results.first.EmailAddress.should be == "personone@example.com"
43
+ res.Results.first.Name.should be == "Person One"
44
+ res.Results.first.Date.should be == "2010-10-27 13:13:00"
45
+ res.Results.first.ListJoinedDate.should be == "2010-10-27 13:13:00"
46
+ res.Results.first.State.should be == "Active"
47
+ res.Results.first.CustomFields.should be == []
48
48
  end
49
49
 
50
50
  should "delete a segment" do
@@ -55,14 +55,14 @@ class SegmentTest < Test::Unit::TestCase
55
55
  should "get the details of a segment" do
56
56
  stub_get(@auth, "segments/#{@segment.segment_id}.json", "segment_details.json")
57
57
  res = @segment.details
58
- res.ActiveSubscribers.should == 0
59
- res.RuleGroups.size.should == 2
60
- res.RuleGroups.first.Rules.size.should == 1
61
- res.RuleGroups.first.Rules.first.RuleType.should == "EmailAddress"
62
- res.RuleGroups.first.Rules.first.Clause.should == "CONTAINS @hello.com"
63
- res.ListID.should == "2bea949d0bf96148c3e6a209d2e82060"
64
- res.SegmentID.should == "dba84a225d5ce3d19105d7257baac46f"
65
- res.Title.should == "My Segment"
58
+ res.ActiveSubscribers.should be == 0
59
+ res.RuleGroups.size.should be == 2
60
+ res.RuleGroups.first.Rules.size.should be == 1
61
+ res.RuleGroups.first.Rules.first.RuleType.should be == "EmailAddress"
62
+ res.RuleGroups.first.Rules.first.Clause.should be == "CONTAINS @hello.com"
63
+ res.ListID.should be == "2bea949d0bf96148c3e6a209d2e82060"
64
+ res.SegmentID.should be == "dba84a225d5ce3d19105d7257baac46f"
65
+ res.Title.should be == "My Segment"
66
66
  end
67
67
 
68
68
  should "clear a segment's rules" do
@@ -11,37 +11,40 @@ class SubscriberTest < Test::Unit::TestCase
11
11
  email = "subscriber@example.com"
12
12
  stub_get(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}&includetrackingpreference=false", "subscriber_details.json")
13
13
  subscriber = CreateSend::Subscriber.get @auth, @list_id, email
14
- subscriber.EmailAddress.should == email
15
- subscriber.Name.should == "Subscriber One"
16
- subscriber.Date.should == "2010-10-25 10:28:00"
17
- subscriber.ListJoinedDate.should == "2010-10-25 10:28:00"
18
- subscriber.State.should == "Active"
19
- subscriber.CustomFields.size.should == 3
20
- subscriber.CustomFields.first.Key.should == 'website'
21
- subscriber.CustomFields.first.Value.should == 'http://example.com'
22
- subscriber.ReadsEmailWith.should == "Gmail"
14
+ subscriber.EmailAddress.should be == email
15
+ subscriber.Name.should be == "Subscriber One"
16
+ subscriber.Date.should be == "2010-10-25 10:28:00"
17
+ subscriber.MobileNumber.should be == "+61423153526"
18
+ subscriber.ListJoinedDate.should be == "2010-10-25 10:28:00"
19
+ subscriber.State.should be == "Active"
20
+ subscriber.CustomFields.size.should be == 3
21
+ subscriber.CustomFields.first.Key.should be == 'website'
22
+ subscriber.CustomFields.first.Value.should be == 'http://example.com'
23
+ subscriber.ReadsEmailWith.should be == "Gmail"
23
24
  end
24
25
 
25
- should "get a subscriber with track preference information" do
26
+ should "get a subscriber with track and sms preference information" do
26
27
  email = "subscriber@example.com"
27
- stub_get(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}&includetrackingpreference=true", "subscriber_details_with_track_pref.json")
28
+ stub_get(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}&includetrackingpreference=true", "subscriber_details_with_track_and_sms_pref.json")
28
29
  subscriber = CreateSend::Subscriber.get @auth, @list_id, email, true
29
- subscriber.EmailAddress.should == email
30
- subscriber.Name.should == "Subscriber One"
31
- subscriber.ConsentToTrack == "Yes"
30
+ subscriber.EmailAddress.should be == email
31
+ subscriber.Name.should be == "Subscriber One"
32
+ subscriber.MobileNumber.should be == "+61423153526"
33
+ subscriber.ConsentToTrack.should be == "Yes"
34
+ subscriber.ConsentToSendSms.should be == "No"
32
35
  end
33
36
 
34
37
  should "add a subscriber without custom fields" do
35
38
  stub_post(@auth, "subscribers/#{@list_id}.json", "add_subscriber.json")
36
39
  email_address = CreateSend::Subscriber.add @auth, @list_id, "subscriber@example.com", "Subscriber", [], true, "Yes"
37
- email_address.should == "subscriber@example.com"
40
+ email_address.should be == "subscriber@example.com"
38
41
  end
39
42
 
40
43
  should "add a subscriber with custom fields" do
41
44
  stub_post(@auth, "subscribers/#{@list_id}.json", "add_subscriber.json")
42
45
  custom_fields = [ { :Key => 'website', :Value => 'http://example.com/' } ]
43
46
  email_address = CreateSend::Subscriber.add @auth, @list_id, "subscriber@example.com", "Subscriber", custom_fields, true, "Yes"
44
- email_address.should == "subscriber@example.com"
47
+ email_address.should be == "subscriber@example.com"
45
48
  end
46
49
 
47
50
  should "add a subscriber with custom fields including multi-option fields" do
@@ -50,7 +53,7 @@ class SubscriberTest < Test::Unit::TestCase
50
53
  { :Key => 'multioptionselectmany', :Value => 'firstoption' },
51
54
  { :Key => 'multioptionselectmany', :Value => 'secondoption' } ]
52
55
  email_address = CreateSend::Subscriber.add @auth, @list_id, "subscriber@example.com", "Subscriber", custom_fields, true, "Yes"
53
- email_address.should == "subscriber@example.com"
56
+ email_address.should be == "subscriber@example.com"
54
57
  end
55
58
 
56
59
  should "update a subscriber with custom fields" do
@@ -59,7 +62,7 @@ class SubscriberTest < Test::Unit::TestCase
59
62
  stub_put(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}", nil)
60
63
  custom_fields = [ { :Key => 'website', :Value => 'http://example.com/' } ]
61
64
  @subscriber.update new_email, "Subscriber", custom_fields, true, "Yes"
62
- @subscriber.email_address.should == new_email
65
+ @subscriber.email_address.should be == new_email
63
66
  end
64
67
 
65
68
  should "update a subscriber with custom fields including the clear option" do
@@ -68,7 +71,7 @@ class SubscriberTest < Test::Unit::TestCase
68
71
  stub_put(@auth, "subscribers/#{@list_id}.json?email=#{ERB::Util.url_encode(email)}", nil)
69
72
  custom_fields = [ { :Key => 'website', :Value => '', :Clear => true } ]
70
73
  @subscriber.update new_email, "Subscriber", custom_fields, true, "No"
71
- @subscriber.email_address.should == new_email
74
+ @subscriber.email_address.should be == new_email
72
75
  end
73
76
 
74
77
  should "import many subscribers at once" do
@@ -79,11 +82,11 @@ class SubscriberTest < Test::Unit::TestCase
79
82
  { :EmailAddress => "example+3@example.com", :Name => "Example Three" },
80
83
  ]
81
84
  import_result = CreateSend::Subscriber.import @auth, @list_id, subscribers, true
82
- import_result.FailureDetails.size.should == 0
83
- import_result.TotalUniqueEmailsSubmitted.should == 3
84
- import_result.TotalExistingSubscribers.should == 0
85
- import_result.TotalNewSubscribers.should == 3
86
- import_result.DuplicateEmailsInSubmission.size.should == 0
85
+ import_result.FailureDetails.size.should be == 0
86
+ import_result.TotalUniqueEmailsSubmitted.should be == 3
87
+ import_result.TotalExistingSubscribers.should be == 0
88
+ import_result.TotalNewSubscribers.should be == 3
89
+ import_result.DuplicateEmailsInSubmission.size.should be == 0
87
90
  end
88
91
 
89
92
  should "import many subscribers at once, and start subscription-based autoresponders" do
@@ -94,11 +97,11 @@ class SubscriberTest < Test::Unit::TestCase
94
97
  { :EmailAddress => "example+3@example.com", :Name => "Example Three" },
95
98
  ]
96
99
  import_result = CreateSend::Subscriber.import @auth, @list_id, subscribers, true, true
97
- import_result.FailureDetails.size.should == 0
98
- import_result.TotalUniqueEmailsSubmitted.should == 3
99
- import_result.TotalExistingSubscribers.should == 0
100
- import_result.TotalNewSubscribers.should == 3
101
- import_result.DuplicateEmailsInSubmission.size.should == 0
100
+ import_result.FailureDetails.size.should be == 0
101
+ import_result.TotalUniqueEmailsSubmitted.should be == 3
102
+ import_result.TotalExistingSubscribers.should be == 0
103
+ import_result.TotalNewSubscribers.should be == 3
104
+ import_result.DuplicateEmailsInSubmission.size.should be == 0
102
105
  end
103
106
 
104
107
  should "import many subscribers at once with custom fields, including the clear option" do
@@ -109,11 +112,11 @@ class SubscriberTest < Test::Unit::TestCase
109
112
  { :EmailAddress => "example+3@example.com", :Name => "Example Three", :CustomFields => [ { :Key => 'website', :Value => '', :Clear => false } ] },
110
113
  ]
111
114
  import_result = CreateSend::Subscriber.import @auth, @list_id, subscribers, true
112
- import_result.FailureDetails.size.should == 0
113
- import_result.TotalUniqueEmailsSubmitted.should == 3
114
- import_result.TotalExistingSubscribers.should == 0
115
- import_result.TotalNewSubscribers.should == 3
116
- import_result.DuplicateEmailsInSubmission.size.should == 0
115
+ import_result.FailureDetails.size.should be == 0
116
+ import_result.TotalUniqueEmailsSubmitted.should be == 3
117
+ import_result.TotalExistingSubscribers.should be == 0
118
+ import_result.TotalNewSubscribers.should be == 3
119
+ import_result.DuplicateEmailsInSubmission.size.should be == 0
117
120
  end
118
121
 
119
122
  should "import many subscribers at once with partial success" do
@@ -125,14 +128,14 @@ class SubscriberTest < Test::Unit::TestCase
125
128
  { :EmailAddress => "example+3@example.com", :Name => "Example Three" },
126
129
  ]
127
130
  import_result = CreateSend::Subscriber.import @auth, @list_id, subscribers, true
128
- import_result.FailureDetails.size.should == 1
129
- import_result.FailureDetails.first.EmailAddress.should == "example+1@example"
130
- import_result.FailureDetails.first.Code.should == 1
131
- import_result.FailureDetails.first.Message.should == "Invalid Email Address"
132
- import_result.TotalUniqueEmailsSubmitted.should == 3
133
- import_result.TotalExistingSubscribers.should == 2
134
- import_result.TotalNewSubscribers.should == 0
135
- import_result.DuplicateEmailsInSubmission.size.should == 0
131
+ import_result.FailureDetails.size.should be == 1
132
+ import_result.FailureDetails.first.EmailAddress.should be == "example+1@example"
133
+ import_result.FailureDetails.first.Code.should be == 1
134
+ import_result.FailureDetails.first.Message.should be == "Invalid Email Address"
135
+ import_result.TotalUniqueEmailsSubmitted.should be == 3
136
+ import_result.TotalExistingSubscribers.should be == 2
137
+ import_result.TotalNewSubscribers.should be == 0
138
+ import_result.DuplicateEmailsInSubmission.size.should be == 0
136
139
  end
137
140
 
138
141
  should "raise a BadRequest error if the import _completely_ fails because of a bad request" do
@@ -143,7 +146,7 @@ class SubscriberTest < Test::Unit::TestCase
143
146
  { :EmailAddress => "example+2@example.com", :Name => "Example Two" },
144
147
  { :EmailAddress => "example+3@example.com", :Name => "Example Three" },
145
148
  ]
146
- lambda { import_result = CreateSend::Subscriber.import @auth, @list_id, subscribers,
149
+ lambda { CreateSend::Subscriber.import @auth, @list_id, subscribers,
147
150
  true }.should raise_error(CreateSend::BadRequest)
148
151
  end
149
152
 
@@ -155,15 +158,15 @@ class SubscriberTest < Test::Unit::TestCase
155
158
  should "get a subscriber's history" do
156
159
  stub_get(@auth, "subscribers/#{@subscriber.list_id}/history.json?email=#{ERB::Util.url_encode(@subscriber.email_address)}", "subscriber_history.json")
157
160
  history = @subscriber.history
158
- history.size.should == 1
159
- history.first.Name.should == "Campaign One"
160
- history.first.Type.should == "Campaign"
161
- history.first.ID.should == "fc0ce7105baeaf97f47c99be31d02a91"
162
- history.first.Actions.size.should == 6
163
- history.first.Actions.first.Event.should == "Open"
164
- history.first.Actions.first.Date.should == "2010-10-12 13:18:00"
165
- history.first.Actions.first.IPAddress.should == "192.168.126.87"
166
- history.first.Actions.first.Detail.should == ""
161
+ history.size.should be == 1
162
+ history.first.Name.should be == "Campaign One"
163
+ history.first.Type.should be == "Campaign"
164
+ history.first.ID.should be == "fc0ce7105baeaf97f47c99be31d02a91"
165
+ history.first.Actions.size.should be == 6
166
+ history.first.Actions.first.Event.should be == "Open"
167
+ history.first.Actions.first.Date.should be == "2010-10-12 13:18:00"
168
+ history.first.Actions.first.IPAddress.should be == "192.168.126.87"
169
+ history.first.Actions.first.Detail.should be == ""
167
170
  end
168
171
 
169
172
  should "delete a subscriber" do
@@ -11,16 +11,16 @@ class TemplateTest < Test::Unit::TestCase
11
11
  stub_post(@auth, "templates/#{client_id}.json", "create_template.json")
12
12
  template_id = CreateSend::Template.create @auth, client_id, "Template One", "http://templates.org/index.html",
13
13
  "http://templates.org/files.zip"
14
- template_id.should == "98y2e98y289dh89h938389"
14
+ template_id.should be == "98y2e98y289dh89h938389"
15
15
  end
16
16
 
17
17
  should "get details of a template" do
18
18
  stub_get(@auth, "templates/#{@template.template_id}.json", "template_details.json")
19
19
  t = @template.details
20
- t.TemplateID.should == "98y2e98y289dh89h938389"
21
- t.Name.should == "Template One"
22
- t.PreviewURL.should == "http://preview.createsend.com/createsend/templates/previewTemplate.aspx?ID=01AF532CD8889B33&d=r&c=E816F55BFAD1A753"
23
- t.ScreenshotURL.should == "http://preview.createsend.com/ts/r/14/833/263/14833263.jpg?0318092600"
20
+ t.TemplateID.should be == "98y2e98y289dh89h938389"
21
+ t.Name.should be == "Template One"
22
+ t.PreviewURL.should be == "http://preview.createsend.com/createsend/templates/previewTemplate.aspx?ID=01AF532CD8889B33&d=r&c=E816F55BFAD1A753"
23
+ t.ScreenshotURL.should be == "http://preview.createsend.com/ts/r/14/833/263/14833263.jpg?0318092600"
24
24
  end
25
25
 
26
26
  should "update a template" do
@@ -17,8 +17,8 @@ class TransactionalClassicEmailTest < Test::Unit::TestCase
17
17
  "Group" => 'Ruby test group'
18
18
  }
19
19
  response = CreateSend::Transactional::ClassicEmail.new(@auth).send(email)
20
- response.length.should == 1
21
- response[0].Recipient.should == "\"Bob Sacamano\" <bob@example.com>"
20
+ response.length.should be == 1
21
+ response[0].Recipient.should be == "\"Bob Sacamano\" <bob@example.com>"
22
22
  end
23
23
 
24
24
  should "send classic email to with all the options" do
@@ -44,15 +44,15 @@ class TransactionalClassicEmailTest < Test::Unit::TestCase
44
44
  "AddRecipientsToListID" => "6d0366fcee146ab9bdaf3247446bbfdd"
45
45
  }
46
46
  response = CreateSend::Transactional::ClassicEmail.new(@auth).send(email)
47
- response.length.should == 2
48
- response[1].Recipient.should == "\"Newman\" <newman@example.com>"
47
+ response.length.should be == 2
48
+ response[1].Recipient.should be == "\"Newman\" <newman@example.com>"
49
49
  end
50
50
 
51
51
  should "get the list of classic groups" do
52
52
  stub_get(@auth, "transactional/classicemail/groups", "tx_classicemail_groups.json")
53
53
  response = CreateSend::Transactional::ClassicEmail.new(@auth).groups
54
- response.length.should == 3
55
- response[0].Group.should == "Password Reset"
54
+ response.length.should be == 3
55
+ response[0].Group.should be == "Password Reset"
56
56
  end
57
57
 
58
58
  end
@@ -11,27 +11,27 @@ class TransactionalSmartEmailTest < Test::Unit::TestCase
11
11
  should "get the list of smart emails" do
12
12
  stub_get(@auth, "transactional/smartemail", "tx_smartemails.json")
13
13
  response = CreateSend::Transactional::SmartEmail.list(@auth)
14
- response.length.should == 2
15
- response[0].ID.should == "1e654df2-f484-11e4-970c-6c4008bc7468"
16
- response[0].Name.should == "Welcome email"
17
- response[0].Status.should == "Active"
14
+ response.length.should be == 2
15
+ response[0].ID.should be == "1e654df2-f484-11e4-970c-6c4008bc7468"
16
+ response[0].Name.should be == "Welcome email"
17
+ response[0].Status.should be == "Active"
18
18
  end
19
19
 
20
20
  should "get the list of active smart emails using a client ID" do
21
21
  stub_get(@auth, "transactional/smartemail?status=active&client=#{@client_id}", "tx_smartemails.json")
22
22
  response = CreateSend::Transactional::SmartEmail.list(@auth, { :client => @client_id, :status => 'active'} )
23
- response.length.should == 2
24
- response[0].ID.should == "1e654df2-f484-11e4-970c-6c4008bc7468"
25
- response[0].Name.should == "Welcome email"
26
- response[0].Status.should == "Active"
23
+ response.length.should be == 2
24
+ response[0].ID.should be == "1e654df2-f484-11e4-970c-6c4008bc7468"
25
+ response[0].Name.should be == "Welcome email"
26
+ response[0].Status.should be == "Active"
27
27
  end
28
28
 
29
29
  should "get the details of smart email" do
30
30
  stub_get(@auth, "transactional/smartemail/#{@smart_email_id}", "tx_smartemail_details.json")
31
31
  response = CreateSend::Transactional::SmartEmail.new(@auth, @smart_email_id).details
32
- response.Name.should == "Reset Password"
33
- response.Status.should == "active"
34
- response.Properties.ReplyTo.should == "joe@example.com"
32
+ response.Name.should be == "Reset Password"
33
+ response.Status.should be == "active"
34
+ response.Properties.ReplyTo.should be == "joe@example.com"
35
35
  end
36
36
 
37
37
  should "send smart email to one recipient" do
@@ -44,10 +44,10 @@ class TransactionalSmartEmailTest < Test::Unit::TestCase
44
44
  }
45
45
  }
46
46
  response = CreateSend::Transactional::SmartEmail.new(@auth, @smart_email_id).send(email)
47
- response.length.should == 1
48
- response[0].MessageID.should == "0cfe150d-d507-11e4-84a7-c31e5b59881d"
49
- response[0].Recipient.should == "\"Bob Sacamano\" <bob@example.com>"
50
- response[0].Status.should == "Received"
47
+ response.length.should be == 1
48
+ response[0].MessageID.should be == "0cfe150d-d507-11e4-84a7-c31e5b59881d"
49
+ response[0].Recipient.should be == "\"Bob Sacamano\" <bob@example.com>"
50
+ response[0].Status.should be == "Received"
51
51
  end
52
52
 
53
53
  should "send smart email to multiple recipients with all the options" do
@@ -71,10 +71,10 @@ class TransactionalSmartEmailTest < Test::Unit::TestCase
71
71
  "AddRecipientsToListID" => true
72
72
  }
73
73
  response = CreateSend::Transactional::SmartEmail.new(@auth, @smart_email_id).send(email)
74
- response.length.should == 2
75
- response[1].MessageID.should == "0cfe150d-d507-11e4-b579-a64eb0d9c74d"
76
- response[1].Recipient.should == "\"Newman\" <newman@example.com>"
77
- response[1].Status.should == "Received"
74
+ response.length.should be == 2
75
+ response[1].MessageID.should be == "0cfe150d-d507-11e4-b579-a64eb0d9c74d"
76
+ response[1].Recipient.should be == "\"Newman\" <newman@example.com>"
77
+ response[1].Status.should be == "Received"
78
78
  end
79
79
 
80
80
  end
@@ -13,8 +13,8 @@ class TransactionalTimelineTest < Test::Unit::TestCase
13
13
  should "get statistics with the default parameters" do
14
14
  stub_get(@auth, "transactional/statistics", "tx_statistics_classic.json")
15
15
  response = CreateSend::Transactional::Timeline.new(@auth).statistics
16
- response.Sent.should == 1000
17
- response.Opened.should == 300
16
+ response.Sent.should be == 1000
17
+ response.Opened.should be == 300
18
18
  end
19
19
 
20
20
  should "get statistics filtered by date and classic group" do
@@ -25,9 +25,9 @@ class TransactionalTimelineTest < Test::Unit::TestCase
25
25
  "timezone" => "client",
26
26
  "group" => "Password Reset"
27
27
  )
28
- response.Query.TimeZone.should == "(GMT+10:00) Canberra, Melbourne, Sydney"
29
- response.Query.Group.should == "Password Reset"
30
- response.Sent.should == 1000
28
+ response.Query.TimeZone.should be == "(GMT+10:00) Canberra, Melbourne, Sydney"
29
+ response.Query.Group.should be == "Password Reset"
30
+ response.Sent.should be == 1000
31
31
  end
32
32
 
33
33
  should "get statistics filtered by date and smart email" do
@@ -38,17 +38,17 @@ class TransactionalTimelineTest < Test::Unit::TestCase
38
38
  "timezone" => "utc",
39
39
  "smartEmailID" => "bb4a6ebb-663d-42a0-bdbe-60512cf30a01"
40
40
  )
41
- response.Query.TimeZone.should == "UTC"
42
- response.Query.SmartEmailID.should == "bb4a6ebb-663d-42a0-bdbe-60512cf30a01"
43
- response.Sent.should == 1000
41
+ response.Query.TimeZone.should be == "UTC"
42
+ response.Query.SmartEmailID.should be == "bb4a6ebb-663d-42a0-bdbe-60512cf30a01"
43
+ response.Sent.should be == 1000
44
44
  end
45
45
 
46
46
  should "get the message timeline with default parameters" do
47
47
  stub_get(@auth, "transactional/messages", "tx_messages.json")
48
48
  response = CreateSend::Transactional::Timeline.new(@auth).messages
49
- response.length.should == 3
50
- response[0].MessageID.should == "ddc697c7-0788-4df3-a71a-a7cb935f00bd"
51
- response[0].Status.should == "Delivered"
49
+ response.length.should be == 3
50
+ response[0].MessageID.should be == "ddc697c7-0788-4df3-a71a-a7cb935f00bd"
51
+ response[0].Status.should be == "Delivered"
52
52
  end
53
53
 
54
54
  should "get the message timeline for a smart email" do
@@ -61,9 +61,9 @@ class TransactionalTimelineTest < Test::Unit::TestCase
61
61
  "smartEmailID" => @smart_email_id,
62
62
  "clientID" => @client_id
63
63
  )
64
- response.length.should == 1
65
- response[0].MessageID.should == "ddc697c7-0788-4df3-a71a-a7cb935f00bd"
66
- response[0].Status.should == "Delivered"
64
+ response.length.should be == 1
65
+ response[0].MessageID.should be == "ddc697c7-0788-4df3-a71a-a7cb935f00bd"
66
+ response[0].Status.should be == "Delivered"
67
67
  end
68
68
 
69
69
  should "get the message timeline for a classic group" do
@@ -76,32 +76,32 @@ class TransactionalTimelineTest < Test::Unit::TestCase
76
76
  "group" => 'Password Reset',
77
77
  "clientID" => @client_id
78
78
  )
79
- response.length.should == 1
80
- response[0].Group.should == "Password Reset"
81
- response[0].Status.should == "Delivered"
79
+ response.length.should be == 1
80
+ response[0].Group.should be == "Password Reset"
81
+ response[0].Status.should be == "Delivered"
82
82
  end
83
83
 
84
84
  should "get the message details" do
85
85
  stub_get(@auth, "transactional/messages/#{@message_id}", "tx_message_details.json")
86
86
  response = CreateSend::Transactional::Timeline.new(@auth).details(@message_id)
87
- response.TotalOpens.should == 1
88
- response.TotalClicks.should == 1
87
+ response.TotalOpens.should be == 1
88
+ response.TotalClicks.should be == 1
89
89
  end
90
90
 
91
91
  should "get the message details with statistics" do
92
92
  stub_get(@auth, "transactional/messages/#{@message_id}?statistics=true", "tx_message_details_with_statistics.json")
93
93
  response = CreateSend::Transactional::Timeline.new(@auth).details(@message_id, :statistics => true)
94
- response.Opens.length == 1
95
- response.Clicks.length == 1
94
+ response.Opens.length.should be == 1
95
+ response.Clicks.length.should be == 1
96
96
  end
97
97
 
98
98
  should "resend a message" do
99
99
  stub_post(@auth, "transactional/messages/#{@message_id}/resend", "tx_send_single.json")
100
100
  response = CreateSend::Transactional::Timeline.new(@auth).resend(@message_id)
101
- response.length.should == 1
102
- response[0].MessageID.should == "0cfe150d-d507-11e4-84a7-c31e5b59881d"
103
- response[0].Recipient.should == "\"Bob Sacamano\" <bob@example.com>"
104
- response[0].Status.should == "Received"
101
+ response.length.should be == 1
102
+ response[0].MessageID.should be == "0cfe150d-d507-11e4-84a7-c31e5b59881d"
103
+ response[0].Recipient.should be == "\"Bob Sacamano\" <bob@example.com>"
104
+ response[0].Status.should be == "Received"
105
105
  end
106
106
 
107
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: createsend
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Dennes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '3.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: httparty
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +195,7 @@ files:
189
195
  - samples/journey_sample.rb
190
196
  - samples/lists_sample.rb
191
197
  - samples/segments_sample.rb
192
- - samples/subscribes_sample.rb
198
+ - samples/subscribers_sample.rb
193
199
  - test/administrator_test.rb
194
200
  - test/campaign_test.rb
195
201
  - test/client_test.rb
@@ -259,7 +265,7 @@ files:
259
265
  - test/fixtures/segment_subscribers.json
260
266
  - test/fixtures/segments.json
261
267
  - test/fixtures/subscriber_details.json
262
- - test/fixtures/subscriber_details_with_track_pref.json
268
+ - test/fixtures/subscriber_details_with_track_and_sms_pref.json
263
269
  - test/fixtures/subscriber_history.json
264
270
  - test/fixtures/suppressionlist.json
265
271
  - test/fixtures/systemdate.json
@@ -306,14 +312,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
312
  requirements:
307
313
  - - ">="
308
314
  - !ruby/object:Gem::Version
309
- version: '0'
315
+ version: '2.0'
310
316
  required_rubygems_version: !ruby/object:Gem::Requirement
311
317
  requirements:
312
318
  - - ">="
313
319
  - !ruby/object:Gem::Version
314
320
  version: 1.3.6
315
321
  requirements: []
316
- rubygems_version: 3.3.3
322
+ rubygems_version: 3.2.22
317
323
  signing_key:
318
324
  specification_version: 4
319
325
  summary: A library which implements the complete functionality of the Campaign Monitor
@@ -1,22 +0,0 @@
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"