createsend 5.1.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +30 -0
  3. data/README.md +2 -2
  4. data/createsend.gemspec +1 -1
  5. data/lib/createsend/client.rb +19 -3
  6. data/lib/createsend/createsend.rb +1 -1
  7. data/lib/createsend/list.rb +13 -12
  8. data/lib/createsend/subscriber.rb +8 -4
  9. data/lib/createsend/version.rb +1 -1
  10. data/samples/authentication_sample.rb +64 -0
  11. data/samples/clients_sample.rb +79 -0
  12. data/samples/journey_sample.rb +3 -2
  13. data/samples/lists_sample.rb +51 -0
  14. data/samples/segments_sample.rb +21 -0
  15. data/samples/subscribers_sample.rb +51 -0
  16. data/test/administrator_test.rb +5 -5
  17. data/test/campaign_test.rb +114 -113
  18. data/test/client_test.rb +121 -98
  19. data/test/createsend_test.rb +47 -47
  20. data/test/fixtures/active_subscribers.json +5 -0
  21. data/test/fixtures/bounced_subscribers.json +1 -0
  22. data/test/fixtures/campaign_summary.json +2 -1
  23. data/test/fixtures/campaigns.json +37 -26
  24. data/test/fixtures/deleted_subscribers.json +5 -0
  25. data/test/fixtures/drafts.json +4 -2
  26. data/test/fixtures/scheduled_campaigns.json +4 -2
  27. data/test/fixtures/segment_subscribers.json +2 -0
  28. data/test/fixtures/subscriber_details.json +2 -0
  29. data/test/fixtures/{subscriber_details_with_track_pref.json → subscriber_details_with_track_and_sms_pref.json} +4 -1
  30. data/test/fixtures/tags.json +10 -0
  31. data/test/fixtures/unconfirmed_subscribers.json +6 -2
  32. data/test/fixtures/unsubscribed_subscribers.json +6 -1
  33. data/test/helper.rb +1 -1
  34. data/test/journey_test.rb +86 -86
  35. data/test/list_test.rb +130 -123
  36. data/test/person_test.rb +6 -6
  37. data/test/segment_test.rb +23 -22
  38. data/test/subscriber_test.rb +55 -51
  39. data/test/template_test.rb +5 -5
  40. data/test/transactional_classic_email_test.rb +6 -6
  41. data/test/transactional_smart_email_test.rb +19 -19
  42. data/test/transactional_timeline_test.rb +25 -25
  43. metadata +16 -113
@@ -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: 5.1.1
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Dennes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-08 00:00:00.000000000 Z
11
+ date: 2023-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: 12.3.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: 12.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fakeweb
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,12 @@ files:
184
184
  - lib/createsend/transactional_smart_email.rb
185
185
  - lib/createsend/transactional_timeline.rb
186
186
  - lib/createsend/version.rb
187
+ - samples/authentication_sample.rb
188
+ - samples/clients_sample.rb
187
189
  - samples/journey_sample.rb
190
+ - samples/lists_sample.rb
191
+ - samples/segments_sample.rb
192
+ - samples/subscribers_sample.rb
188
193
  - test/administrator_test.rb
189
194
  - test/campaign_test.rb
190
195
  - test/client_test.rb
@@ -254,10 +259,11 @@ files:
254
259
  - test/fixtures/segment_subscribers.json
255
260
  - test/fixtures/segments.json
256
261
  - test/fixtures/subscriber_details.json
257
- - test/fixtures/subscriber_details_with_track_pref.json
262
+ - test/fixtures/subscriber_details_with_track_and_sms_pref.json
258
263
  - test/fixtures/subscriber_history.json
259
264
  - test/fixtures/suppressionlist.json
260
265
  - test/fixtures/systemdate.json
266
+ - test/fixtures/tags.json
261
267
  - test/fixtures/template_details.json
262
268
  - test/fixtures/templates.json
263
269
  - test/fixtures/timezones.json
@@ -292,7 +298,7 @@ homepage: http://campaignmonitor.github.io/createsend-ruby/
292
298
  licenses:
293
299
  - MIT
294
300
  metadata: {}
295
- post_install_message:
301
+ post_install_message:
296
302
  rdoc_options: []
297
303
  require_paths:
298
304
  - lib
@@ -307,112 +313,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
313
  - !ruby/object:Gem::Version
308
314
  version: 1.3.6
309
315
  requirements: []
310
- rubygems_version: 3.0.3
311
- signing_key:
316
+ rubygems_version: 3.2.22
317
+ signing_key:
312
318
  specification_version: 4
313
319
  summary: A library which implements the complete functionality of the Campaign Monitor
314
320
  API.
