createsend-sendowlfork 6.1.0.pre.hashie5

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.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +9 -0
  4. data/.travis.yml +7 -0
  5. data/CONTRIBUTING.md +8 -0
  6. data/Gemfile +3 -0
  7. data/HISTORY.md +299 -0
  8. data/LICENSE +19 -0
  9. data/README.md +220 -0
  10. data/RELEASE.md +53 -0
  11. data/Rakefile +24 -0
  12. data/createsend.gemspec +31 -0
  13. data/lib/createsend/administrator.rb +49 -0
  14. data/lib/createsend/cacert.pem +3849 -0
  15. data/lib/createsend/campaign.rb +202 -0
  16. data/lib/createsend/client.rb +224 -0
  17. data/lib/createsend/createsend.rb +291 -0
  18. data/lib/createsend/journey.rb +58 -0
  19. data/lib/createsend/list.rb +258 -0
  20. data/lib/createsend/person.rb +59 -0
  21. data/lib/createsend/segment.rb +81 -0
  22. data/lib/createsend/subscriber.rb +113 -0
  23. data/lib/createsend/template.rb +42 -0
  24. data/lib/createsend/transactional_classic_email.rb +32 -0
  25. data/lib/createsend/transactional_smart_email.rb +31 -0
  26. data/lib/createsend/transactional_timeline.rb +45 -0
  27. data/lib/createsend/version.rb +3 -0
  28. data/lib/createsend.rb +17 -0
  29. data/samples/authentication_sample.rb +64 -0
  30. data/samples/clients_sample.rb +79 -0
  31. data/samples/journey_sample.rb +87 -0
  32. data/samples/lists_sample.rb +51 -0
  33. data/samples/segments_sample.rb +21 -0
  34. data/samples/subscribers_sample.rb +51 -0
  35. data/test/administrator_test.rb +37 -0
  36. data/test/campaign_test.rb +296 -0
  37. data/test/client_test.rb +253 -0
  38. data/test/createsend_test.rb +321 -0
  39. data/test/fixtures/active_subscribers.json +87 -0
  40. data/test/fixtures/add_admin.json +3 -0
  41. data/test/fixtures/add_person.json +3 -0
  42. data/test/fixtures/add_subscriber.json +1 -0
  43. data/test/fixtures/admin_details.json +5 -0
  44. data/test/fixtures/admin_get_primary_contact.json +3 -0
  45. data/test/fixtures/admin_set_primary_contact.json +3 -0
  46. data/test/fixtures/administrators.json +12 -0
  47. data/test/fixtures/billingdetails.json +3 -0
  48. data/test/fixtures/bounced_subscribers.json +20 -0
  49. data/test/fixtures/campaign_bounces.json +25 -0
  50. data/test/fixtures/campaign_clicks.json +50 -0
  51. data/test/fixtures/campaign_listsandsegments.json +15 -0
  52. data/test/fixtures/campaign_opens.json +71 -0
  53. data/test/fixtures/campaign_recipients.json +91 -0
  54. data/test/fixtures/campaign_spam.json +16 -0
  55. data/test/fixtures/campaign_summary.json +16 -0
  56. data/test/fixtures/campaign_unsubscribes.json +17 -0
  57. data/test/fixtures/campaigns.json +37 -0
  58. data/test/fixtures/client_details.json +28 -0
  59. data/test/fixtures/client_get_primary_contact.json +3 -0
  60. data/test/fixtures/client_set_primary_contact.json +3 -0
  61. data/test/fixtures/clients.json +10 -0
  62. data/test/fixtures/countries.json +247 -0
  63. data/test/fixtures/create_campaign.json +1 -0
  64. data/test/fixtures/create_client.json +1 -0
  65. data/test/fixtures/create_custom_field.json +1 -0
  66. data/test/fixtures/create_list.json +1 -0
  67. data/test/fixtures/create_list_webhook.json +1 -0
  68. data/test/fixtures/create_segment.json +1 -0
  69. data/test/fixtures/create_template.json +1 -0
  70. data/test/fixtures/custom_api_error.json +4 -0
  71. data/test/fixtures/custom_fields.json +23 -0
  72. data/test/fixtures/deleted_subscribers.json +61 -0
  73. data/test/fixtures/drafts.json +26 -0
  74. data/test/fixtures/email_client_usage.json +38 -0
  75. data/test/fixtures/expired_oauth_token_api_error.json +4 -0
  76. data/test/fixtures/external_session.json +3 -0
  77. data/test/fixtures/import_subscribers.json +7 -0
  78. data/test/fixtures/import_subscribers_partial_success.json +17 -0
  79. data/test/fixtures/invalid_oauth_token_api_error.json +4 -0
  80. data/test/fixtures/journey_bounces.json +35 -0
  81. data/test/fixtures/journey_clicks.json +35 -0
  82. data/test/fixtures/journey_opens.json +55 -0
  83. data/test/fixtures/journey_recipients.json +27 -0
  84. data/test/fixtures/journey_summary.json +18 -0
  85. data/test/fixtures/journey_unsubscribes.json +26 -0
  86. data/test/fixtures/journeys.json +20 -0
  87. data/test/fixtures/list_details.json +8 -0
  88. data/test/fixtures/list_stats.json +26 -0
  89. data/test/fixtures/list_webhooks.json +18 -0
  90. data/test/fixtures/lists.json +10 -0
  91. data/test/fixtures/listsforemail.json +14 -0
  92. data/test/fixtures/oauth_exchange_token.json +5 -0
  93. data/test/fixtures/oauth_exchange_token_error.json +4 -0
  94. data/test/fixtures/oauth_refresh_token_error.json +4 -0
  95. data/test/fixtures/people.json +14 -0
  96. data/test/fixtures/person_details.json +6 -0
  97. data/test/fixtures/refresh_oauth_token.json +5 -0
  98. data/test/fixtures/revoked_oauth_token_api_error.json +4 -0
  99. data/test/fixtures/scheduled_campaigns.json +30 -0
  100. data/test/fixtures/segment_details.json +24 -0
  101. data/test/fixtures/segment_subscribers.json +27 -0
  102. data/test/fixtures/segments.json +12 -0
  103. data/test/fixtures/subscriber_details.json +23 -0
  104. data/test/fixtures/subscriber_details_with_track_and_sms_pref.json +25 -0
  105. data/test/fixtures/subscriber_history.json +45 -0
  106. data/test/fixtures/suppressionlist.json +41 -0
  107. data/test/fixtures/systemdate.json +3 -0
  108. data/test/fixtures/tags.json +10 -0
  109. data/test/fixtures/template_details.json +6 -0
  110. data/test/fixtures/templates.json +14 -0
  111. data/test/fixtures/timezones.json +99 -0
  112. data/test/fixtures/transfer_credits.json +4 -0
  113. data/test/fixtures/tx_classicemail_groups.json +14 -0
  114. data/test/fixtures/tx_message_details.json +36 -0
  115. data/test/fixtures/tx_message_details_with_statistics.json +72 -0
  116. data/test/fixtures/tx_messages.json +38 -0
  117. data/test/fixtures/tx_messages_classic.json +15 -0
  118. data/test/fixtures/tx_messages_smart.json +15 -0
  119. data/test/fixtures/tx_resend_message.json +6 -0
  120. data/test/fixtures/tx_send_multiple.json +12 -0
  121. data/test/fixtures/tx_send_single.json +7 -0
  122. data/test/fixtures/tx_smartemail_details.json +23 -0
  123. data/test/fixtures/tx_smartemails.json +15 -0
  124. data/test/fixtures/tx_statistics_classic.json +14 -0
  125. data/test/fixtures/tx_statistics_smart.json +14 -0
  126. data/test/fixtures/unconfirmed_subscribers.json +43 -0
  127. data/test/fixtures/unsubscribed_subscribers.json +61 -0
  128. data/test/fixtures/update_custom_field.json +1 -0
  129. data/test/helper.rb +79 -0
  130. data/test/journey_test.rb +156 -0
  131. data/test/list_test.rb +288 -0
  132. data/test/person_test.rb +39 -0
  133. data/test/segment_test.rb +74 -0
  134. data/test/subscriber_test.rb +177 -0
  135. data/test/template_test.rb +36 -0
  136. data/test/transactional_classic_email_test.rb +60 -0
  137. data/test/transactional_smart_email_test.rb +83 -0
  138. data/test/transactional_timeline_test.rb +110 -0
  139. metadata +431 -0
@@ -0,0 +1,99 @@
1
+ [
2
+ "(GMT) Casablanca",
3
+ "(GMT) Coordinated Universal Time",
4
+ "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London",
5
+ "(GMT) Monrovia, Reykjavik",
6
+ "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",
7
+ "(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",
8
+ "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris",
9
+ "(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb",
10
+ "(GMT+01:00) West Central Africa",
11
+ "(GMT+02:00) Amman",
12
+ "(GMT+02:00) Athens, Bucharest, Istanbul",
13
+ "(GMT+02:00) Beirut",
14
+ "(GMT+02:00) Cairo",
15
+ "(GMT+02:00) Damascus",
16
+ "(GMT+02:00) Harare, Pretoria",
17
+ "(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",
18
+ "(GMT+02:00) Jerusalem",
19
+ "(GMT+02:00) Minsk",
20
+ "(GMT+02:00) Windhoek",
21
+ "(GMT+03:00) Baghdad",
22
+ "(GMT+03:00) Kuwait, Riyadh",
23
+ "(GMT+03:00) Moscow, St. Petersburg, Volgograd",
24
+ "(GMT+03:00) Nairobi",
25
+ "(GMT+03:30) Tehran",
26
+ "(GMT+04:00) Abu Dhabi, Muscat",
27
+ "(GMT+04:00) Baku",
28
+ "(GMT+04:00) Port Louis",
29
+ "(GMT+04:00) Tbilisi",
30
+ "(GMT+04:00) Yerevan",
31
+ "(GMT+04:30) Kabul",
32
+ "(GMT+05:00) Ekaterinburg",
33
+ "(GMT+05:00) Islamabad, Karachi",
34
+ "(GMT+05:00) Tashkent",
35
+ "(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi",
36
+ "(GMT+05:30) Sri Jayawardenepura",
37
+ "(GMT+05:45) Kathmandu",
38
+ "(GMT+06:00) Astana",
39
+ "(GMT+06:00) Dhaka",
40
+ "(GMT+06:00) Novosibirsk",
41
+ "(GMT+06:30) Yangon (Rangoon)",
42
+ "(GMT+07:00) Bangkok, Hanoi, Jakarta",
43
+ "(GMT+07:00) Krasnoyarsk",
44
+ "(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi",
45
+ "(GMT+08:00) Irkutsk",
46
+ "(GMT+08:00) Kuala Lumpur, Singapore",
47
+ "(GMT+08:00) Perth",
48
+ "(GMT+08:00) Taipei",
49
+ "(GMT+08:00) Ulaanbaatar",
50
+ "(GMT+09:00) Osaka, Sapporo, Tokyo",
51
+ "(GMT+09:00) Seoul",
52
+ "(GMT+09:00) Yakutsk",
53
+ "(GMT+09:30) Adelaide",
54
+ "(GMT+09:30) Darwin",
55
+ "(GMT+10:00) Brisbane",
56
+ "(GMT+10:00) Canberra, Melbourne, Sydney",
57
+ "(GMT+10:00) Guam, Port Moresby",
58
+ "(GMT+10:00) Hobart",
59
+ "(GMT+10:00) Vladivostok",
60
+ "(GMT+11:00) Magadan, Solomon Is., New Caledonia",
61
+ "(GMT+12:00) Auckland, Wellington",
62
+ "(GMT+12:00) Coordinated Universal Time+12",
63
+ "(GMT+12:00) Fiji",
64
+ "(GMT+12:00) Petropavlovsk-Kamchatsky - Old",
65
+ "(GMT+13:00) Nuku'alofa",
66
+ "(GMT-01:00) Azores",
67
+ "(GMT-01:00) Cape Verde Is.",
68
+ "(GMT-02:00) Coordinated Universal Time-02",
69
+ "(GMT-02:00) Mid-Atlantic",
70
+ "(GMT-03:00) Brasilia",
71
+ "(GMT-03:00) Buenos Aires",
72
+ "(GMT-03:00) Cayenne, Fortaleza",
73
+ "(GMT-03:00) Greenland",
74
+ "(GMT-03:00) Montevideo",
75
+ "(GMT-03:30) Newfoundland",
76
+ "(GMT-04:00) Asuncion",
77
+ "(GMT-04:00) Atlantic Time (Canada)",
78
+ "(GMT-04:00) Cuiaba",
79
+ "(GMT-04:00) Georgetown, La Paz, Manaus, San Juan",
80
+ "(GMT-04:00) Santiago",
81
+ "(GMT-04:30) Caracas",
82
+ "(GMT-05:00) Bogota, Lima, Quito",
83
+ "(GMT-05:00) Eastern Time (US & Canada)",
84
+ "(GMT-05:00) Indiana (East)",
85
+ "(GMT-06:00) Central America",
86
+ "(GMT-06:00) Central Time (US & Canada)",
87
+ "(GMT-06:00) Guadalajara, Mexico City, Monterrey",
88
+ "(GMT-06:00) Saskatchewan",
89
+ "(GMT-07:00) Arizona",
90
+ "(GMT-07:00) Chihuahua, La Paz, Mazatlan",
91
+ "(GMT-07:00) Mountain Time (US & Canada)",
92
+ "(GMT-08:00) Baja California",
93
+ "(GMT-08:00) Pacific Time (US & Canada)",
94
+ "(GMT-09:00) Alaska",
95
+ "(GMT-10:00) Hawaii",
96
+ "(GMT-11:00) Coordinated Universal Time-11",
97
+ "(GMT-11:00) Samoa",
98
+ "(GMT-12:00) International Date Line West"
99
+ ]
@@ -0,0 +1,4 @@
1
+ {
2
+ "AccountCredits": 800,
3
+ "ClientCredits": 200
4
+ }
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "Group": "Password Reset",
4
+ "CreatedAt": "2015-03-28T09:41:36+11:00"
5
+ },
6
+ {
7
+ "Group": "Credit card expired",
8
+ "CreatedAt": "2015-05-04T22:24:12+10:00"
9
+ },
10
+ {
11
+ "Group": "Order shipped",
12
+ "CreatedAt": "2015-03-29T11:11:52+11:00"
13
+ }
14
+ ]
@@ -0,0 +1,36 @@
1
+ {
2
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
3
+ "Status": "Delivered",
4
+ "SentAt": "2014-01-15T16:09:19-05:00",
5
+ "SmartEmailID": "c0da9c4c-e7e4-11e4-a74d-6c4008bc7468",
6
+ "CanBeResent": true,
7
+ "Recipient": "Joe Smith <joesmith@example.com>",
8
+ "Message": {
9
+ "From": "Team Webapp <team@webapp123.com",
10
+ "Subject": "Thanks for signing up to web app 123",
11
+ "To": [
12
+ "Joe Smith <joesmith@example.com>",
13
+ "jamesmith@example.com"
14
+ ],
15
+ "CC": [
16
+ "Joe Smith <joesmith@example.com>"
17
+ ],
18
+ "BCC": "joesmith@example.com",
19
+ "Attachments": [
20
+ {
21
+ "Name": "Invoice.pdf",
22
+ "Type": "application/pdf"
23
+ }
24
+ ],
25
+ "Body": {
26
+ "Html": "...",
27
+ "Text": "..."
28
+ },
29
+ "Data": {
30
+ "new_password_url": "https://www.mywebapp.com/newpassword?uid=jguf45hf74hbf74gf"
31
+ }
32
+ },
33
+ "TotalOpens": 1,
34
+ "TotalClicks": 1
35
+ }
36
+
@@ -0,0 +1,72 @@
1
+ {
2
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
3
+ "Status": "Delivered",
4
+ "SentAt": "2014-01-15T16:09:19-05:00",
5
+ "SmartEmailID": "c0da9c4c-e7e4-11e4-a74d-6c4008bc7468",
6
+ "CanBeResent": true,
7
+ "Recipient": "Joe Smith <joesmith@example.com>",
8
+ "Message": {
9
+ "From": "Team Webapp <team@webapp123.com",
10
+ "Subject": "Thanks for signing up to web app 123",
11
+ "To": [
12
+ "Joe Smith <joesmith@example.com>",
13
+ "jamesmith@example.com"
14
+ ],
15
+ "CC": [
16
+ "Joe Smith <joesmith@example.com>"
17
+ ],
18
+ "BCC": "joesmith@example.com",
19
+ "Attachments": [
20
+ {
21
+ "Name": "Invoice.pdf",
22
+ "Type": "application/pdf"
23
+ }
24
+ ],
25
+ "Body": {
26
+ "Html": "...",
27
+ "Text": "..."
28
+ },
29
+ "Data": {
30
+ "new_password_url": "https://www.mywebapp.com/newpassword?uid=jguf45hf74hbf74gf"
31
+ }
32
+ },
33
+ "TotalOpens": 1,
34
+ "TotalClicks": 1,
35
+ "Opens": [
36
+ {
37
+ "EmailAddress": "jamesmith@example.com",
38
+ "Date": "2009-05-18 16:45:00",
39
+ "IPAddress": "192.168.0.1",
40
+ "Geolocation": {
41
+ "Latitude": -33.8683,
42
+ "Longitude": 151.2086,
43
+ "City": "Sydney",
44
+ "Region": "New South Wales",
45
+ "CountryCode": "AU",
46
+ "CountryName": "Australia"
47
+ },
48
+ "MailClient": {
49
+ "Name": "Apple Mail",
50
+ "OS": "OS X",
51
+ "Device": "Desktop"
52
+ }
53
+ }
54
+ ],
55
+ "Clicks": [
56
+ {
57
+ "EmailAddress": "jamesmith@example.com",
58
+ "Date": "2009-05-18 16:45:00",
59
+ "IPAddress": "192.168.0.1",
60
+ "URL": "http://www.myexammple.com/index.html",
61
+ "Geolocation": {
62
+ "Latitude": -33.8683,
63
+ "Longitude": 151.2086,
64
+ "City": "Sydney",
65
+ "Region": "New South Wales",
66
+ "CountryCode": "AU",
67
+ "CountryName": "Australia"
68
+ }
69
+ }
70
+ ]
71
+ }
72
+
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
4
+ "Status": "Delivered",
5
+ "SentAt": "2014-01-15T16:09:19-05:00",
6
+ "Recipient": "Joe Smith <joesmith@example.com>",
7
+ "From": "Team <team@company.com>",
8
+ "Subject": "Ungrouped message",
9
+ "TotalOpens": 2,
10
+ "TotalClicks": 4,
11
+ "CanBeResent": true
12
+ },
13
+ {
14
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
15
+ "Status": "Delivered",
16
+ "SentAt": "2014-01-15T16:09:19-05:00",
17
+ "Recipient": "Joe Smith <joesmith@example.com>",
18
+ "From": "Team <team@company.com>",
19
+ "Subject": "Your password has been reset",
20
+ "TotalOpens": 2,
21
+ "TotalClicks": 4,
22
+ "CanBeResent": true,
23
+ "Group": "Password Reset"
24
+ },
25
+ {
26
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
27
+ "Status": "Delivered",
28
+ "SentAt": "2014-01-15T16:09:19-05:00",
29
+ "Recipient": "Joe Smith <joesmith@example.com>",
30
+ "From": "Team <team@company.com>",
31
+ "Subject": "Your credit card has expired",
32
+ "TotalOpens": 2,
33
+ "TotalClicks": 4,
34
+ "CanBeResent": true,
35
+ "SmartEmailID": "21dab350-f484-11e4-ad38-6c4008bc7468"
36
+ }
37
+ ]
38
+
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
4
+ "Status": "Delivered",
5
+ "SentAt": "2014-01-15T16:09:19-05:00",
6
+ "Recipient": "Joe Smith <joesmith@example.com>",
7
+ "From": "Team <team@company.com>",
8
+ "Subject": "Your password has been reset",
9
+ "TotalOpens": 2,
10
+ "TotalClicks": 4,
11
+ "CanBeResent": true,
12
+ "Group": "Password Reset"
13
+ }
14
+ ]
15
+
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd",
4
+ "Status": "Delivered",
5
+ "SentAt": "2014-01-15T16:09:19-05:00",
6
+ "Recipient": "Joe Smith <joesmith@example.com>",
7
+ "From": "Team <team@company.com>",
8
+ "Subject": "Your credit card has expired",
9
+ "TotalOpens": 2,
10
+ "TotalClicks": 4,
11
+ "CanBeResent": true,
12
+ "SmartEmailID": "21dab350-f484-11e4-ad38-6c4008bc7468"
13
+ }
14
+ ]
15
+
@@ -0,0 +1,6 @@
1
+ {
2
+ "Status": "Accepted",
3
+ "Recipient": "Joe Smith <joesmith@example.com>",
4
+ "MessageID": "cfb5e081-ef66-4bc4-a1c0-48493b34e694"
5
+ }
6
+
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "MessageID": "0cfe150d-d507-11e4-84a7-c31e5b59881d",
4
+ "Recipient": "\"Bob Sacamano\" <bob@example.com>",
5
+ "Status": "Received"
6
+ },
7
+ {
8
+ "MessageID": "0cfe150d-d507-11e4-b579-a64eb0d9c74d",
9
+ "Recipient": "\"Newman\" <newman@example.com>",
10
+ "Status": "Received"
11
+ }
12
+ ]
@@ -0,0 +1,7 @@
1
+ [
2
+ {
3
+ "MessageID": "0cfe150d-d507-11e4-84a7-c31e5b59881d",
4
+ "Recipient": "\"Bob Sacamano\" <bob@example.com>",
5
+ "Status": "Received"
6
+ }
7
+ ]
@@ -0,0 +1,23 @@
1
+ {
2
+ "SmartEmailID": "bb4a6ebb-663d-42a0-bdbe-60512cf30a01",
3
+ "Name": "Reset Password",
4
+ "CreatedAt": "2015-03-31T16:06:35+11:00",
5
+ "Status": "active",
6
+ "Properties": {
7
+ "From": "\"Team\" <team@example.com>",
8
+ "ReplyTo": "joe@example.com",
9
+ "Subject": "[username], your password has been reset!",
10
+ "Content": {
11
+ "HTML": "Content managed in Email Builder",
12
+ "Text": "Content managed in Email Builder",
13
+ "EmailVariables": [
14
+ "username",
15
+ "reset_token"
16
+ ],
17
+ "InlineCss": true
18
+ },
19
+ "TextPreviewUrl": "https://philoye.devcreatesend.com/t/r-9A7A28EE76054977/T",
20
+ "HtmlPreviewUrl": "https://philoye.devcreatesend.com/t/r-9A7A28EE76054977/"
21
+ },
22
+ "AddRecipientsToList": true
23
+ }
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "ID": "1e654df2-f484-11e4-970c-6c4008bc7468",
4
+ "Name": "Welcome email",
5
+ "CreatedAt": "2015-05-15T16:09:19-05:00",
6
+ "Status": "Active"
7
+ },
8
+ {
9
+ "ID": "21dab350-f484-11e4-ad38-6c4008bc7468",
10
+ "Name": "Order shipped",
11
+ "CreatedAt": "2015-05-15T13:29:49-05:00",
12
+ "Status": "Active"
13
+ }
14
+ ]
15
+
@@ -0,0 +1,14 @@
1
+ {
2
+ "Query": {
3
+ "Group": "Password Reset",
4
+ "From": "2014-02-03",
5
+ "To": "2015-02-02",
6
+ "TimeZone": "(GMT+10:00) Canberra, Melbourne, Sydney"
7
+ },
8
+ "Sent": 1000,
9
+ "Bounces": 8,
10
+ "Delivered": 992,
11
+ "Opened": 300,
12
+ "Clicked": 50
13
+ }
14
+
@@ -0,0 +1,14 @@
1
+ {
2
+ "Query": {
3
+ "SmartEmailID": "bb4a6ebb-663d-42a0-bdbe-60512cf30a01",
4
+ "From": "2014-02-03",
5
+ "To": "2015-02-02",
6
+ "TimeZone": "UTC"
7
+ },
8
+ "Sent": 1000,
9
+ "Bounces": 8,
10
+ "Delivered": 992,
11
+ "Opened": 300,
12
+ "Clicked": 50
13
+ }
14
+
@@ -0,0 +1,43 @@
1
+ {
2
+ "Results": [
3
+ {
4
+ "EmailAddress": "subs+7t8787Y@example.com",
5
+ "Name": "Unconfirmed One",
6
+ "Date": "2010-10-25 10:28:00",
7
+ "ListJoinedDate": "2010-10-25 10:28:00",
8
+ "State": "Unconfirmed",
9
+ "CustomFields": [
10
+ {
11
+ "Key": "website",
12
+ "Value": "http://example.com"
13
+ }
14
+ ],
15
+ "ReadsEmailWith": "",
16
+ "ConsentToTrack": "Yes",
17
+ "ConsentToSendSms": "No"
18
+ },
19
+ {
20
+ "EmailAddress": "subs+7878787y8ggg@example.com",
21
+ "Name": "Unconfirmed Two",
22
+ "Date": "2010-10-25 12:17:00",
23
+ "ListJoinedDate": "2010-10-25 12:17:00",
24
+ "State": "Unconfirmed",
25
+ "CustomFields": [
26
+ {
27
+ "Key": "website",
28
+ "Value": "http://subdomain.example.com"
29
+ }
30
+ ],
31
+ "ReadsEmailWith": "",
32
+ "ConsentToTrack": "No",
33
+ "ConsentToSendSms": "No"
34
+ }
35
+ ],
36
+ "ResultsOrderedBy": "email",
37
+ "OrderDirection": "asc",
38
+ "PageNumber": 1,
39
+ "PageSize": 1000,
40
+ "RecordsOnThisPage": 2,
41
+ "TotalNumberOfRecords": 2,
42
+ "NumberOfPages": 1
43
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "Results": [
3
+ {
4
+ "EmailAddress": "subscriber@example.com",
5
+ "Name": "Unsub One",
6
+ "Date": "2010-10-25 13:11:00",
7
+ "ListJoinedDate": "2010-10-25 13:11:00",
8
+ "State": "Unsubscribed",
9
+ "CustomFields": [],
10
+ "ReadsEmailWith": "Gmail"
11
+ },
12
+ {
13
+ "EmailAddress": "subscriberone@example.com",
14
+ "Name": "Subscriber",
15
+ "Date": "2010-10-25 13:04:00",
16
+ "ListJoinedDate": "2010-10-25 13:04:00",
17
+ "State": "Unsubscribed",
18
+ "CustomFields": [
19
+ {
20
+ "Key": "website",
21
+ "Value": "http://google.com"
22
+ }
23
+ ],
24
+ "ReadsEmailWith": "Gmail"
25
+ },
26
+ {
27
+ "EmailAddress": "example+1@example.com",
28
+ "Name": "Example One",
29
+ "Date": "2010-10-26 10:56:00",
30
+ "ListJoinedDate": "2010-10-26 10:56:00",
31
+ "State": "Unsubscribed",
32
+ "CustomFields": [],
33
+ "ReadsEmailWith": ""
34
+ },
35
+ {
36
+ "EmailAddress": "example+2@example.com",
37
+ "Name": "Example Two",
38
+ "Date": "2010-10-26 10:56:00",
39
+ "ListJoinedDate": "2010-10-26 10:56:00",
40
+ "State": "Unsubscribed",
41
+ "CustomFields": [],
42
+ "ReadsEmailWith": ""
43
+ },
44
+ {
45
+ "EmailAddress": "example+3@example.com",
46
+ "Name": "Example Three",
47
+ "Date": "2010-10-26 10:56:00",
48
+ "ListJoinedDate": "2010-10-26 10:56:00",
49
+ "State": "Unsubscribed",
50
+ "CustomFields": [],
51
+ "ReadsEmailWith": "Gmail"
52
+ }
53
+ ],
54
+ "ResultsOrderedBy": "email",
55
+ "OrderDirection": "asc",
56
+ "PageNumber": 1,
57
+ "PageSize": 1000,
58
+ "RecordsOnThisPage": 5,
59
+ "TotalNumberOfRecords": 5,
60
+ "NumberOfPages": 1
61
+ }
@@ -0,0 +1 @@
1
+ "[myrenamedcustomfield]"
data/test/helper.rb ADDED
@@ -0,0 +1,79 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ])
8
+ SimpleCov.start
9
+
10
+ require 'test/unit'
11
+ require 'pathname'
12
+
13
+ require 'shoulda/context'
14
+ require 'matchy'
15
+ require 'fakeweb'
16
+
17
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
18
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
19
+ require 'createsend'
20
+
21
+ FakeWeb.allow_net_connect = %r[^https?://coveralls.io]
22
+
23
+ def fixture_file(filename)
24
+ return '' if filename == ''
25
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
26
+ File.read(file_path)
27
+ end
28
+
29
+ def createsend_url(auth, url)
30
+ if not url =~ /^http/
31
+ auth_section = ''
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.3/#{url}"
34
+ else
35
+ result = url
36
+ end
37
+ result
38
+ end
39
+
40
+ def stub_request(method, auth, url, filename, status=nil)
41
+ options = {:body => ""}
42
+ options.merge!({:body => fixture_file(filename)}) if filename
43
+ options.merge!({:status => status}) if status
44
+ options.merge!(:content_type => "application/json; charset=utf-8")
45
+ createsend_url = createsend_url(auth, url)
46
+ FakeWeb.register_uri(method, createsend_url, options)
47
+ end
48
+
49
+ def stub_get(*args); stub_request(:get, *args) end
50
+ def stub_post(*args); stub_request(:post, *args) end
51
+ def stub_put(*args); stub_request(:put, *args) end
52
+ def stub_delete(*args); stub_request(:delete, *args) end
53
+
54
+ def multiple_contexts(*contexts, &blk)
55
+ contexts.each do |context|
56
+ send(context, &blk)
57
+ end
58
+ end
59
+
60
+ def authenticated_using_oauth_context(&blk)
61
+ context "when an api caller is authenticated using oauth" do
62
+ setup do
63
+ @access_token = 'joidjo2i3joi3je'
64
+ @refresh_token = 'j89u98eu9e8ufe'
65
+ @auth = {:access_token => @access_token, :refresh_token => @refresh_token}
66
+ end
67
+ merge_block(&blk)
68
+ end
69
+ end
70
+
71
+ def authenticated_using_api_key_context(&blk)
72
+ context "when an api caller is authenticated using an api key" do
73
+ setup do
74
+ @api_key = '123123123123123123123'
75
+ @auth = {:api_key => @api_key}
76
+ end
77
+ merge_block(&blk)
78
+ end
79
+ end