315
- test_files:
316
- - test/administrator_test.rb
317
- - test/campaign_test.rb
318
- - test/client_test.rb
319
- - test/createsend_test.rb
320
- - test/fixtures/active_subscribers.json
321
- - test/fixtures/add_admin.json
322
- - test/fixtures/add_person.json
323
- - test/fixtures/add_subscriber.json
324
- - test/fixtures/admin_details.json
325
- - test/fixtures/admin_get_primary_contact.json
326
- - test/fixtures/admin_set_primary_contact.json
327
- - test/fixtures/administrators.json
328
- - test/fixtures/billingdetails.json
329
- - test/fixtures/bounced_subscribers.json
330
- - test/fixtures/campaign_bounces.json
331
- - test/fixtures/campaign_clicks.json
332
- - test/fixtures/campaign_listsandsegments.json
333
- - test/fixtures/campaign_opens.json
334
- - test/fixtures/campaign_recipients.json
335
- - test/fixtures/campaign_spam.json
336
- - test/fixtures/campaign_summary.json
337
- - test/fixtures/campaign_unsubscribes.json
338
- - test/fixtures/campaigns.json
339
- - test/fixtures/client_details.json
340
- - test/fixtures/client_get_primary_contact.json
341
- - test/fixtures/client_set_primary_contact.json
342
- - test/fixtures/clients.json
343
- - test/fixtures/countries.json
344
- - test/fixtures/create_campaign.json
345
- - test/fixtures/create_client.json
346
- - test/fixtures/create_custom_field.json
347
- - test/fixtures/create_list.json
348
- - test/fixtures/create_list_webhook.json
349
- - test/fixtures/create_segment.json
350
- - test/fixtures/create_template.json
351
- - test/fixtures/custom_api_error.json
352
- - test/fixtures/custom_fields.json
353
- - test/fixtures/deleted_subscribers.json
354
- - test/fixtures/drafts.json
355
- - test/fixtures/email_client_usage.json
356
- - test/fixtures/expired_oauth_token_api_error.json
357
- - test/fixtures/external_session.json
358
- - test/fixtures/import_subscribers.json
359
- - test/fixtures/import_subscribers_partial_success.json
360
- - test/fixtures/invalid_oauth_token_api_error.json
361
- - test/fixtures/journey_bounces.json
362
- - test/fixtures/journey_clicks.json
363
- - test/fixtures/journey_opens.json
364
- - test/fixtures/journey_recipients.json
365
- - test/fixtures/journey_summary.json
366
- - test/fixtures/journey_unsubscribes.json
367
- - test/fixtures/journeys.json
368
- - test/fixtures/list_details.json
369
- - test/fixtures/list_stats.json
370
- - test/fixtures/list_webhooks.json
371
- - test/fixtures/lists.json
372
- - test/fixtures/listsforemail.json
373
- - test/fixtures/oauth_exchange_token.json
374
- - test/fixtures/oauth_exchange_token_error.json
375
- - test/fixtures/oauth_refresh_token_error.json
376
- - test/fixtures/people.json
377
- - test/fixtures/person_details.json
378
- - test/fixtures/refresh_oauth_token.json
379
- - test/fixtures/revoked_oauth_token_api_error.json
380
- - test/fixtures/scheduled_campaigns.json
381
- - test/fixtures/segment_details.json
382
- - test/fixtures/segment_subscribers.json
383
- - test/fixtures/segments.json
384
- - test/fixtures/subscriber_details.json
385
- - test/fixtures/subscriber_details_with_track_pref.json
386
- - test/fixtures/subscriber_history.json
387
- - test/fixtures/suppressionlist.json
388
- - test/fixtures/systemdate.json
389
- - test/fixtures/template_details.json
390
- - test/fixtures/templates.json
391
- - test/fixtures/timezones.json
392
- - test/fixtures/transfer_credits.json
393
- - test/fixtures/tx_classicemail_groups.json
394
- - test/fixtures/tx_message_details.json
395
- - test/fixtures/tx_message_details_with_statistics.json
396
- - test/fixtures/tx_messages.json
397
- - test/fixtures/tx_messages_classic.json
398
- - test/fixtures/tx_messages_smart.json
399
- - test/fixtures/tx_resend_message.json
400
- - test/fixtures/tx_send_multiple.json
401
- - test/fixtures/tx_send_single.json
402
- - test/fixtures/tx_smartemail_details.json
403
- - test/fixtures/tx_smartemails.json
404
- - test/fixtures/tx_statistics_classic.json
405
- - test/fixtures/tx_statistics_smart.json
406
- - test/fixtures/unconfirmed_subscribers.json
407
- - test/fixtures/unsubscribed_subscribers.json
408
- - test/fixtures/update_custom_field.json
409
- - test/helper.rb
410
- - test/journey_test.rb
411
- - test/list_test.rb
412
- - test/person_test.rb
413
- - test/segment_test.rb
414
- - test/subscriber_test.rb
415
- - test/template_test.rb
416
- - test/transactional_classic_email_test.rb
417
- - test/transactional_smart_email_test.rb
418
- - test/transactional_timeline_test.rb
321
+ test_files: []