sendgrid-ruby 5.3.0 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +120 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +8 -0
  6. data/.rubocop_todo.yml +127 -0
  7. data/CHANGELOG.md +261 -8
  8. data/CODE_OF_CONDUCT.md +57 -25
  9. data/CONTRIBUTING.md +24 -71
  10. data/Dockerfile +14 -0
  11. data/FIRST_TIMERS.md +53 -0
  12. data/Gemfile +0 -1
  13. data/LICENSE +21 -0
  14. data/Makefile +14 -0
  15. data/PULL_REQUEST_TEMPLATE.md +31 -0
  16. data/README.md +39 -43
  17. data/Rakefile +3 -4
  18. data/TROUBLESHOOTING.md +41 -21
  19. data/UPGRADE.md +5 -0
  20. data/USAGE.md +1231 -1122
  21. data/examples/accesssettings/accesssettings.rb +9 -12
  22. data/examples/alerts/alerts.rb +8 -11
  23. data/examples/apikeys/apikeys.rb +12 -15
  24. data/examples/asm/asm.rb +27 -30
  25. data/examples/browsers/browsers.rb +0 -3
  26. data/examples/campaigns/campaigns.rb +29 -32
  27. data/examples/categories/categories.rb +0 -3
  28. data/examples/clients/clients.rb +1 -4
  29. data/examples/contactdb/contactdb.rb +63 -66
  30. data/examples/dataresidency/setregion.rb +48 -0
  31. data/examples/devices/devices.rb +0 -3
  32. data/examples/emailactivity/emailactivity.rb +52 -0
  33. data/examples/geo/geo.rb +0 -3
  34. data/examples/helpers/eventwebhook/example.rb +16 -0
  35. data/examples/helpers/mail/example.rb +30 -19
  36. data/examples/helpers/settings/example.rb +1 -1
  37. data/examples/helpers/stats/example.rb +4 -4
  38. data/examples/ips/ips.rb +31 -21
  39. data/examples/mail/mail.rb +73 -76
  40. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  41. data/examples/mailsettings/mailsettings.rb +21 -24
  42. data/examples/partnersettings/partnersettings.rb +3 -6
  43. data/examples/scopes/scopes.rb +49 -5
  44. data/examples/{whitelabel/whitelabel.rb → senderauthentication/senderauthentication.rb} +68 -71
  45. data/examples/senders/senders.rb +28 -31
  46. data/examples/stats/stats.rb +0 -3
  47. data/examples/subusers/subusers.rb +17 -20
  48. data/examples/suppression/suppression.rb +23 -26
  49. data/examples/templates/templates.rb +29 -31
  50. data/examples/trackingsettings/trackingsettings.rb +14 -17
  51. data/examples/user/user.rb +41 -44
  52. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  53. data/lib/sendgrid/base_interface.rb +57 -0
  54. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  55. data/lib/sendgrid/helpers/inbound/README.md +26 -9
  56. data/lib/sendgrid/helpers/inbound/app.rb +15 -3
  57. data/lib/sendgrid/helpers/inbound/public/index.html +2 -2
  58. data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +2 -2
  59. data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +2 -2
  60. data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +2 -2
  61. data/lib/sendgrid/helpers/inbound/send.rb +5 -5
  62. data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
  63. data/lib/sendgrid/helpers/mail/README.md +4 -4
  64. data/lib/sendgrid/helpers/mail/asm.rb +4 -18
  65. data/lib/sendgrid/helpers/mail/attachment.rb +30 -38
  66. data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
  67. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
  68. data/lib/sendgrid/helpers/mail/category.rb +2 -12
  69. data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
  70. data/lib/sendgrid/helpers/mail/content.rb +4 -18
  71. data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
  72. data/lib/sendgrid/helpers/mail/email.rb +10 -20
  73. data/lib/sendgrid/helpers/mail/footer.rb +5 -27
  74. data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
  75. data/lib/sendgrid/helpers/mail/header.rb +4 -10
  76. data/lib/sendgrid/helpers/mail/mail.rb +37 -87
  77. data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
  78. data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
  79. data/lib/sendgrid/helpers/mail/personalization.rb +38 -27
  80. data/lib/sendgrid/helpers/mail/section.rb +4 -10
  81. data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
  82. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
  83. data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
  84. data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
  85. data/lib/sendgrid/helpers/permissions/scope.rb +28 -0
  86. data/lib/sendgrid/helpers/permissions/scopes.yml +309 -0
  87. data/lib/sendgrid/helpers/settings/README.md +3 -3
  88. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  89. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  90. data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
  91. data/lib/sendgrid/helpers/stats/stats_response.rb +1 -3
  92. data/lib/sendgrid/sendgrid.rb +21 -0
  93. data/lib/sendgrid/twilio_email.rb +21 -0
  94. data/lib/sendgrid/version.rb +1 -1
  95. data/lib/sendgrid-ruby.rb +7 -1
  96. data/mail_helper_v3.md +21 -21
  97. data/sendgrid-ruby.gemspec +12 -12
  98. data/spec/fixtures/event_webhook.rb +22 -0
  99. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  100. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  101. data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
  102. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +3 -3
  103. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +3 -3
  104. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  105. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +3 -3
  106. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +3 -3
  107. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  108. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  109. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  110. data/spec/sendgrid/sendgrid_spec.rb +11 -0
  111. data/spec/sendgrid/twilio_email_spec.rb +11 -0
  112. data/spec/spec_helper.rb +3 -1
  113. data/static/img/github-fork.png +0 -0
  114. data/static/img/github-sign-up.png +0 -0
  115. data/test/sendgrid/helpers/mail/test_attachment.rb +33 -0
  116. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  117. data/test/sendgrid/helpers/mail/test_data_residency.rb +44 -0
  118. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  119. data/test/sendgrid/helpers/mail/test_mail.rb +126 -119
  120. data/test/sendgrid/helpers/mail/test_personalizations.rb +145 -92
  121. data/test/sendgrid/permissions/test_scopes.rb +36 -0
  122. data/test/sendgrid/test_sendgrid-ruby.rb +1961 -1979
  123. data/twilio_sendgrid_logo.png +0 -0
  124. data/use-cases/README.md +17 -0
  125. data/use-cases/domain-authentication.md +5 -0
  126. data/use-cases/email-statistics.md +52 -0
  127. data/use-cases/legacy-templates.md +98 -0
  128. data/use-cases/personalizations.md +34 -0
  129. data/use-cases/sms.md +39 -0
  130. data/use-cases/transactional-templates.md +111 -0
  131. data/use-cases/twilio-email.md +13 -0
  132. data/use-cases/twilio-setup.md +54 -0
  133. metadata +99 -45
  134. data/.codeclimate.yml +0 -21
  135. data/.github/ISSUE_TEMPLATE +0 -17
  136. data/.github/PULL_REQUEST_TEMPLATE +0 -24
  137. data/.travis.yml +0 -29
  138. data/LICENSE.txt +0 -22
  139. data/USE_CASES.md +0 -147
  140. data/docker/Dockerfile +0 -12
  141. data/docker/README.md +0 -30
  142. data/lib/sendgrid/client.rb +0 -35
  143. data/test/prism.sh +0 -42
@@ -1,1158 +1,1206 @@
1
- require_relative '../../lib/sendgrid-ruby.rb'
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+ require_relative '../../lib/sendgrid-ruby'
2
4
  require 'ruby_http_client'
3
5
  require 'minitest/autorun'
4
6
  require 'minitest/unit'
5
7
 
6
8
  class TestAPI < MiniTest::Test
7
-
8
- unless File.exist?('/usr/local/bin/prism') || File.exist?(File.join(Dir.pwd, 'prism/bin/prism'))
9
- if RUBY_PLATFORM =~ /mswin|mingw/
10
- puts 'Please download the Windows binary (https://github.com/stoplightio/prism/releases) and place it in your /usr/local/bin directory'
11
- else
12
- puts 'Installing Prism'
13
- IO.popen(['curl', '-s', 'https://raw.githubusercontent.com/stoplightio/prism/master/install.sh']) do |io|
14
- out = io.read
15
- unless system(out)
16
- puts "Error downloading the prism binary, you can try downloading directly here (https://github.com/stoplightio/prism/releases) and place in your /usr/local/bin directory, #{out}"
17
- exit
18
- end
19
- end
20
- end
21
- end
22
-
23
- puts 'Activating Prism (~20 seconds)'
24
- @@prism_pid = spawn('prism run --mock --list --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json', [:out, :err] => '/dev/null')
25
- sleep(15)
26
- puts 'Prism started'
27
-
28
- def setup
29
- host = "http://localhost:4010"
30
- @sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY", host: host)
31
- end
32
-
33
- Minitest.after_run do
34
- Process.kill('TERM', @@prism_pid)
35
- puts 'Prism shut down'
36
- end
37
-
38
- def test_init
39
- headers = JSON.parse('
40
- {
41
- "X-Test": "test"
42
- }
43
- ')
44
- sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY", host: "https://api.test.com", request_headers: headers, version: "v3")
45
-
46
- assert_equal("https://api.test.com", sg.host)
47
- user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
48
- test_headers = JSON.parse('
49
- {
50
- "Authorization": "Bearer SENDGRID_API_KEY",
51
- "Accept": "application/json",
52
- "X-Test": "test",
53
- "User-agent": "' + user_agent + '"
54
- }
55
- ')
56
- assert_equal(test_headers, sg.request_headers)
57
- assert_equal("v3", sg.version)
58
- assert_equal("5.3.0", SendGrid::VERSION)
59
- assert_instance_of(SendGrid::Client, sg.client)
60
- end
61
-
62
- def test_access_settings_activity_get
63
- params = JSON.parse('{"limit": 1}')
64
- headers = JSON.parse('{"X-Mock": 200}')
65
-
66
- response = @sg.client.access_settings.activity.get(query_params: params, request_headers: headers)
67
-
68
- self.assert_equal('200', response.status_code)
69
- end
70
-
71
- def test_access_settings_whitelist_post
72
- data = JSON.parse('{
73
- "ips": [
74
- {
75
- "ip": "192.168.1.1"
76
- },
77
- {
78
- "ip": "192.*.*.*"
79
- },
80
- {
81
- "ip": "192.168.1.3/32"
9
+ def setup
10
+ @sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY')
11
+ end
12
+
13
+ def test_init
14
+ headers = JSON.parse('
15
+ {
16
+ "X-Test": "test"
17
+ }
18
+ ')
19
+ subuser = 'test_user'
20
+ sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', host: 'https://api.test.com', request_headers: headers, version: 'v3', impersonate_subuser: subuser)
21
+
22
+ assert_equal('https://api.test.com', sg.host)
23
+ user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
24
+ test_headers = JSON.parse('
25
+ {
26
+ "Authorization": "Bearer SENDGRID_API_KEY",
27
+ "Accept": "application/json",
28
+ "X-Test": "test",
29
+ "User-Agent": "' + user_agent + '",
30
+ "On-Behalf-Of": "' + subuser + '"
31
+ }
32
+ ')
33
+ assert_equal(test_headers, sg.request_headers)
34
+ assert_equal('v3', sg.version)
35
+ assert_equal(subuser, sg.impersonate_subuser)
36
+ assert_equal('6.7.0', SendGrid::VERSION)
37
+ assert_instance_of(SendGrid::Client, sg.client)
38
+ assert_equal({}, sg.http_options)
39
+ end
40
+
41
+ def test_init_when_impersonate_subuser_is_not_given
42
+ sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', host: 'https://api.test.com', version: 'v3')
43
+ refute_includes(sg.request_headers, 'On-Behalf-Of')
44
+ end
45
+
46
+ def test_init_when_http_options_is_given
47
+ params = JSON.parse('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}')
48
+ headers = JSON.parse('{"X-Mock": 200}')
49
+ http_options = {
50
+ open_timeout: 40,
51
+ read_timeout: 40
82
52
  }
83
- ]
53
+
54
+ sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', version: 'v3', http_options: http_options)
55
+ client = sg.client.ips
56
+ response = client.get(query_params: params, request_headers: headers)
57
+
58
+ assert_equal(40, client.http.open_timeout)
59
+ assert_equal(40, client.http.read_timeout)
60
+ assert_equal('200', response.status_code)
61
+ end
62
+
63
+ def test_access_settings_activity_get
64
+ params = JSON.parse('{"limit": 1}')
65
+ headers = JSON.parse('{"X-Mock": 200}')
66
+
67
+ response = @sg.client.access_settings.activity.get(query_params: params, request_headers: headers)
68
+
69
+ assert_equal('200', response.status_code)
70
+ end
71
+
72
+ def test_access_settings_whitelist_post
73
+ data = JSON.parse('{
74
+ "ips": [
75
+ {
76
+ "ip": "192.168.1.1"
77
+ },
78
+ {
79
+ "ip": "192.*.*.*"
80
+ },
81
+ {
82
+ "ip": "192.168.1.3/32"
83
+ }
84
+ ]
84
85
  }')
85
- headers = JSON.parse('{"X-Mock": 201}')
86
+ headers = JSON.parse('{"X-Mock": 201}')
86
87
 
87
- response = @sg.client.access_settings.whitelist.post(request_body: data, request_headers: headers)
88
+ response = @sg.client.access_settings.whitelist.post(request_body: data, request_headers: headers)
88
89
 
89
- self.assert_equal('201', response.status_code)
90
- end
90
+ assert_equal('201', response.status_code)
91
+ end
91
92
 
92
- def test_access_settings_whitelist_get
93
- headers = JSON.parse('{"X-Mock": 200}')
93
+ def test_access_settings_whitelist_get
94
+ headers = JSON.parse('{"X-Mock": 200}')
94
95
 
95
- response = @sg.client.access_settings.whitelist.get(request_headers: headers)
96
+ response = @sg.client.access_settings.whitelist.get(request_headers: headers)
96
97
 
97
- self.assert_equal('200', response.status_code)
98
- end
98
+ assert_equal('200', response.status_code)
99
+ end
99
100
 
100
- def test_access_settings_whitelist_delete
101
- data = JSON.parse('{
102
- "ids": [
103
- 1,
104
- 2,
105
- 3
106
- ]
101
+ def test_access_settings_whitelist_delete
102
+ data = JSON.parse('{
103
+ "ids": [
104
+ 1,
105
+ 2,
106
+ 3
107
+ ]
107
108
  }')
108
- headers = JSON.parse('{"X-Mock": 204}')
109
+ headers = JSON.parse('{"X-Mock": 204}')
109
110
 
110
- response = @sg.client.access_settings.whitelist.delete(request_body: data, request_headers: headers)
111
+ response = @sg.client.access_settings.whitelist.delete(request_body: data, request_headers: headers)
111
112
 
112
- self.assert_equal('204', response.status_code)
113
- end
113
+ assert_equal('204', response.status_code)
114
+ end
114
115
 
115
- def test_access_settings_whitelist__rule_id__get
116
- rule_id = "test_url_param"
117
- headers = JSON.parse('{"X-Mock": 200}')
116
+ def test_access_settings_whitelist__rule_id__get
117
+ rule_id = 'test_url_param'
118
+ headers = JSON.parse('{"X-Mock": 200}')
118
119
 
119
- response = @sg.client.access_settings.whitelist._(rule_id).get(request_headers: headers)
120
+ response = @sg.client.access_settings.whitelist._(rule_id).get(request_headers: headers)
120
121
 
121
- self.assert_equal('200', response.status_code)
122
- end
122
+ assert_equal('200', response.status_code)
123
+ end
123
124
 
124
- def test_access_settings_whitelist__rule_id__delete
125
- rule_id = "test_url_param"
126
- headers = JSON.parse('{"X-Mock": 204}')
125
+ def test_access_settings_whitelist__rule_id__delete
126
+ rule_id = 'test_url_param'
127
+ headers = JSON.parse('{"X-Mock": 204}')
127
128
 
128
- response = @sg.client.access_settings.whitelist._(rule_id).delete(request_headers: headers)
129
+ response = @sg.client.access_settings.whitelist._(rule_id).delete(request_headers: headers)
129
130
 
130
- self.assert_equal('204', response.status_code)
131
- end
131
+ assert_equal('204', response.status_code)
132
+ end
132
133
 
133
- def test_alerts_post
134
- data = JSON.parse('{
135
- "email_to": "example@example.com",
136
- "frequency": "daily",
137
- "type": "stats_notification"
134
+ def test_alerts_post
135
+ data = JSON.parse('{
136
+ "email_to": "example@example.com",
137
+ "frequency": "daily",
138
+ "type": "stats_notification"
138
139
  }')
139
- headers = JSON.parse('{"X-Mock": 201}')
140
+ headers = JSON.parse('{"X-Mock": 201}')
140
141
 
141
- response = @sg.client.alerts.post(request_body: data, request_headers: headers)
142
+ response = @sg.client.alerts.post(request_body: data, request_headers: headers)
142
143
 
143
- self.assert_equal('201', response.status_code)
144
- end
144
+ assert_equal('201', response.status_code)
145
+ end
145
146
 
146
- def test_alerts_get
147
- headers = JSON.parse('{"X-Mock": 200}')
147
+ def test_alerts_get
148
+ headers = JSON.parse('{"X-Mock": 200}')
148
149
 
149
- response = @sg.client.alerts.get(request_headers: headers)
150
+ response = @sg.client.alerts.get(request_headers: headers)
150
151
 
151
- self.assert_equal('200', response.status_code)
152
- end
152
+ assert_equal('200', response.status_code)
153
+ end
153
154
 
154
- def test_alerts__alert_id__patch
155
- data = JSON.parse('{
156
- "email_to": "example@example.com"
155
+ def test_alerts__alert_id__patch
156
+ data = JSON.parse('{
157
+ "email_to": "example@example.com"
157
158
  }')
158
- alert_id = "test_url_param"
159
- headers = JSON.parse('{"X-Mock": 200}')
159
+ alert_id = 'test_url_param'
160
+ headers = JSON.parse('{"X-Mock": 200}')
160
161
 
161
- response = @sg.client.alerts._(alert_id).patch(request_body: data, request_headers: headers)
162
+ response = @sg.client.alerts._(alert_id).patch(request_body: data, request_headers: headers)
162
163
 
163
- self.assert_equal('200', response.status_code)
164
- end
164
+ assert_equal('200', response.status_code)
165
+ end
165
166
 
166
- def test_alerts__alert_id__get
167
- alert_id = "test_url_param"
168
- headers = JSON.parse('{"X-Mock": 200}')
167
+ def test_alerts__alert_id__get
168
+ alert_id = 'test_url_param'
169
+ headers = JSON.parse('{"X-Mock": 200}')
169
170
 
170
- response = @sg.client.alerts._(alert_id).get(request_headers: headers)
171
+ response = @sg.client.alerts._(alert_id).get(request_headers: headers)
171
172
 
172
- self.assert_equal('200', response.status_code)
173
- end
173
+ assert_equal('200', response.status_code)
174
+ end
174
175
 
175
- def test_alerts__alert_id__delete
176
- alert_id = "test_url_param"
177
- headers = JSON.parse('{"X-Mock": 204}')
176
+ def test_alerts__alert_id__delete
177
+ alert_id = 'test_url_param'
178
+ headers = JSON.parse('{"X-Mock": 204}')
178
179
 
179
- response = @sg.client.alerts._(alert_id).delete(request_headers: headers)
180
+ response = @sg.client.alerts._(alert_id).delete(request_headers: headers)
180
181
 
181
- self.assert_equal('204', response.status_code)
182
- end
182
+ assert_equal('204', response.status_code)
183
+ end
183
184
 
184
- def test_api_keys_post
185
- data = JSON.parse('{
186
- "name": "My API Key",
187
- "sample": "data",
188
- "scopes": [
189
- "mail.send",
190
- "alerts.create",
191
- "alerts.read"
192
- ]
185
+ def test_api_keys_post
186
+ data = JSON.parse('{
187
+ "name": "My API Key",
188
+ "sample": "data",
189
+ "scopes": [
190
+ "mail.send",
191
+ "alerts.create",
192
+ "alerts.read"
193
+ ]
193
194
  }')
194
- headers = JSON.parse('{"X-Mock": 201}')
195
+ headers = JSON.parse('{"X-Mock": 201}')
195
196
 
196
- response = @sg.client.api_keys.post(request_body: data, request_headers: headers)
197
+ response = @sg.client.api_keys.post(request_body: data, request_headers: headers)
197
198
 
198
- self.assert_equal('201', response.status_code)
199
- end
199
+ assert_equal('201', response.status_code)
200
+ end
200
201
 
201
- def test_api_keys_get
202
- params = JSON.parse('{"limit": 1}')
203
- headers = JSON.parse('{"X-Mock": 200}')
202
+ def test_api_keys_get
203
+ params = JSON.parse('{"limit": 1}')
204
+ headers = JSON.parse('{"X-Mock": 200}')
204
205
 
205
- response = @sg.client.api_keys.get(query_params: params, request_headers: headers)
206
+ response = @sg.client.api_keys.get(query_params: params, request_headers: headers)
206
207
 
207
- self.assert_equal('200', response.status_code)
208
- end
208
+ assert_equal('200', response.status_code)
209
+ end
209
210
 
210
- def test_api_keys__api_key_id__put
211
- data = JSON.parse('{
212
- "name": "A New Hope",
213
- "scopes": [
214
- "user.profile.read",
215
- "user.profile.update"
216
- ]
211
+ def test_api_keys__api_key_id__put
212
+ data = JSON.parse('{
213
+ "name": "A New Hope",
214
+ "scopes": [
215
+ "user.profile.read",
216
+ "user.profile.update"
217
+ ]
217
218
  }')
218
- api_key_id = "test_url_param"
219
- headers = JSON.parse('{"X-Mock": 200}')
219
+ api_key_id = 'test_url_param'
220
+ headers = JSON.parse('{"X-Mock": 200}')
220
221
 
221
- response = @sg.client.api_keys._(api_key_id).put(request_body: data, request_headers: headers)
222
+ response = @sg.client.api_keys._(api_key_id).put(request_body: data, request_headers: headers)
222
223
 
223
- self.assert_equal('200', response.status_code)
224
- end
224
+ assert_equal('200', response.status_code)
225
+ end
225
226
 
226
- def test_api_keys__api_key_id__patch
227
- data = JSON.parse('{
228
- "name": "A New Hope"
227
+ def test_api_keys__api_key_id__patch
228
+ data = JSON.parse('{
229
+ "name": "A New Hope"
229
230
  }')
230
- api_key_id = "test_url_param"
231
- headers = JSON.parse('{"X-Mock": 200}')
231
+ api_key_id = 'test_url_param'
232
+ headers = JSON.parse('{"X-Mock": 200}')
232
233
 
233
- response = @sg.client.api_keys._(api_key_id).patch(request_body: data, request_headers: headers)
234
+ response = @sg.client.api_keys._(api_key_id).patch(request_body: data, request_headers: headers)
234
235
 
235
- self.assert_equal('200', response.status_code)
236
- end
236
+ assert_equal('200', response.status_code)
237
+ end
237
238
 
238
- def test_api_keys__api_key_id__get
239
- api_key_id = "test_url_param"
240
- headers = JSON.parse('{"X-Mock": 200}')
239
+ def test_api_keys__api_key_id__get
240
+ api_key_id = 'test_url_param'
241
+ headers = JSON.parse('{"X-Mock": 200}')
241
242
 
242
- response = @sg.client.api_keys._(api_key_id).get(request_headers: headers)
243
+ response = @sg.client.api_keys._(api_key_id).get(request_headers: headers)
243
244
 
244
- self.assert_equal('200', response.status_code)
245
- end
245
+ assert_equal('200', response.status_code)
246
+ end
246
247
 
247
- def test_api_keys__api_key_id__delete
248
- api_key_id = "test_url_param"
249
- headers = JSON.parse('{"X-Mock": 204}')
248
+ def test_api_keys__api_key_id__delete
249
+ api_key_id = 'test_url_param'
250
+ headers = JSON.parse('{"X-Mock": 204}')
250
251
 
251
- response = @sg.client.api_keys._(api_key_id).delete(request_headers: headers)
252
+ response = @sg.client.api_keys._(api_key_id).delete(request_headers: headers)
252
253
 
253
- self.assert_equal('204', response.status_code)
254
- end
254
+ assert_equal('204', response.status_code)
255
+ end
255
256
 
256
- def test_asm_groups_post
257
- data = JSON.parse('{
258
- "description": "Suggestions for products our users might like.",
259
- "is_default": true,
260
- "name": "Product Suggestions"
257
+ def test_asm_groups_post
258
+ data = JSON.parse('{
259
+ "description": "Suggestions for products our users might like.",
260
+ "is_default": true,
261
+ "name": "Product Suggestions"
261
262
  }')
262
- headers = JSON.parse('{"X-Mock": 201}')
263
+ headers = JSON.parse('{"X-Mock": 201}')
263
264
 
264
- response = @sg.client.asm.groups.post(request_body: data, request_headers: headers)
265
+ response = @sg.client.asm.groups.post(request_body: data, request_headers: headers)
265
266
 
266
- self.assert_equal('201', response.status_code)
267
- end
267
+ assert_equal('201', response.status_code)
268
+ end
268
269
 
269
- def test_asm_groups_get
270
- params = JSON.parse('{"id": 1}')
271
- headers = JSON.parse('{"X-Mock": 200}')
270
+ def test_asm_groups_get
271
+ params = JSON.parse('{"id": 1}')
272
+ headers = JSON.parse('{"X-Mock": 200}')
272
273
 
273
- response = @sg.client.asm.groups.get(query_params: params, request_headers: headers)
274
+ response = @sg.client.asm.groups.get(query_params: params, request_headers: headers)
274
275
 
275
- self.assert_equal('200', response.status_code)
276
- end
276
+ assert_equal('200', response.status_code)
277
+ end
277
278
 
278
- def test_asm_groups__group_id__patch
279
- data = JSON.parse('{
280
- "description": "Suggestions for items our users might like.",
281
- "id": 103,
282
- "name": "Item Suggestions"
279
+ def test_asm_groups__group_id__patch
280
+ data = JSON.parse('{
281
+ "description": "Suggestions for items our users might like.",
282
+ "id": 103,
283
+ "name": "Item Suggestions"
283
284
  }')
284
- group_id = "test_url_param"
285
- headers = JSON.parse('{"X-Mock": 201}')
285
+ group_id = 'test_url_param'
286
+ headers = JSON.parse('{"X-Mock": 201}')
286
287
 
287
- response = @sg.client.asm.groups._(group_id).patch(request_body: data, request_headers: headers)
288
+ response = @sg.client.asm.groups._(group_id).patch(request_body: data, request_headers: headers)
288
289
 
289
- self.assert_equal('201', response.status_code)
290
- end
290
+ assert_equal('201', response.status_code)
291
+ end
291
292
 
292
- def test_asm_groups__group_id__get
293
- group_id = "test_url_param"
294
- headers = JSON.parse('{"X-Mock": 200}')
293
+ def test_asm_groups__group_id__get
294
+ group_id = 'test_url_param'
295
+ headers = JSON.parse('{"X-Mock": 200}')
295
296
 
296
- response = @sg.client.asm.groups._(group_id).get(request_headers: headers)
297
+ response = @sg.client.asm.groups._(group_id).get(request_headers: headers)
297
298
 
298
- self.assert_equal('200', response.status_code)
299
- end
299
+ assert_equal('200', response.status_code)
300
+ end
300
301
 
301
- def test_asm_groups__group_id__delete
302
- group_id = "test_url_param"
303
- headers = JSON.parse('{"X-Mock": 204}')
302
+ def test_asm_groups__group_id__delete
303
+ group_id = 'test_url_param'
304
+ headers = JSON.parse('{"X-Mock": 204}')
304
305
 
305
- response = @sg.client.asm.groups._(group_id).delete(request_headers: headers)
306
+ response = @sg.client.asm.groups._(group_id).delete(request_headers: headers)
306
307
 
307
- self.assert_equal('204', response.status_code)
308
- end
308
+ assert_equal('204', response.status_code)
309
+ end
309
310
 
310
- def test_asm_groups__group_id__suppressions_post
311
- data = JSON.parse('{
312
- "recipient_emails": [
313
- "test1@example.com",
314
- "test2@example.com"
315
- ]
311
+ def test_asm_groups__group_id__suppressions_post
312
+ data = JSON.parse('{
313
+ "recipient_emails": [
314
+ "test1@example.com",
315
+ "test2@example.com"
316
+ ]
316
317
  }')
317
- group_id = "test_url_param"
318
- headers = JSON.parse('{"X-Mock": 201}')
318
+ group_id = 'test_url_param'
319
+ headers = JSON.parse('{"X-Mock": 201}')
319
320
 
320
- response = @sg.client.asm.groups._(group_id).suppressions.post(request_body: data, request_headers: headers)
321
+ response = @sg.client.asm.groups._(group_id).suppressions.post(request_body: data, request_headers: headers)
321
322
 
322
- self.assert_equal('201', response.status_code)
323
- end
323
+ assert_equal('201', response.status_code)
324
+ end
324
325
 
325
- def test_asm_groups__group_id__suppressions_get
326
- group_id = "test_url_param"
327
- headers = JSON.parse('{"X-Mock": 200}')
326
+ def test_asm_groups__group_id__suppressions_get
327
+ group_id = 'test_url_param'
328
+ headers = JSON.parse('{"X-Mock": 200}')
328
329
 
329
- response = @sg.client.asm.groups._(group_id).suppressions.get(request_headers: headers)
330
+ response = @sg.client.asm.groups._(group_id).suppressions.get(request_headers: headers)
330
331
 
331
- self.assert_equal('200', response.status_code)
332
- end
332
+ assert_equal('200', response.status_code)
333
+ end
333
334
 
334
- def test_asm_groups__group_id__suppressions_search_post
335
- data = JSON.parse('{
336
- "recipient_emails": [
337
- "exists1@example.com",
338
- "exists2@example.com",
339
- "doesnotexists@example.com"
340
- ]
335
+ def test_asm_groups__group_id__suppressions_search_post
336
+ data = JSON.parse('{
337
+ "recipient_emails": [
338
+ "exists1@example.com",
339
+ "exists2@example.com",
340
+ "doesnotexists@example.com"
341
+ ]
341
342
  }')
342
- group_id = "test_url_param"
343
- headers = JSON.parse('{"X-Mock": 200}')
343
+ group_id = 'test_url_param'
344
+ headers = JSON.parse('{"X-Mock": 200}')
344
345
 
345
- response = @sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data, request_headers: headers)
346
+ response = @sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data, request_headers: headers)
346
347
 
347
- self.assert_equal('200', response.status_code)
348
- end
348
+ assert_equal('200', response.status_code)
349
+ end
349
350
 
350
- def test_asm_groups__group_id__suppressions__email__delete
351
- group_id = "test_url_param"
352
- email = "test_url_param"
353
- headers = JSON.parse('{"X-Mock": 204}')
351
+ def test_asm_groups__group_id__suppressions__email__delete
352
+ group_id = 'test_url_param'
353
+ email = 'test_url_param'
354
+ headers = JSON.parse('{"X-Mock": 204}')
354
355
 
355
- response = @sg.client.asm.groups._(group_id).suppressions._(email).delete(request_headers: headers)
356
+ response = @sg.client.asm.groups._(group_id).suppressions._(email).delete(request_headers: headers)
356
357
 
357
- self.assert_equal('204', response.status_code)
358
- end
358
+ assert_equal('204', response.status_code)
359
+ end
359
360
 
360
- def test_asm_suppressions_get
361
- headers = JSON.parse('{"X-Mock": 200}')
361
+ def test_asm_suppressions_get
362
+ headers = JSON.parse('{"X-Mock": 200}')
362
363
 
363
- response = @sg.client.asm.suppressions.get(request_headers: headers)
364
+ response = @sg.client.asm.suppressions.get(request_headers: headers)
364
365
 
365
- self.assert_equal('200', response.status_code)
366
- end
366
+ assert_equal('200', response.status_code)
367
+ end
367
368
 
368
- def test_asm_suppressions_global_post
369
- data = JSON.parse('{
370
- "recipient_emails": [
371
- "test1@example.com",
372
- "test2@example.com"
373
- ]
369
+ def test_asm_suppressions_global_post
370
+ data = JSON.parse('{
371
+ "recipient_emails": [
372
+ "test1@example.com",
373
+ "test2@example.com"
374
+ ]
374
375
  }')
375
- headers = JSON.parse('{"X-Mock": 201}')
376
+ headers = JSON.parse('{"X-Mock": 201}')
376
377
 
377
- response = @sg.client.asm.suppressions.global.post(request_body: data, request_headers: headers)
378
+ response = @sg.client.asm.suppressions.global.post(request_body: data, request_headers: headers)
378
379
 
379
- self.assert_equal('201', response.status_code)
380
- end
380
+ assert_equal('201', response.status_code)
381
+ end
381
382
 
382
- def test_asm_suppressions_global__email__get
383
- email = "test_url_param"
384
- headers = JSON.parse('{"X-Mock": 200}')
383
+ def test_asm_suppressions_global__email__get
384
+ email = 'test_url_param'
385
+ headers = JSON.parse('{"X-Mock": 200}')
385
386
 
386
- response = @sg.client.asm.suppressions.global._(email).get(request_headers: headers)
387
+ response = @sg.client.asm.suppressions.global._(email).get(request_headers: headers)
387
388
 
388
- self.assert_equal('200', response.status_code)
389
- end
389
+ assert_equal('200', response.status_code)
390
+ end
390
391
 
391
- def test_asm_suppressions_global__email__delete
392
- email = "test_url_param"
393
- headers = JSON.parse('{"X-Mock": 204}')
392
+ def test_asm_suppressions_global__email__delete
393
+ email = 'test_url_param'
394
+ headers = JSON.parse('{"X-Mock": 204}')
394
395
 
395
- response = @sg.client.asm.suppressions.global._(email).delete(request_headers: headers)
396
+ response = @sg.client.asm.suppressions.global._(email).delete(request_headers: headers)
396
397
 
397
- self.assert_equal('204', response.status_code)
398
- end
398
+ assert_equal('204', response.status_code)
399
+ end
399
400
 
400
- def test_asm_suppressions__email__get
401
- email = "test_url_param"
402
- headers = JSON.parse('{"X-Mock": 200}')
401
+ def test_asm_suppressions__email__get
402
+ email = 'test_url_param'
403
+ headers = JSON.parse('{"X-Mock": 200}')
403
404
 
404
- response = @sg.client.asm.suppressions._(email).get(request_headers: headers)
405
+ response = @sg.client.asm.suppressions._(email).get(request_headers: headers)
405
406
 
406
- self.assert_equal('200', response.status_code)
407
- end
407
+ assert_equal('200', response.status_code)
408
+ end
408
409
 
409
- def test_browsers_stats_get
410
- params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}')
411
- headers = JSON.parse('{"X-Mock": 200}')
410
+ def test_browsers_stats_get
411
+ params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}')
412
+ headers = JSON.parse('{"X-Mock": 200}')
412
413
 
413
- response = @sg.client.browsers.stats.get(query_params: params, request_headers: headers)
414
+ response = @sg.client.browsers.stats.get(query_params: params, request_headers: headers)
414
415
 
415
- self.assert_equal('200', response.status_code)
416
- end
416
+ assert_equal('200', response.status_code)
417
+ end
417
418
 
418
- def test_campaigns_post
419
- data = JSON.parse('{
420
- "categories": [
421
- "spring line"
422
- ],
423
- "custom_unsubscribe_url": "",
424
- "html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
425
- "ip_pool": "marketing",
426
- "list_ids": [
427
- 110,
428
- 124
429
- ],
430
- "plain_content": "Check out our spring line!",
431
- "segment_ids": [
432
- 110
433
- ],
434
- "sender_id": 124451,
435
- "subject": "New Products for Spring!",
436
- "suppression_group_id": 42,
437
- "title": "March Newsletter"
419
+ def test_campaigns_post
420
+ data = JSON.parse('{
421
+ "categories": [
422
+ "spring line"
423
+ ],
424
+ "custom_unsubscribe_url": "",
425
+ "html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
426
+ "ip_pool": "marketing",
427
+ "list_ids": [
428
+ 110,
429
+ 124
430
+ ],
431
+ "plain_content": "Check out our spring line!",
432
+ "segment_ids": [
433
+ 110
434
+ ],
435
+ "sender_id": 124451,
436
+ "subject": "New Products for Spring!",
437
+ "suppression_group_id": 42,
438
+ "title": "March Newsletter"
438
439
  }')
439
- headers = JSON.parse('{"X-Mock": 201}')
440
+ headers = JSON.parse('{"X-Mock": 201}')
440
441
 
441
- response = @sg.client.campaigns.post(request_body: data, request_headers: headers)
442
+ response = @sg.client.campaigns.post(request_body: data, request_headers: headers)
442
443
 
443
- self.assert_equal('201', response.status_code)
444
- end
444
+ assert_equal('201', response.status_code)
445
+ end
445
446
 
446
- def test_campaigns_get
447
- params = JSON.parse('{"limit": 1, "offset": 1}')
448
- headers = JSON.parse('{"X-Mock": 200}')
447
+ def test_campaigns_get
448
+ params = JSON.parse('{"limit": 1, "offset": 1}')
449
+ headers = JSON.parse('{"X-Mock": 200}')
449
450
 
450
- response = @sg.client.campaigns.get(query_params: params, request_headers: headers)
451
+ response = @sg.client.campaigns.get(query_params: params, request_headers: headers)
451
452
 
452
- self.assert_equal('200', response.status_code)
453
- end
453
+ assert_equal('200', response.status_code)
454
+ end
454
455
 
455
- def test_campaigns__campaign_id__patch
456
- data = JSON.parse('{
457
- "categories": [
458
- "summer line"
459
- ],
460
- "html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>",
461
- "plain_content": "Check out our summer line!",
462
- "subject": "New Products for Summer!",
463
- "title": "May Newsletter"
456
+ def test_campaigns__campaign_id__patch
457
+ data = JSON.parse('{
458
+ "categories": [
459
+ "summer line"
460
+ ],
461
+ "html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>",
462
+ "plain_content": "Check out our summer line!",
463
+ "subject": "New Products for Summer!",
464
+ "title": "May Newsletter"
464
465
  }')
465
- campaign_id = "test_url_param"
466
- headers = JSON.parse('{"X-Mock": 200}')
466
+ campaign_id = 'test_url_param'
467
+ headers = JSON.parse('{"X-Mock": 200}')
467
468
 
468
- response = @sg.client.campaigns._(campaign_id).patch(request_body: data, request_headers: headers)
469
+ response = @sg.client.campaigns._(campaign_id).patch(request_body: data, request_headers: headers)
469
470
 
470
- self.assert_equal('200', response.status_code)
471
- end
471
+ assert_equal('200', response.status_code)
472
+ end
472
473
 
473
- def test_campaigns__campaign_id__get
474
- campaign_id = "test_url_param"
475
- headers = JSON.parse('{"X-Mock": 200}')
474
+ def test_campaigns__campaign_id__get
475
+ campaign_id = 'test_url_param'
476
+ headers = JSON.parse('{"X-Mock": 200}')
476
477
 
477
- response = @sg.client.campaigns._(campaign_id).get(request_headers: headers)
478
+ response = @sg.client.campaigns._(campaign_id).get(request_headers: headers)
478
479
 
479
- self.assert_equal('200', response.status_code)
480
- end
480
+ assert_equal('200', response.status_code)
481
+ end
481
482
 
482
- def test_campaigns__campaign_id__delete
483
- campaign_id = "test_url_param"
484
- headers = JSON.parse('{"X-Mock": 204}')
483
+ def test_campaigns__campaign_id__delete
484
+ campaign_id = 'test_url_param'
485
+ headers = JSON.parse('{"X-Mock": 204}')
485
486
 
486
- response = @sg.client.campaigns._(campaign_id).delete(request_headers: headers)
487
+ response = @sg.client.campaigns._(campaign_id).delete(request_headers: headers)
487
488
 
488
- self.assert_equal('204', response.status_code)
489
- end
489
+ assert_equal('204', response.status_code)
490
+ end
490
491
 
491
- def test_campaigns__campaign_id__schedules_patch
492
- data = JSON.parse('{
493
- "send_at": 1489451436
492
+ def test_campaigns__campaign_id__schedules_patch
493
+ data = JSON.parse('{
494
+ "send_at": 1489451436
494
495
  }')
495
- campaign_id = "test_url_param"
496
- headers = JSON.parse('{"X-Mock": 200}')
496
+ campaign_id = 'test_url_param'
497
+ headers = JSON.parse('{"X-Mock": 200}')
497
498
 
498
- response = @sg.client.campaigns._(campaign_id).schedules.patch(request_body: data, request_headers: headers)
499
+ response = @sg.client.campaigns._(campaign_id).schedules.patch(request_body: data, request_headers: headers)
499
500
 
500
- self.assert_equal('200', response.status_code)
501
- end
501
+ assert_equal('200', response.status_code)
502
+ end
502
503
 
503
- def test_campaigns__campaign_id__schedules_post
504
- data = JSON.parse('{
505
- "send_at": 1489771528
504
+ def test_campaigns__campaign_id__schedules_post
505
+ data = JSON.parse('{
506
+ "send_at": 1489771528
506
507
  }')
507
- campaign_id = "test_url_param"
508
- headers = JSON.parse('{"X-Mock": 201}')
508
+ campaign_id = 'test_url_param'
509
+ headers = JSON.parse('{"X-Mock": 201}')
509
510
 
510
- response = @sg.client.campaigns._(campaign_id).schedules.post(request_body: data, request_headers: headers)
511
+ response = @sg.client.campaigns._(campaign_id).schedules.post(request_body: data, request_headers: headers)
511
512
 
512
- self.assert_equal('201', response.status_code)
513
- end
513
+ assert_equal('201', response.status_code)
514
+ end
514
515
 
515
- def test_campaigns__campaign_id__schedules_get
516
- campaign_id = "test_url_param"
517
- headers = JSON.parse('{"X-Mock": 200}')
516
+ def test_campaigns__campaign_id__schedules_get
517
+ campaign_id = 'test_url_param'
518
+ headers = JSON.parse('{"X-Mock": 200}')
518
519
 
519
- response = @sg.client.campaigns._(campaign_id).schedules.get(request_headers: headers)
520
+ response = @sg.client.campaigns._(campaign_id).schedules.get(request_headers: headers)
520
521
 
521
- self.assert_equal('200', response.status_code)
522
- end
522
+ assert_equal('200', response.status_code)
523
+ end
523
524
 
524
- def test_campaigns__campaign_id__schedules_delete
525
- campaign_id = "test_url_param"
526
- headers = JSON.parse('{"X-Mock": 204}')
525
+ def test_campaigns__campaign_id__schedules_delete
526
+ campaign_id = 'test_url_param'
527
+ headers = JSON.parse('{"X-Mock": 204}')
527
528
 
528
- response = @sg.client.campaigns._(campaign_id).schedules.delete(request_headers: headers)
529
+ response = @sg.client.campaigns._(campaign_id).schedules.delete(request_headers: headers)
529
530
 
530
- self.assert_equal('204', response.status_code)
531
- end
531
+ assert_equal('204', response.status_code)
532
+ end
532
533
 
533
- def test_campaigns__campaign_id__schedules_now_post
534
- campaign_id = "test_url_param"
535
- headers = JSON.parse('{"X-Mock": 201}')
534
+ def test_campaigns__campaign_id__schedules_now_post
535
+ campaign_id = 'test_url_param'
536
+ headers = JSON.parse('{"X-Mock": 201}')
536
537
 
537
- response = @sg.client.campaigns._(campaign_id).schedules.now.post(request_headers: headers)
538
+ response = @sg.client.campaigns._(campaign_id).schedules.now.post(request_headers: headers)
538
539
 
539
- self.assert_equal('201', response.status_code)
540
- end
540
+ assert_equal('201', response.status_code)
541
+ end
541
542
 
542
- def test_campaigns__campaign_id__schedules_test_post
543
- data = JSON.parse('{
544
- "to": "your.email@example.com"
543
+ def test_campaigns__campaign_id__schedules_test_post
544
+ data = JSON.parse('{
545
+ "to": "your.email@example.com"
545
546
  }')
546
- campaign_id = "test_url_param"
547
- headers = JSON.parse('{"X-Mock": 204}')
547
+ campaign_id = 'test_url_param'
548
+ headers = JSON.parse('{"X-Mock": 204}')
548
549
 
549
- response = @sg.client.campaigns._(campaign_id).schedules.test.post(request_body: data, request_headers: headers)
550
+ response = @sg.client.campaigns._(campaign_id).schedules.test.post(request_body: data, request_headers: headers)
550
551
 
551
- self.assert_equal('204', response.status_code)
552
- end
552
+ assert_equal('204', response.status_code)
553
+ end
553
554
 
554
- def test_categories_get
555
- params = JSON.parse('{"category": "test_string", "limit": 1, "offset": 1}')
556
- headers = JSON.parse('{"X-Mock": 200}')
555
+ def test_categories_get
556
+ params = JSON.parse('{"category": "test_string", "limit": 1, "offset": 1}')
557
+ headers = JSON.parse('{"X-Mock": 200}')
557
558
 
558
- response = @sg.client.categories.get(query_params: params, request_headers: headers)
559
+ response = @sg.client.categories.get(query_params: params, request_headers: headers)
559
560
 
560
- self.assert_equal('200', response.status_code)
561
- end
561
+ assert_equal('200', response.status_code)
562
+ end
562
563
 
563
- def test_categories_stats_get
564
- params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}')
565
- headers = JSON.parse('{"X-Mock": 200}')
564
+ def test_categories_stats_get
565
+ params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}')
566
+ headers = JSON.parse('{"X-Mock": 200}')
566
567
 
567
- response = @sg.client.categories.stats.get(query_params: params, request_headers: headers)
568
+ response = @sg.client.categories.stats.get(query_params: params, request_headers: headers)
568
569
 
569
- self.assert_equal('200', response.status_code)
570
- end
570
+ assert_equal('200', response.status_code)
571
+ end
571
572
 
572
- def test_categories_stats_sums_get
573
- params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}')
574
- headers = JSON.parse('{"X-Mock": 200}')
573
+ def test_categories_stats_sums_get
574
+ params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}')
575
+ headers = JSON.parse('{"X-Mock": 200}')
575
576
 
576
- response = @sg.client.categories.stats.sums.get(query_params: params, request_headers: headers)
577
+ response = @sg.client.categories.stats.sums.get(query_params: params, request_headers: headers)
577
578
 
578
- self.assert_equal('200', response.status_code)
579
- end
579
+ assert_equal('200', response.status_code)
580
+ end
580
581
 
581
- def test_clients_stats_get
582
- params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}')
583
- headers = JSON.parse('{"X-Mock": 200}')
582
+ def test_clients_stats_get
583
+ params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}')
584
+ headers = JSON.parse('{"X-Mock": 200}')
584
585
 
585
- response = @sg.client.clients.stats.get(query_params: params, request_headers: headers)
586
+ response = @sg.client.clients.stats.get(query_params: params, request_headers: headers)
586
587
 
587
- self.assert_equal('200', response.status_code)
588
- end
588
+ assert_equal('200', response.status_code)
589
+ end
589
590
 
590
- def test_clients__client_type__stats_get
591
- params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}')
592
- client_type = "test_url_param"
593
- headers = JSON.parse('{"X-Mock": 200}')
591
+ def test_clients__client_type__stats_get
592
+ params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}')
593
+ client_type = 'test_url_param'
594
+ headers = JSON.parse('{"X-Mock": 200}')
594
595
 
595
- response = @sg.client.clients._(client_type).stats.get(query_params: params, request_headers: headers)
596
+ response = @sg.client.clients._(client_type).stats.get(query_params: params, request_headers: headers)
596
597
 
597
- self.assert_equal('200', response.status_code)
598
- end
598
+ assert_equal('200', response.status_code)
599
+ end
599
600
 
600
- def test_contactdb_custom_fields_post
601
- data = JSON.parse('{
602
- "name": "pet",
603
- "type": "text"
601
+ def test_contactdb_custom_fields_post
602
+ data = JSON.parse('{
603
+ "name": "pet",
604
+ "type": "text"
604
605
  }')
605
- headers = JSON.parse('{"X-Mock": 201}')
606
+ headers = JSON.parse('{"X-Mock": 201}')
606
607
 
607
- response = @sg.client.contactdb.custom_fields.post(request_body: data, request_headers: headers)
608
+ response = @sg.client.contactdb.custom_fields.post(request_body: data, request_headers: headers)
608
609
 
609
- self.assert_equal('201', response.status_code)
610
- end
610
+ assert_equal('201', response.status_code)
611
+ end
611
612
 
612
- def test_contactdb_custom_fields_get
613
- headers = JSON.parse('{"X-Mock": 200}')
613
+ def test_contactdb_custom_fields_get
614
+ headers = JSON.parse('{"X-Mock": 200}')
614
615
 
615
- response = @sg.client.contactdb.custom_fields.get(request_headers: headers)
616
+ response = @sg.client.contactdb.custom_fields.get(request_headers: headers)
616
617
 
617
- self.assert_equal('200', response.status_code)
618
- end
618
+ assert_equal('200', response.status_code)
619
+ end
619
620
 
620
- def test_contactdb_custom_fields__custom_field_id__get
621
- custom_field_id = "test_url_param"
622
- headers = JSON.parse('{"X-Mock": 200}')
621
+ def test_contactdb_custom_fields__custom_field_id__get
622
+ custom_field_id = 'test_url_param'
623
+ headers = JSON.parse('{"X-Mock": 200}')
623
624
 
624
- response = @sg.client.contactdb.custom_fields._(custom_field_id).get(request_headers: headers)
625
+ response = @sg.client.contactdb.custom_fields._(custom_field_id).get(request_headers: headers)
625
626
 
626
- self.assert_equal('200', response.status_code)
627
- end
627
+ assert_equal('200', response.status_code)
628
+ end
628
629
 
629
- def test_contactdb_custom_fields__custom_field_id__delete
630
- custom_field_id = "test_url_param"
631
- headers = JSON.parse('{"X-Mock": 202}')
630
+ def test_contactdb_custom_fields__custom_field_id__delete
631
+ custom_field_id = 'test_url_param'
632
+ headers = JSON.parse('{"X-Mock": 202}')
632
633
 
633
- response = @sg.client.contactdb.custom_fields._(custom_field_id).delete(request_headers: headers)
634
+ response = @sg.client.contactdb.custom_fields._(custom_field_id).delete(request_headers: headers)
634
635
 
635
- self.assert_equal('202', response.status_code)
636
- end
636
+ assert_equal('202', response.status_code)
637
+ end
637
638
 
638
- def test_contactdb_lists_post
639
- data = JSON.parse('{
640
- "name": "your list name"
639
+ def test_contactdb_lists_post
640
+ data = JSON.parse('{
641
+ "name": "your list name"
641
642
  }')
642
- headers = JSON.parse('{"X-Mock": 201}')
643
+ headers = JSON.parse('{"X-Mock": 201}')
643
644
 
644
- response = @sg.client.contactdb.lists.post(request_body: data, request_headers: headers)
645
+ response = @sg.client.contactdb.lists.post(request_body: data, request_headers: headers)
645
646
 
646
- self.assert_equal('201', response.status_code)
647
- end
647
+ assert_equal('201', response.status_code)
648
+ end
648
649
 
649
- def test_contactdb_lists_get
650
- headers = JSON.parse('{"X-Mock": 200}')
650
+ def test_contactdb_lists_get
651
+ headers = JSON.parse('{"X-Mock": 200}')
651
652
 
652
- response = @sg.client.contactdb.lists.get(request_headers: headers)
653
+ response = @sg.client.contactdb.lists.get(request_headers: headers)
653
654
 
654
- self.assert_equal('200', response.status_code)
655
- end
655
+ assert_equal('200', response.status_code)
656
+ end
656
657
 
657
- def test_contactdb_lists_delete
658
- data = JSON.parse('[
659
- 1,
660
- 2,
661
- 3,
662
- 4
658
+ def test_contactdb_lists_delete
659
+ data = JSON.parse('[
660
+ 1,
661
+ 2,
662
+ 3,
663
+ 4
663
664
  ]')
664
- headers = JSON.parse('{"X-Mock": 204}')
665
+ headers = JSON.parse('{"X-Mock": 204}')
665
666
 
666
- response = @sg.client.contactdb.lists.delete(request_body: data, request_headers: headers)
667
+ response = @sg.client.contactdb.lists.delete(request_body: data, request_headers: headers)
667
668
 
668
- self.assert_equal('204', response.status_code)
669
- end
669
+ assert_equal('204', response.status_code)
670
+ end
670
671
 
671
- def test_contactdb_lists__list_id__patch
672
- data = JSON.parse('{
673
- "name": "newlistname"
672
+ def test_contactdb_lists__list_id__patch
673
+ data = JSON.parse('{
674
+ "name": "newlistname"
674
675
  }')
675
- params = JSON.parse('{"list_id": 1}')
676
- list_id = "test_url_param"
677
- headers = JSON.parse('{"X-Mock": 200}')
676
+ params = JSON.parse('{"list_id": 1}')
677
+ list_id = 'test_url_param'
678
+ headers = JSON.parse('{"X-Mock": 200}')
678
679
 
679
- response = @sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params, request_headers: headers)
680
+ response = @sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params, request_headers: headers)
680
681
 
681
- self.assert_equal('200', response.status_code)
682
- end
682
+ assert_equal('200', response.status_code)
683
+ end
683
684
 
684
- def test_contactdb_lists__list_id__get
685
- params = JSON.parse('{"list_id": 1}')
686
- list_id = "test_url_param"
687
- headers = JSON.parse('{"X-Mock": 200}')
685
+ def test_contactdb_lists__list_id__get
686
+ params = JSON.parse('{"list_id": 1}')
687
+ list_id = 'test_url_param'
688
+ headers = JSON.parse('{"X-Mock": 200}')
688
689
 
689
- response = @sg.client.contactdb.lists._(list_id).get(query_params: params, request_headers: headers)
690
+ response = @sg.client.contactdb.lists._(list_id).get(query_params: params, request_headers: headers)
690
691
 
691
- self.assert_equal('200', response.status_code)
692
- end
692
+ assert_equal('200', response.status_code)
693
+ end
693
694
 
694
- def test_contactdb_lists__list_id__delete
695
- params = JSON.parse('{"delete_contacts": "true"}')
696
- list_id = "test_url_param"
697
- headers = JSON.parse('{"X-Mock": 202}')
695
+ def test_contactdb_lists__list_id__delete
696
+ params = JSON.parse('{"delete_contacts": "true"}')
697
+ list_id = 'test_url_param'
698
+ headers = JSON.parse('{"X-Mock": 202}')
698
699
 
699
- response = @sg.client.contactdb.lists._(list_id).delete(query_params: params, request_headers: headers)
700
+ response = @sg.client.contactdb.lists._(list_id).delete(query_params: params, request_headers: headers)
700
701
 
701
- self.assert_equal('202', response.status_code)
702
- end
702
+ assert_equal('202', response.status_code)
703
+ end
703
704
 
704
- def test_contactdb_lists__list_id__recipients_post
705
- data = JSON.parse('[
706
- "recipient_id1",
707
- "recipient_id2"
705
+ def test_contactdb_lists__list_id__recipients_post
706
+ data = JSON.parse('[
707
+ "recipient_id1",
708
+ "recipient_id2"
708
709
  ]')
709
- list_id = "test_url_param"
710
- headers = JSON.parse('{"X-Mock": 201}')
710
+ list_id = 'test_url_param'
711
+ headers = JSON.parse('{"X-Mock": 201}')
711
712
 
712
- response = @sg.client.contactdb.lists._(list_id).recipients.post(request_body: data, request_headers: headers)
713
+ response = @sg.client.contactdb.lists._(list_id).recipients.post(request_body: data, request_headers: headers)
713
714
 
714
- self.assert_equal('201', response.status_code)
715
- end
715
+ assert_equal('201', response.status_code)
716
+ end
716
717
 
717
- def test_contactdb_lists__list_id__recipients_get
718
- params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}')
719
- list_id = "test_url_param"
720
- headers = JSON.parse('{"X-Mock": 200}')
718
+ def test_contactdb_lists__list_id__recipients_get
719
+ params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}')
720
+ list_id = 'test_url_param'
721
+ headers = JSON.parse('{"X-Mock": 200}')
721
722
 
722
- response = @sg.client.contactdb.lists._(list_id).recipients.get(query_params: params, request_headers: headers)
723
+ response = @sg.client.contactdb.lists._(list_id).recipients.get(query_params: params, request_headers: headers)
723
724
 
724
- self.assert_equal('200', response.status_code)
725
- end
725
+ assert_equal('200', response.status_code)
726
+ end
726
727
 
727
- def test_contactdb_lists__list_id__recipients__recipient_id__post
728
- list_id = "test_url_param"
729
- recipient_id = "test_url_param"
730
- headers = JSON.parse('{"X-Mock": 201}')
728
+ def test_contactdb_lists__list_id__recipients__recipient_id__post
729
+ list_id = 'test_url_param'
730
+ recipient_id = 'test_url_param'
731
+ headers = JSON.parse('{"X-Mock": 201}')
731
732
 
732
- response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(request_headers: headers)
733
+ response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post(request_headers: headers)
733
734
 
734
- self.assert_equal('201', response.status_code)
735
- end
735
+ assert_equal('201', response.status_code)
736
+ end
736
737
 
737
- def test_contactdb_lists__list_id__recipients__recipient_id__delete
738
- params = JSON.parse('{"recipient_id": 1, "list_id": 1}')
739
- list_id = "test_url_param"
740
- recipient_id = "test_url_param"
741
- headers = JSON.parse('{"X-Mock": 204}')
738
+ def test_contactdb_lists__list_id__recipients__recipient_id__delete
739
+ params = JSON.parse('{"recipient_id": 1, "list_id": 1}')
740
+ list_id = 'test_url_param'
741
+ recipient_id = 'test_url_param'
742
+ headers = JSON.parse('{"X-Mock": 204}')
742
743
 
743
- response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params, request_headers: headers)
744
+ response = @sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params, request_headers: headers)
744
745
 
745
- self.assert_equal('204', response.status_code)
746
- end
746
+ assert_equal('204', response.status_code)
747
+ end
747
748
 
748
- def test_contactdb_recipients_patch
749
- data = JSON.parse('[
750
- {
751
- "email": "jones@example.com",
752
- "first_name": "Guy",
753
- "last_name": "Jones"
754
- }
749
+ def test_contactdb_recipients_patch
750
+ data = JSON.parse('[
751
+ {
752
+ "email": "jones@example.com",
753
+ "first_name": "Guy",
754
+ "last_name": "Jones"
755
+ }
755
756
  ]')
756
- headers = JSON.parse('{"X-Mock": 201}')
757
-
758
- response = @sg.client.contactdb.recipients.patch(request_body: data, request_headers: headers)
759
-
760
- self.assert_equal('201', response.status_code)
761
- end
762
-
763
- def test_contactdb_recipients_post
764
- data = JSON.parse('[
765
- {
766
- "age": 25,
767
- "email": "example@example.com",
768
- "first_name": "",
769
- "last_name": "User"
770
- },
771
- {
772
- "age": 25,
773
- "email": "example2@example.com",
774
- "first_name": "Example",
775
- "last_name": "User"
776
- }
757
+ headers = JSON.parse('{"X-Mock": 201}')
758
+
759
+ response = @sg.client.contactdb.recipients.patch(request_body: data, request_headers: headers)
760
+
761
+ assert_equal('201', response.status_code)
762
+ end
763
+
764
+ def test_contactdb_recipients_post
765
+ data = JSON.parse('[
766
+ {
767
+ "age": 25,
768
+ "email": "example@example.com",
769
+ "first_name": "",
770
+ "last_name": "User"
771
+ },
772
+ {
773
+ "age": 25,
774
+ "email": "example2@example.com",
775
+ "first_name": "Example",
776
+ "last_name": "User"
777
+ }
777
778
  ]')
778
- headers = JSON.parse('{"X-Mock": 201}')
779
+ headers = JSON.parse('{"X-Mock": 201}')
779
780
 
780
- response = @sg.client.contactdb.recipients.post(request_body: data, request_headers: headers)
781
+ response = @sg.client.contactdb.recipients.post(request_body: data, request_headers: headers)
781
782
 
782
- self.assert_equal('201', response.status_code)
783
- end
783
+ assert_equal('201', response.status_code)
784
+ end
784
785
 
785
- def test_contactdb_recipients_get
786
- params = JSON.parse('{"page": 1, "page_size": 1}')
787
- headers = JSON.parse('{"X-Mock": 200}')
786
+ def test_contactdb_recipients_get
787
+ params = JSON.parse('{"page": 1, "page_size": 1}')
788
+ headers = JSON.parse('{"X-Mock": 200}')
788
789
 
789
- response = @sg.client.contactdb.recipients.get(query_params: params, request_headers: headers)
790
+ response = @sg.client.contactdb.recipients.get(query_params: params, request_headers: headers)
790
791
 
791
- self.assert_equal('200', response.status_code)
792
- end
792
+ assert_equal('200', response.status_code)
793
+ end
793
794
 
794
- def test_contactdb_recipients_delete
795
- data = JSON.parse('[
796
- "recipient_id1",
797
- "recipient_id2"
795
+ def test_contactdb_recipients_delete
796
+ data = JSON.parse('[
797
+ "recipient_id1",
798
+ "recipient_id2"
798
799
  ]')
799
- headers = JSON.parse('{"X-Mock": 200}')
800
+ headers = JSON.parse('{"X-Mock": 200}')
800
801
 
801
- response = @sg.client.contactdb.recipients.delete(request_body: data, request_headers: headers)
802
+ response = @sg.client.contactdb.recipients.delete(request_body: data, request_headers: headers)
802
803
 
803
- self.assert_equal('200', response.status_code)
804
- end
804
+ assert_equal('200', response.status_code)
805
+ end
805
806
 
806
- def test_contactdb_recipients_billable_count_get
807
- headers = JSON.parse('{"X-Mock": 200}')
807
+ def test_contactdb_recipients_billable_count_get
808
+ headers = JSON.parse('{"X-Mock": 200}')
808
809
 
809
- response = @sg.client.contactdb.recipients.billable_count.get(request_headers: headers)
810
+ response = @sg.client.contactdb.recipients.billable_count.get(request_headers: headers)
810
811
 
811
- self.assert_equal('200', response.status_code)
812
- end
812
+ assert_equal('200', response.status_code)
813
+ end
813
814
 
814
- def test_contactdb_recipients_count_get
815
- headers = JSON.parse('{"X-Mock": 200}')
815
+ def test_contactdb_recipients_count_get
816
+ headers = JSON.parse('{"X-Mock": 200}')
816
817
 
817
- response = @sg.client.contactdb.recipients.count.get(request_headers: headers)
818
+ response = @sg.client.contactdb.recipients.count.get(request_headers: headers)
818
819
 
819
- self.assert_equal('200', response.status_code)
820
- end
820
+ assert_equal('200', response.status_code)
821
+ end
821
822
 
822
- def test_contactdb_recipients_search_get
823
- params = { field_name: "test_string" }
824
- headers = JSON.parse('{"X-Mock": 200}')
823
+ def test_contactdb_recipients_search_get
824
+ params = { field_name: 'test_string' }
825
+ headers = JSON.parse('{"X-Mock": 200}')
825
826
 
826
- response = @sg.client.contactdb.recipients.search.get(query_params: params, request_headers: headers)
827
+ response = @sg.client.contactdb.recipients.search.get(query_params: params, request_headers: headers)
827
828
 
828
- self.assert_equal('200', response.status_code)
829
- end
829
+ assert_equal('200', response.status_code)
830
+ end
830
831
 
831
- def test_contactdb_recipients__recipient_id__get
832
- recipient_id = "test_url_param"
833
- headers = JSON.parse('{"X-Mock": 200}')
832
+ def test_contactdb_recipients__recipient_id__get
833
+ recipient_id = 'test_url_param'
834
+ headers = JSON.parse('{"X-Mock": 200}')
834
835
 
835
- response = @sg.client.contactdb.recipients._(recipient_id).get(request_headers: headers)
836
+ response = @sg.client.contactdb.recipients._(recipient_id).get(request_headers: headers)
836
837
 
837
- self.assert_equal('200', response.status_code)
838
- end
838
+ assert_equal('200', response.status_code)
839
+ end
839
840
 
840
- def test_contactdb_recipients__recipient_id__delete
841
- recipient_id = "test_url_param"
842
- headers = JSON.parse('{"X-Mock": 204}')
841
+ def test_contactdb_recipients__recipient_id__delete
842
+ recipient_id = 'test_url_param'
843
+ headers = JSON.parse('{"X-Mock": 204}')
843
844
 
844
- response = @sg.client.contactdb.recipients._(recipient_id).delete(request_headers: headers)
845
+ response = @sg.client.contactdb.recipients._(recipient_id).delete(request_headers: headers)
845
846
 
846
- self.assert_equal('204', response.status_code)
847
- end
847
+ assert_equal('204', response.status_code)
848
+ end
848
849
 
849
- def test_contactdb_recipients__recipient_id__lists_get
850
- recipient_id = "test_url_param"
851
- headers = JSON.parse('{"X-Mock": 200}')
850
+ def test_contactdb_recipients__recipient_id__lists_get
851
+ recipient_id = 'test_url_param'
852
+ headers = JSON.parse('{"X-Mock": 200}')
852
853
 
853
- response = @sg.client.contactdb.recipients._(recipient_id).lists.get(request_headers: headers)
854
+ response = @sg.client.contactdb.recipients._(recipient_id).lists.get(request_headers: headers)
854
855
 
855
- self.assert_equal('200', response.status_code)
856
- end
856
+ assert_equal('200', response.status_code)
857
+ end
857
858
 
858
- def test_contactdb_reserved_fields_get
859
- headers = JSON.parse('{"X-Mock": 200}')
859
+ def test_contactdb_reserved_fields_get
860
+ headers = JSON.parse('{"X-Mock": 200}')
860
861
 
861
- response = @sg.client.contactdb.reserved_fields.get(request_headers: headers)
862
+ response = @sg.client.contactdb.reserved_fields.get(request_headers: headers)
862
863
 
863
- self.assert_equal('200', response.status_code)
864
- end
864
+ assert_equal('200', response.status_code)
865
+ end
865
866
 
866
- def test_contactdb_segments_post
867
- data = JSON.parse('{
868
- "conditions": [
869
- {
870
- "and_or": "",
871
- "field": "last_name",
872
- "operator": "eq",
873
- "value": "Miller"
874
- },
875
- {
876
- "and_or": "and",
877
- "field": "last_clicked",
878
- "operator": "gt",
879
- "value": "01/02/2015"
880
- },
881
- {
882
- "and_or": "or",
883
- "field": "clicks.campaign_identifier",
884
- "operator": "eq",
885
- "value": "513"
886
- }
887
- ],
888
- "list_id": 4,
889
- "name": "Last Name Miller"
867
+ def test_contactdb_segments_post
868
+ data = JSON.parse('{
869
+ "conditions": [
870
+ {
871
+ "and_or": "",
872
+ "field": "last_name",
873
+ "operator": "eq",
874
+ "value": "Miller"
875
+ },
876
+ {
877
+ "and_or": "and",
878
+ "field": "last_clicked",
879
+ "operator": "gt",
880
+ "value": "01/02/2015"
881
+ },
882
+ {
883
+ "and_or": "or",
884
+ "field": "clicks.campaign_identifier",
885
+ "operator": "eq",
886
+ "value": "513"
887
+ }
888
+ ],
889
+ "list_id": 4,
890
+ "name": "Last Name Miller"
890
891
  }')
891
- headers = JSON.parse('{"X-Mock": 200}')
892
+ headers = JSON.parse('{"X-Mock": 200}')
892
893
 
893
- response = @sg.client.contactdb.segments.post(request_body: data, request_headers: headers)
894
+ response = @sg.client.contactdb.segments.post(request_body: data, request_headers: headers)
894
895
 
895
- self.assert_equal('200', response.status_code)
896
- end
896
+ assert_equal('200', response.status_code)
897
+ end
897
898
 
898
- def test_contactdb_segments_get
899
- headers = JSON.parse('{"X-Mock": 200}')
899
+ def test_contactdb_segments_get
900
+ headers = JSON.parse('{"X-Mock": 200}')
900
901
 
901
- response = @sg.client.contactdb.segments.get(request_headers: headers)
902
+ response = @sg.client.contactdb.segments.get(request_headers: headers)
902
903
 
903
- self.assert_equal('200', response.status_code)
904
- end
904
+ assert_equal('200', response.status_code)
905
+ end
905
906
 
906
- def test_contactdb_segments__segment_id__patch
907
- data = JSON.parse('{
908
- "conditions": [
909
- {
910
- "and_or": "",
911
- "field": "last_name",
912
- "operator": "eq",
913
- "value": "Miller"
914
- }
915
- ],
916
- "list_id": 5,
917
- "name": "The Millers"
907
+ def test_contactdb_segments__segment_id__patch
908
+ data = JSON.parse('{
909
+ "conditions": [
910
+ {
911
+ "and_or": "",
912
+ "field": "last_name",
913
+ "operator": "eq",
914
+ "value": "Miller"
915
+ }
916
+ ],
917
+ "list_id": 5,
918
+ "name": "The Millers"
918
919
  }')
919
- params = JSON.parse('{"segment_id": "test_string"}')
920
- segment_id = "test_url_param"
921
- headers = JSON.parse('{"X-Mock": 200}')
920
+ params = JSON.parse('{"segment_id": "test_string"}')
921
+ segment_id = 'test_url_param'
922
+ headers = JSON.parse('{"X-Mock": 200}')
922
923
 
923
- response = @sg.client.contactdb.segments._(segment_id).patch(request_body: data, query_params: params, request_headers: headers)
924
+ response = @sg.client.contactdb.segments._(segment_id).patch(request_body: data, query_params: params, request_headers: headers)
924
925
 
925
- self.assert_equal('200', response.status_code)
926
- end
926
+ assert_equal('200', response.status_code)
927
+ end
927
928
 
928
- def test_contactdb_segments__segment_id__get
929
- params = JSON.parse('{"segment_id": 1}')
930
- segment_id = "test_url_param"
931
- headers = JSON.parse('{"X-Mock": 200}')
929
+ def test_contactdb_segments__segment_id__get
930
+ params = JSON.parse('{"segment_id": 1}')
931
+ segment_id = 'test_url_param'
932
+ headers = JSON.parse('{"X-Mock": 200}')
932
933
 
933
- response = @sg.client.contactdb.segments._(segment_id).get(query_params: params, request_headers: headers)
934
+ response = @sg.client.contactdb.segments._(segment_id).get(query_params: params, request_headers: headers)
934
935
 
935
- self.assert_equal('200', response.status_code)
936
- end
936
+ assert_equal('200', response.status_code)
937
+ end
937
938
 
938
- def test_contactdb_segments__segment_id__delete
939
- params = JSON.parse('{"delete_contacts": "true"}')
940
- segment_id = "test_url_param"
941
- headers = JSON.parse('{"X-Mock": 204}')
939
+ def test_contactdb_segments__segment_id__delete
940
+ params = JSON.parse('{"delete_contacts": "true"}')
941
+ segment_id = 'test_url_param'
942
+ headers = JSON.parse('{"X-Mock": 204}')
942
943
 
943
- response = @sg.client.contactdb.segments._(segment_id).delete(query_params: params, request_headers: headers)
944
+ response = @sg.client.contactdb.segments._(segment_id).delete(query_params: params, request_headers: headers)
944
945
 
945
- self.assert_equal('204', response.status_code)
946
- end
946
+ assert_equal('204', response.status_code)
947
+ end
947
948
 
948
- def test_contactdb_segments__segment_id__recipients_get
949
- params = JSON.parse('{"page": 1, "page_size": 1}')
950
- segment_id = "test_url_param"
951
- headers = JSON.parse('{"X-Mock": 200}')
949
+ def test_contactdb_segments__segment_id__recipients_get
950
+ params = JSON.parse('{"page": 1, "page_size": 1}')
951
+ segment_id = 'test_url_param'
952
+ headers = JSON.parse('{"X-Mock": 200}')
952
953
 
953
- response = @sg.client.contactdb.segments._(segment_id).recipients.get(query_params: params, request_headers: headers)
954
+ response = @sg.client.contactdb.segments._(segment_id).recipients.get(query_params: params, request_headers: headers)
954
955
 
955
- self.assert_equal('200', response.status_code)
956
- end
956
+ assert_equal('200', response.status_code)
957
+ end
957
958
 
958
- def test_devices_stats_get
959
- params = JSON.parse('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}')
960
- headers = JSON.parse('{"X-Mock": 200}')
959
+ def test_devices_stats_get
960
+ params = JSON.parse('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}')
961
+ headers = JSON.parse('{"X-Mock": 200}')
961
962
 
962
- response = @sg.client.devices.stats.get(query_params: params, request_headers: headers)
963
+ response = @sg.client.devices.stats.get(query_params: params, request_headers: headers)
963
964
 
964
- self.assert_equal('200', response.status_code)
965
- end
965
+ assert_equal('200', response.status_code)
966
+ end
966
967
 
967
- def test_geo_stats_get
968
- params = JSON.parse('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}')
969
- headers = JSON.parse('{"X-Mock": 200}')
968
+ def test_geo_stats_get
969
+ params = JSON.parse('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}')
970
+ headers = JSON.parse('{"X-Mock": 200}')
970
971
 
971
- response = @sg.client.geo.stats.get(query_params: params, request_headers: headers)
972
+ response = @sg.client.geo.stats.get(query_params: params, request_headers: headers)
972
973
 
973
- self.assert_equal('200', response.status_code)
974
- end
974
+ assert_equal('200', response.status_code)
975
+ end
975
976
 
976
- def test_ips_get
977
- params = JSON.parse('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}')
978
- headers = JSON.parse('{"X-Mock": 200}')
977
+ def test_ips_get
978
+ params = JSON.parse('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}')
979
+ headers = JSON.parse('{"X-Mock": 200}')
979
980
 
980
- response = @sg.client.ips.get(query_params: params, request_headers: headers)
981
+ response = @sg.client.ips.get(query_params: params, request_headers: headers)
981
982
 
982
- self.assert_equal('200', response.status_code)
983
- end
983
+ assert_equal('200', response.status_code)
984
+ end
984
985
 
985
- def test_ips_assigned_get
986
- headers = JSON.parse('{"X-Mock": 200}')
986
+ def test_ips_assigned_get
987
+ headers = JSON.parse('{"X-Mock": 200}')
987
988
 
988
- response = @sg.client.ips.assigned.get(request_headers: headers)
989
+ response = @sg.client.ips.assigned.get(request_headers: headers)
989
990
 
990
- self.assert_equal('200', response.status_code)
991
- end
991
+ assert_equal('200', response.status_code)
992
+ end
992
993
 
993
- def test_ips_pools_post
994
- data = JSON.parse('{
995
- "name": "marketing"
994
+ def test_ips_pools_post
995
+ data = JSON.parse('{
996
+ "name": "marketing"
996
997
  }')
997
- headers = JSON.parse('{"X-Mock": 200}')
998
+ headers = JSON.parse('{"X-Mock": 200}')
998
999
 
999
- response = @sg.client.ips.pools.post(request_body: data, request_headers: headers)
1000
+ response = @sg.client.ips.pools.post(request_body: data, request_headers: headers)
1000
1001
 
1001
- self.assert_equal('200', response.status_code)
1002
- end
1002
+ assert_equal('200', response.status_code)
1003
+ end
1003
1004
 
1004
- def test_ips_pools_get
1005
- headers = JSON.parse('{"X-Mock": 200}')
1005
+ def test_ips_pools_get
1006
+ headers = JSON.parse('{"X-Mock": 200}')
1006
1007
 
1007
- response = @sg.client.ips.pools.get(request_headers: headers)
1008
+ response = @sg.client.ips.pools.get(request_headers: headers)
1008
1009
 
1009
- self.assert_equal('200', response.status_code)
1010
- end
1010
+ assert_equal('200', response.status_code)
1011
+ end
1011
1012
 
1012
- def test_ips_pools__pool_name__put
1013
- data = JSON.parse('{
1014
- "name": "new_pool_name"
1013
+ def test_ips_pools__pool_name__put
1014
+ data = JSON.parse('{
1015
+ "name": "new_pool_name"
1015
1016
  }')
1016
- pool_name = "test_url_param"
1017
- headers = JSON.parse('{"X-Mock": 200}')
1017
+ pool_name = 'test_url_param'
1018
+ headers = JSON.parse('{"X-Mock": 200}')
1018
1019
 
1019
- response = @sg.client.ips.pools._(pool_name).put(request_body: data, request_headers: headers)
1020
+ response = @sg.client.ips.pools._(pool_name).put(request_body: data, request_headers: headers)
1020
1021
 
1021
- self.assert_equal('200', response.status_code)
1022
- end
1022
+ assert_equal('200', response.status_code)
1023
+ end
1023
1024
 
1024
- def test_ips_pools__pool_name__get
1025
- pool_name = "test_url_param"
1026
- headers = JSON.parse('{"X-Mock": 200}')
1025
+ def test_ips_pools__pool_name__get
1026
+ pool_name = 'test_url_param'
1027
+ headers = JSON.parse('{"X-Mock": 200}')
1027
1028
 
1028
- response = @sg.client.ips.pools._(pool_name).get(request_headers: headers)
1029
+ response = @sg.client.ips.pools._(pool_name).get(request_headers: headers)
1029
1030
 
1030
- self.assert_equal('200', response.status_code)
1031
- end
1031
+ assert_equal('200', response.status_code)
1032
+ end
1032
1033
 
1033
- def test_ips_pools__pool_name__delete
1034
- pool_name = "test_url_param"
1035
- headers = JSON.parse('{"X-Mock": 204}')
1034
+ def test_ips_pools__pool_name__delete
1035
+ pool_name = 'test_url_param'
1036
+ headers = JSON.parse('{"X-Mock": 204}')
1036
1037
 
1037
- response = @sg.client.ips.pools._(pool_name).delete(request_headers: headers)
1038
+ response = @sg.client.ips.pools._(pool_name).delete(request_headers: headers)
1038
1039
 
1039
- self.assert_equal('204', response.status_code)
1040
- end
1040
+ assert_equal('204', response.status_code)
1041
+ end
1041
1042
 
1042
- def test_ips_pools__pool_name__ips_post
1043
- data = JSON.parse('{
1044
- "ip": "0.0.0.0"
1043
+ def test_ips_pools__pool_name__ips_post
1044
+ data = JSON.parse('{
1045
+ "ip": "0.0.0.0"
1045
1046
  }')
1046
- pool_name = "test_url_param"
1047
- headers = JSON.parse('{"X-Mock": 201}')
1047
+ pool_name = 'test_url_param'
1048
+ headers = JSON.parse('{"X-Mock": 201}')
1048
1049
 
1049
- response = @sg.client.ips.pools._(pool_name).ips.post(request_body: data, request_headers: headers)
1050
+ response = @sg.client.ips.pools._(pool_name).ips.post(request_body: data, request_headers: headers)
1050
1051
 
1051
- self.assert_equal('201', response.status_code)
1052
- end
1052
+ assert_equal('201', response.status_code)
1053
+ end
1053
1054
 
1054
- def test_ips_pools__pool_name__ips__ip__delete
1055
- pool_name = "test_url_param"
1056
- ip = "test_url_param"
1057
- headers = JSON.parse('{"X-Mock": 204}')
1055
+ def test_ips_pools__pool_name__ips__ip__delete
1056
+ pool_name = 'test_url_param'
1057
+ ip = 'test_url_param'
1058
+ headers = JSON.parse('{"X-Mock": 204}')
1058
1059
 
1059
- response = @sg.client.ips.pools._(pool_name).ips._(ip).delete(request_headers: headers)
1060
+ response = @sg.client.ips.pools._(pool_name).ips._(ip).delete(request_headers: headers)
1060
1061
 
1061
- self.assert_equal('204', response.status_code)
1062
- end
1062
+ assert_equal('204', response.status_code)
1063
+ end
1063
1064
 
1064
- def test_ips_warmup_post
1065
- data = JSON.parse('{
1066
- "ip": "0.0.0.0"
1065
+ def test_ips_warmup_post
1066
+ data = JSON.parse('{
1067
+ "ip": "0.0.0.0"
1067
1068
  }')
1068
- headers = JSON.parse('{"X-Mock": 200}')
1069
+ headers = JSON.parse('{"X-Mock": 200}')
1069
1070
 
1070
- response = @sg.client.ips.warmup.post(request_body: data, request_headers: headers)
1071
+ response = @sg.client.ips.warmup.post(request_body: data, request_headers: headers)
1071
1072
 
1072
- self.assert_equal('200', response.status_code)
1073
- end
1073
+ assert_equal('200', response.status_code)
1074
+ end
1074
1075
 
1075
- def test_ips_warmup_get
1076
- headers = JSON.parse('{"X-Mock": 200}')
1076
+ def test_ips_warmup_get
1077
+ headers = JSON.parse('{"X-Mock": 200}')
1077
1078
 
1078
- response = @sg.client.ips.warmup.get(request_headers: headers)
1079
+ response = @sg.client.ips.warmup.get(request_headers: headers)
1079
1080
 
1080
- self.assert_equal('200', response.status_code)
1081
- end
1081
+ assert_equal('200', response.status_code)
1082
+ end
1082
1083
 
1083
- def test_ips_warmup__ip_address__get
1084
- ip_address = "test_url_param"
1085
- headers = JSON.parse('{"X-Mock": 200}')
1084
+ def test_ips_warmup__ip_address__get
1085
+ ip_address = 'test_url_param'
1086
+ headers = JSON.parse('{"X-Mock": 200}')
1086
1087
 
1087
- response = @sg.client.ips.warmup._(ip_address).get(request_headers: headers)
1088
+ response = @sg.client.ips.warmup._(ip_address).get(request_headers: headers)
1088
1089
 
1089
- self.assert_equal('200', response.status_code)
1090
- end
1090
+ assert_equal('200', response.status_code)
1091
+ end
1091
1092
 
1092
- def test_ips_warmup__ip_address__delete
1093
- ip_address = "test_url_param"
1094
- headers = JSON.parse('{"X-Mock": 204}')
1093
+ def test_ips_warmup__ip_address__delete
1094
+ ip_address = 'test_url_param'
1095
+ headers = JSON.parse('{"X-Mock": 204}')
1095
1096
 
1096
- response = @sg.client.ips.warmup._(ip_address).delete(request_headers: headers)
1097
+ response = @sg.client.ips.warmup._(ip_address).delete(request_headers: headers)
1097
1098
 
1098
- self.assert_equal('204', response.status_code)
1099
- end
1099
+ assert_equal('204', response.status_code)
1100
+ end
1100
1101
 
1101
- def test_ips__ip_address__get
1102
- ip_address = "test_url_param"
1103
- headers = JSON.parse('{"X-Mock": 200}')
1102
+ def test_ips__ip_address__get
1103
+ ip_address = 'test_url_param'
1104
+ headers = JSON.parse('{"X-Mock": 200}')
1104
1105
 
1105
- response = @sg.client.ips._(ip_address).get(request_headers: headers)
1106
+ response = @sg.client.ips._(ip_address).get(request_headers: headers)
1106
1107
 
1107
- self.assert_equal('200', response.status_code)
1108
- end
1108
+ assert_equal('200', response.status_code)
1109
+ end
1109
1110
 
1110
- def test_mail_batch_post
1111
- headers = JSON.parse('{"X-Mock": 201}')
1111
+ def test_mail_batch_post
1112
+ headers = JSON.parse('{"X-Mock": 201}')
1112
1113
 
1113
- response = @sg.client.mail.batch.post(request_headers: headers)
1114
+ response = @sg.client.mail.batch.post(request_headers: headers)
1114
1115
 
1115
- self.assert_equal('201', response.status_code)
1116
- end
1116
+ assert_equal('201', response.status_code)
1117
+ end
1117
1118
 
1118
- def test_mail_batch__batch_id__get
1119
- batch_id = "test_url_param"
1120
- headers = JSON.parse('{"X-Mock": 200}')
1119
+ def test_mail_batch__batch_id__get
1120
+ batch_id = 'test_url_param'
1121
+ headers = JSON.parse('{"X-Mock": 200}')
1121
1122
 
1122
- response = @sg.client.mail.batch._(batch_id).get(request_headers: headers)
1123
+ response = @sg.client.mail.batch._(batch_id).get(request_headers: headers)
1123
1124
 
1124
- self.assert_equal('200', response.status_code)
1125
- end
1125
+ assert_equal('200', response.status_code)
1126
+ end
1126
1127
 
1127
- def test_mail_send_post
1128
- data = JSON.parse('{
1129
- "asm": {
1130
- "group_id": 1,
1131
- "groups_to_display": [
1132
- 1,
1133
- 2,
1134
- 3
1135
- ]
1136
- },
1137
- "attachments": [
1128
+ def test_mail_send_post
1129
+ data = JSON.parse('{
1130
+ "asm": {
1131
+ "group_id": 1,
1132
+ "groups_to_display": [
1133
+ 1,
1134
+ 2,
1135
+ 3
1136
+ ]
1137
+ },
1138
+ "attachments": [
1139
+ {
1140
+ "content": "[BASE64 encoded content block here]",
1141
+ "content_id": "ii_139db99fdb5c3704",
1142
+ "disposition": "inline",
1143
+ "filename": "file1.jpg",
1144
+ "name": "file1",
1145
+ "type": "jpg"
1146
+ }
1147
+ ],
1148
+ "batch_id": "[YOUR BATCH ID GOES HERE]",
1149
+ "categories": [
1150
+ "category1",
1151
+ "category2"
1152
+ ],
1153
+ "content": [
1154
+ {
1155
+ "type": "text/html",
1156
+ "value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>"
1157
+ }
1158
+ ],
1159
+ "custom_args": {
1160
+ "New Argument 1": "New Value 1",
1161
+ "activationAttempt": "1",
1162
+ "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
1163
+ },
1164
+ "from": {
1165
+ "email": "sam.smith@example.com",
1166
+ "name": "Sam Smith"
1167
+ },
1168
+ "headers": {},
1169
+ "ip_pool_name": "[YOUR POOL NAME GOES HERE]",
1170
+ "mail_settings": {
1171
+ "bcc": {
1172
+ "email": "ben.doe@example.com",
1173
+ "enable": true
1174
+ },
1175
+ "bypass_list_management": {
1176
+ "enable": true
1177
+ },
1178
+ "footer": {
1179
+ "enable": true,
1180
+ "html": "<p>Thanks</br>The SendGrid Team</p>",
1181
+ "text": "Thanks,/n The SendGrid Team"
1182
+ },
1183
+ "sandbox_mode": {
1184
+ "enable": false
1185
+ },
1186
+ "spam_check": {
1187
+ "enable": true,
1188
+ "post_to_url": "http://example.com/compliance",
1189
+ "threshold": 3
1190
+ }
1191
+ },
1192
+ "personalizations": [
1193
+ {
1194
+ "bcc": [
1138
1195
  {
1139
- "content": "[BASE64 encoded content block here]",
1140
- "content_id": "ii_139db99fdb5c3704",
1141
- "disposition": "inline",
1142
- "filename": "file1.jpg",
1143
- "name": "file1",
1144
- "type": "jpg"
1196
+ "email": "sam.doe@example.com",
1197
+ "name": "Sam Doe"
1145
1198
  }
1146
1199
  ],
1147
- "batch_id": "[YOUR BATCH ID GOES HERE]",
1148
- "categories": [
1149
- "category1",
1150
- "category2"
1151
- ],
1152
- "content": [
1200
+ "cc": [
1153
1201
  {
1154
- "type": "text/html",
1155
- "value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>"
1202
+ "email": "jane.doe@example.com",
1203
+ "name": "Jane Doe"
1156
1204
  }
1157
1205
  ],
1158
1206
  "custom_args": {
@@ -1160,1584 +1208,1518 @@ class TestAPI < MiniTest::Test
1160
1208
  "activationAttempt": "1",
1161
1209
  "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
1162
1210
  },
1163
- "from": {
1164
- "email": "sam.smith@example.com",
1165
- "name": "Sam Smith"
1166
- },
1167
- "headers": {},
1168
- "ip_pool_name": "[YOUR POOL NAME GOES HERE]",
1169
- "mail_settings": {
1170
- "bcc": {
1171
- "email": "ben.doe@example.com",
1172
- "enable": true
1173
- },
1174
- "bypass_list_management": {
1175
- "enable": true
1176
- },
1177
- "footer": {
1178
- "enable": true,
1179
- "html": "<p>Thanks</br>The SendGrid Team</p>",
1180
- "text": "Thanks,/n The SendGrid Team"
1181
- },
1182
- "sandbox_mode": {
1183
- "enable": false
1184
- },
1185
- "spam_check": {
1186
- "enable": true,
1187
- "post_to_url": "http://example.com/compliance",
1188
- "threshold": 3
1189
- }
1190
- },
1191
- "personalizations": [
1192
- {
1193
- "bcc": [
1194
- {
1195
- "email": "sam.doe@example.com",
1196
- "name": "Sam Doe"
1197
- }
1198
- ],
1199
- "cc": [
1200
- {
1201
- "email": "jane.doe@example.com",
1202
- "name": "Jane Doe"
1203
- }
1204
- ],
1205
- "custom_args": {
1206
- "New Argument 1": "New Value 1",
1207
- "activationAttempt": "1",
1208
- "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
1209
- },
1210
- "headers": {
1211
- "X-Accept-Language": "en",
1212
- "X-Mailer": "MyApp"
1213
- },
1214
- "send_at": 1409348513,
1215
- "subject": "Hello, World!",
1216
- "substitutions": {
1217
- "id": "substitutions",
1218
- "type": "object"
1219
- },
1220
- "to": [
1221
- {
1222
- "email": "john.doe@example.com",
1223
- "name": "John Doe"
1224
- }
1225
- ]
1226
- }
1227
- ],
1228
- "reply_to": {
1229
- "email": "sam.smith@example.com",
1230
- "name": "Sam Smith"
1231
- },
1232
- "sections": {
1233
- "section": {
1234
- ":sectionName1": "section 1 text",
1235
- ":sectionName2": "section 2 text"
1236
- }
1211
+ "headers": {
1212
+ "X-Accept-Language": "en",
1213
+ "X-Mailer": "MyApp"
1237
1214
  },
1238
1215
  "send_at": 1409348513,
1239
1216
  "subject": "Hello, World!",
1240
- "template_id": "[YOUR TEMPLATE ID GOES HERE]",
1241
- "tracking_settings": {
1242
- "click_tracking": {
1243
- "enable": true,
1244
- "enable_text": true
1245
- },
1246
- "ganalytics": {
1247
- "enable": true,
1248
- "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]",
1249
- "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]",
1250
- "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]",
1251
- "utm_name": "[NAME OF YOUR CAMPAIGN]",
1252
- "utm_term": "[IDENTIFY PAID KEYWORDS HERE]"
1253
- },
1254
- "open_tracking": {
1255
- "enable": true,
1256
- "substitution_tag": "%opentrack"
1257
- },
1258
- "subscription_tracking": {
1259
- "enable": true,
1260
- "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.",
1261
- "substitution_tag": "<%click here%>",
1262
- "text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>."
1217
+ "substitutions": {
1218
+ "id": "substitutions",
1219
+ "type": "object"
1220
+ },
1221
+ "to": [
1222
+ {
1223
+ "email": "john.doe@example.com",
1224
+ "name": "John Doe"
1263
1225
  }
1264
- }
1265
- }')
1266
- headers = JSON.parse('{"X-Mock": 202}')
1267
-
1268
- response = @sg.client.mail._("send").post(request_body: data, request_headers: headers)
1226
+ ]
1227
+ }
1228
+ ],
1229
+ "reply_to": {
1230
+ "email": "sam.smith@example.com",
1231
+ "name": "Sam Smith"
1232
+ },
1233
+ "sections": {
1234
+ "section": {
1235
+ ":sectionName1": "section 1 text",
1236
+ ":sectionName2": "section 2 text"
1237
+ }
1238
+ },
1239
+ "send_at": 1409348513,
1240
+ "subject": "Hello, World!",
1241
+ "template_id": "[YOUR TEMPLATE ID GOES HERE]",
1242
+ "tracking_settings": {
1243
+ "click_tracking": {
1244
+ "enable": true,
1245
+ "enable_text": true
1246
+ },
1247
+ "ganalytics": {
1248
+ "enable": true,
1249
+ "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]",
1250
+ "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]",
1251
+ "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]",
1252
+ "utm_name": "[NAME OF YOUR CAMPAIGN]",
1253
+ "utm_term": "[IDENTIFY PAID KEYWORDS HERE]"
1254
+ },
1255
+ "open_tracking": {
1256
+ "enable": true,
1257
+ "substitution_tag": "%opentrack"
1258
+ },
1259
+ "subscription_tracking": {
1260
+ "enable": true,
1261
+ "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.",
1262
+ "substitution_tag": "<%click here%>",
1263
+ "text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>."
1264
+ }
1265
+ }
1266
+ }')
1267
+ headers = JSON.parse('{"X-Mock": 202}')
1269
1268
 
1270
- self.assert_equal('202', response.status_code)
1271
- end
1269
+ response = @sg.client.mail._('send').post(request_body: data, request_headers: headers)
1270
+
1271
+ assert_equal('202', response.status_code)
1272
+ end
1272
1273
 
1273
- def test_mail_settings_get
1274
- params = JSON.parse('{"limit": 1, "offset": 1}')
1275
- headers = JSON.parse('{"X-Mock": 200}')
1274
+ def test_mail_settings_get
1275
+ params = JSON.parse('{"limit": 1, "offset": 1}')
1276
+ headers = JSON.parse('{"X-Mock": 200}')
1276
1277
 
1277
- response = @sg.client.mail_settings.get(query_params: params, request_headers: headers)
1278
+ response = @sg.client.mail_settings.get(query_params: params, request_headers: headers)
1278
1279
 
1279
- self.assert_equal('200', response.status_code)
1280
- end
1280
+ assert_equal('200', response.status_code)
1281
+ end
1281
1282
 
1282
- def test_mail_settings_address_whitelist_patch
1283
- data = JSON.parse('{
1284
- "enabled": true,
1285
- "list": [
1286
- "email1@example.com",
1287
- "example.com"
1288
- ]
1283
+ def test_mail_settings_address_whitelist_patch
1284
+ data = JSON.parse('{
1285
+ "enabled": true,
1286
+ "list": [
1287
+ "email1@example.com",
1288
+ "example.com"
1289
+ ]
1289
1290
  }')
1290
- headers = JSON.parse('{"X-Mock": 200}')
1291
+ headers = JSON.parse('{"X-Mock": 200}')
1291
1292
 
1292
- response = @sg.client.mail_settings.address_whitelist.patch(request_body: data, request_headers: headers)
1293
+ response = @sg.client.mail_settings.address_whitelist.patch(request_body: data, request_headers: headers)
1293
1294
 
1294
- self.assert_equal('200', response.status_code)
1295
- end
1295
+ assert_equal('200', response.status_code)
1296
+ end
1296
1297
 
1297
- def test_mail_settings_address_whitelist_get
1298
- headers = JSON.parse('{"X-Mock": 200}')
1298
+ def test_mail_settings_address_whitelist_get
1299
+ headers = JSON.parse('{"X-Mock": 200}')
1299
1300
 
1300
- response = @sg.client.mail_settings.address_whitelist.get(request_headers: headers)
1301
+ response = @sg.client.mail_settings.address_whitelist.get(request_headers: headers)
1301
1302
 
1302
- self.assert_equal('200', response.status_code)
1303
- end
1303
+ assert_equal('200', response.status_code)
1304
+ end
1304
1305
 
1305
- def test_mail_settings_bcc_patch
1306
- data = JSON.parse('{
1307
- "email": "email@example.com",
1308
- "enabled": false
1306
+ def test_mail_settings_bcc_patch
1307
+ data = JSON.parse('{
1308
+ "email": "email@example.com",
1309
+ "enabled": false
1309
1310
  }')
1310
- headers = JSON.parse('{"X-Mock": 200}')
1311
+ headers = JSON.parse('{"X-Mock": 200}')
1311
1312
 
1312
- response = @sg.client.mail_settings.bcc.patch(request_body: data, request_headers: headers)
1313
+ response = @sg.client.mail_settings.bcc.patch(request_body: data, request_headers: headers)
1313
1314
 
1314
- self.assert_equal('200', response.status_code)
1315
- end
1315
+ assert_equal('200', response.status_code)
1316
+ end
1316
1317
 
1317
- def test_mail_settings_bcc_get
1318
- headers = JSON.parse('{"X-Mock": 200}')
1318
+ def test_mail_settings_bcc_get
1319
+ headers = JSON.parse('{"X-Mock": 200}')
1319
1320
 
1320
- response = @sg.client.mail_settings.bcc.get(request_headers: headers)
1321
+ response = @sg.client.mail_settings.bcc.get(request_headers: headers)
1321
1322
 
1322
- self.assert_equal('200', response.status_code)
1323
- end
1323
+ assert_equal('200', response.status_code)
1324
+ end
1324
1325
 
1325
- def test_mail_settings_bounce_purge_patch
1326
- data = JSON.parse('{
1327
- "enabled": true,
1328
- "hard_bounces": 5,
1329
- "soft_bounces": 5
1326
+ def test_mail_settings_bounce_purge_patch
1327
+ data = JSON.parse('{
1328
+ "enabled": true,
1329
+ "hard_bounces": 5,
1330
+ "soft_bounces": 5
1330
1331
  }')
1331
- headers = JSON.parse('{"X-Mock": 200}')
1332
+ headers = JSON.parse('{"X-Mock": 200}')
1332
1333
 
1333
- response = @sg.client.mail_settings.bounce_purge.patch(request_body: data, request_headers: headers)
1334
+ response = @sg.client.mail_settings.bounce_purge.patch(request_body: data, request_headers: headers)
1334
1335
 
1335
- self.assert_equal('200', response.status_code)
1336
- end
1336
+ assert_equal('200', response.status_code)
1337
+ end
1337
1338
 
1338
- def test_mail_settings_bounce_purge_get
1339
- headers = JSON.parse('{"X-Mock": 200}')
1339
+ def test_mail_settings_bounce_purge_get
1340
+ headers = JSON.parse('{"X-Mock": 200}')
1340
1341
 
1341
- response = @sg.client.mail_settings.bounce_purge.get(request_headers: headers)
1342
+ response = @sg.client.mail_settings.bounce_purge.get(request_headers: headers)
1342
1343
 
1343
- self.assert_equal('200', response.status_code)
1344
- end
1344
+ assert_equal('200', response.status_code)
1345
+ end
1345
1346
 
1346
- def test_mail_settings_footer_patch
1347
- data = JSON.parse('{
1348
- "enabled": true,
1349
- "html_content": "...",
1350
- "plain_content": "..."
1347
+ def test_mail_settings_footer_patch
1348
+ data = JSON.parse('{
1349
+ "enabled": true,
1350
+ "html_content": "...",
1351
+ "plain_content": "..."
1351
1352
  }')
1352
- headers = JSON.parse('{"X-Mock": 200}')
1353
+ headers = JSON.parse('{"X-Mock": 200}')
1353
1354
 
1354
- response = @sg.client.mail_settings.footer.patch(request_body: data, request_headers: headers)
1355
+ response = @sg.client.mail_settings.footer.patch(request_body: data, request_headers: headers)
1355
1356
 
1356
- self.assert_equal('200', response.status_code)
1357
- end
1357
+ assert_equal('200', response.status_code)
1358
+ end
1358
1359
 
1359
- def test_mail_settings_footer_get
1360
- headers = JSON.parse('{"X-Mock": 200}')
1360
+ def test_mail_settings_footer_get
1361
+ headers = JSON.parse('{"X-Mock": 200}')
1361
1362
 
1362
- response = @sg.client.mail_settings.footer.get(request_headers: headers)
1363
+ response = @sg.client.mail_settings.footer.get(request_headers: headers)
1363
1364
 
1364
- self.assert_equal('200', response.status_code)
1365
- end
1365
+ assert_equal('200', response.status_code)
1366
+ end
1366
1367
 
1367
- def test_mail_settings_forward_bounce_patch
1368
- data = JSON.parse('{
1369
- "email": "example@example.com",
1370
- "enabled": true
1368
+ def test_mail_settings_forward_bounce_patch
1369
+ data = JSON.parse('{
1370
+ "email": "example@example.com",
1371
+ "enabled": true
1371
1372
  }')
1372
- headers = JSON.parse('{"X-Mock": 200}')
1373
+ headers = JSON.parse('{"X-Mock": 200}')
1373
1374
 
1374
- response = @sg.client.mail_settings.forward_bounce.patch(request_body: data, request_headers: headers)
1375
+ response = @sg.client.mail_settings.forward_bounce.patch(request_body: data, request_headers: headers)
1375
1376
 
1376
- self.assert_equal('200', response.status_code)
1377
- end
1377
+ assert_equal('200', response.status_code)
1378
+ end
1378
1379
 
1379
- def test_mail_settings_forward_bounce_get
1380
- headers = JSON.parse('{"X-Mock": 200}')
1380
+ def test_mail_settings_forward_bounce_get
1381
+ headers = JSON.parse('{"X-Mock": 200}')
1381
1382
 
1382
- response = @sg.client.mail_settings.forward_bounce.get(request_headers: headers)
1383
+ response = @sg.client.mail_settings.forward_bounce.get(request_headers: headers)
1383
1384
 
1384
- self.assert_equal('200', response.status_code)
1385
- end
1385
+ assert_equal('200', response.status_code)
1386
+ end
1386
1387
 
1387
- def test_mail_settings_forward_spam_patch
1388
- data = JSON.parse('{
1389
- "email": "",
1390
- "enabled": false
1388
+ def test_mail_settings_forward_spam_patch
1389
+ data = JSON.parse('{
1390
+ "email": "",
1391
+ "enabled": false
1391
1392
  }')
1392
- headers = JSON.parse('{"X-Mock": 200}')
1393
+ headers = JSON.parse('{"X-Mock": 200}')
1393
1394
 
1394
- response = @sg.client.mail_settings.forward_spam.patch(request_body: data, request_headers: headers)
1395
+ response = @sg.client.mail_settings.forward_spam.patch(request_body: data, request_headers: headers)
1395
1396
 
1396
- self.assert_equal('200', response.status_code)
1397
- end
1397
+ assert_equal('200', response.status_code)
1398
+ end
1398
1399
 
1399
- def test_mail_settings_forward_spam_get
1400
- headers = JSON.parse('{"X-Mock": 200}')
1400
+ def test_mail_settings_forward_spam_get
1401
+ headers = JSON.parse('{"X-Mock": 200}')
1401
1402
 
1402
- response = @sg.client.mail_settings.forward_spam.get(request_headers: headers)
1403
+ response = @sg.client.mail_settings.forward_spam.get(request_headers: headers)
1403
1404
 
1404
- self.assert_equal('200', response.status_code)
1405
- end
1405
+ assert_equal('200', response.status_code)
1406
+ end
1406
1407
 
1407
- def test_mail_settings_plain_content_patch
1408
- data = JSON.parse('{
1409
- "enabled": false
1408
+ def test_mail_settings_plain_content_patch
1409
+ data = JSON.parse('{
1410
+ "enabled": false
1410
1411
  }')
1411
- headers = JSON.parse('{"X-Mock": 200}')
1412
+ headers = JSON.parse('{"X-Mock": 200}')
1412
1413
 
1413
- response = @sg.client.mail_settings.plain_content.patch(request_body: data, request_headers: headers)
1414
+ response = @sg.client.mail_settings.plain_content.patch(request_body: data, request_headers: headers)
1414
1415
 
1415
- self.assert_equal('200', response.status_code)
1416
- end
1416
+ assert_equal('200', response.status_code)
1417
+ end
1417
1418
 
1418
- def test_mail_settings_plain_content_get
1419
- headers = JSON.parse('{"X-Mock": 200}')
1419
+ def test_mail_settings_plain_content_get
1420
+ headers = JSON.parse('{"X-Mock": 200}')
1420
1421
 
1421
- response = @sg.client.mail_settings.plain_content.get(request_headers: headers)
1422
+ response = @sg.client.mail_settings.plain_content.get(request_headers: headers)
1422
1423
 
1423
- self.assert_equal('200', response.status_code)
1424
- end
1424
+ assert_equal('200', response.status_code)
1425
+ end
1425
1426
 
1426
- def test_mail_settings_spam_check_patch
1427
- data = JSON.parse('{
1428
- "enabled": true,
1429
- "max_score": 5,
1430
- "url": "url"
1427
+ def test_mail_settings_spam_check_patch
1428
+ data = JSON.parse('{
1429
+ "enabled": true,
1430
+ "max_score": 5,
1431
+ "url": "url"
1431
1432
  }')
1432
- headers = JSON.parse('{"X-Mock": 200}')
1433
+ headers = JSON.parse('{"X-Mock": 200}')
1433
1434
 
1434
- response = @sg.client.mail_settings.spam_check.patch(request_body: data, request_headers: headers)
1435
+ response = @sg.client.mail_settings.spam_check.patch(request_body: data, request_headers: headers)
1435
1436
 
1436
- self.assert_equal('200', response.status_code)
1437
- end
1437
+ assert_equal('200', response.status_code)
1438
+ end
1438
1439
 
1439
- def test_mail_settings_spam_check_get
1440
- headers = JSON.parse('{"X-Mock": 200}')
1440
+ def test_mail_settings_spam_check_get
1441
+ headers = JSON.parse('{"X-Mock": 200}')
1441
1442
 
1442
- response = @sg.client.mail_settings.spam_check.get(request_headers: headers)
1443
+ response = @sg.client.mail_settings.spam_check.get(request_headers: headers)
1443
1444
 
1444
- self.assert_equal('200', response.status_code)
1445
- end
1445
+ assert_equal('200', response.status_code)
1446
+ end
1446
1447
 
1447
- def test_mail_settings_template_patch
1448
- data = JSON.parse('{
1449
- "enabled": true,
1450
- "html_content": "<% body %>"
1448
+ def test_mail_settings_template_patch
1449
+ data = JSON.parse('{
1450
+ "enabled": true,
1451
+ "html_content": "<% body %>"
1451
1452
  }')
1452
- headers = JSON.parse('{"X-Mock": 200}')
1453
+ headers = JSON.parse('{"X-Mock": 200}')
1453
1454
 
1454
- response = @sg.client.mail_settings.template.patch(request_body: data, request_headers: headers)
1455
+ response = @sg.client.mail_settings.template.patch(request_body: data, request_headers: headers)
1455
1456
 
1456
- self.assert_equal('200', response.status_code)
1457
- end
1457
+ assert_equal('200', response.status_code)
1458
+ end
1458
1459
 
1459
- def test_mail_settings_template_get
1460
- headers = JSON.parse('{"X-Mock": 200}')
1460
+ def test_mail_settings_template_get
1461
+ headers = JSON.parse('{"X-Mock": 200}')
1461
1462
 
1462
- response = @sg.client.mail_settings.template.get(request_headers: headers)
1463
+ response = @sg.client.mail_settings.template.get(request_headers: headers)
1463
1464
 
1464
- self.assert_equal('200', response.status_code)
1465
- end
1465
+ assert_equal('200', response.status_code)
1466
+ end
1466
1467
 
1467
- def test_mailbox_providers_stats_get
1468
- params = JSON.parse('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}')
1469
- headers = JSON.parse('{"X-Mock": 200}')
1468
+ def test_mailbox_providers_stats_get
1469
+ params = JSON.parse('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}')
1470
+ headers = JSON.parse('{"X-Mock": 200}')
1470
1471
 
1471
- response = @sg.client.mailbox_providers.stats.get(query_params: params, request_headers: headers)
1472
+ response = @sg.client.mailbox_providers.stats.get(query_params: params, request_headers: headers)
1472
1473
 
1473
- self.assert_equal('200', response.status_code)
1474
- end
1474
+ assert_equal('200', response.status_code)
1475
+ end
1475
1476
 
1476
- def test_partner_settings_get
1477
- params = JSON.parse('{"limit": 1, "offset": 1}')
1478
- headers = JSON.parse('{"X-Mock": 200}')
1477
+ def test_partner_settings_get
1478
+ params = JSON.parse('{"limit": 1, "offset": 1}')
1479
+ headers = JSON.parse('{"X-Mock": 200}')
1479
1480
 
1480
- response = @sg.client.partner_settings.get(query_params: params, request_headers: headers)
1481
+ response = @sg.client.partner_settings.get(query_params: params, request_headers: headers)
1481
1482
 
1482
- self.assert_equal('200', response.status_code)
1483
- end
1483
+ assert_equal('200', response.status_code)
1484
+ end
1484
1485
 
1485
- def test_partner_settings_new_relic_patch
1486
- data = JSON.parse('{
1487
- "enable_subuser_statistics": true,
1488
- "enabled": true,
1489
- "license_key": ""
1486
+ def test_partner_settings_new_relic_patch
1487
+ data = JSON.parse('{
1488
+ "enable_subuser_statistics": true,
1489
+ "enabled": true,
1490
+ "license_key": ""
1490
1491
  }')
1491
- headers = JSON.parse('{"X-Mock": 200}')
1492
+ headers = JSON.parse('{"X-Mock": 200}')
1492
1493
 
1493
- response = @sg.client.partner_settings.new_relic.patch(request_body: data, request_headers: headers)
1494
+ response = @sg.client.partner_settings.new_relic.patch(request_body: data, request_headers: headers)
1494
1495
 
1495
- self.assert_equal('200', response.status_code)
1496
- end
1496
+ assert_equal('200', response.status_code)
1497
+ end
1497
1498
 
1498
- def test_partner_settings_new_relic_get
1499
- headers = JSON.parse('{"X-Mock": 200}')
1499
+ def test_partner_settings_new_relic_get
1500
+ headers = JSON.parse('{"X-Mock": 200}')
1500
1501
 
1501
- response = @sg.client.partner_settings.new_relic.get(request_headers: headers)
1502
+ response = @sg.client.partner_settings.new_relic.get(request_headers: headers)
1502
1503
 
1503
- self.assert_equal('200', response.status_code)
1504
- end
1504
+ assert_equal('200', response.status_code)
1505
+ end
1506
+
1507
+ def test_scopes_get
1508
+ headers = JSON.parse('{"X-Mock": 200}')
1505
1509
 
1506
- def test_scopes_get
1507
- headers = JSON.parse('{"X-Mock": 200}')
1510
+ response = @sg.client.scopes.get(request_headers: headers)
1508
1511
 
1509
- response = @sg.client.scopes.get(request_headers: headers)
1512
+ assert_equal('200', response.status_code)
1513
+ end
1510
1514
 
1511
- self.assert_equal('200', response.status_code)
1512
- end
1513
-
1514
- def test_senders_post
1515
- data = JSON.parse('{
1516
- "address": "123 Elm St.",
1517
- "address_2": "Apt. 456",
1518
- "city": "Denver",
1519
- "country": "United States",
1520
- "from": {
1521
- "email": "from@example.com",
1522
- "name": "Example INC"
1523
- },
1524
- "nickname": "My Sender ID",
1525
- "reply_to": {
1526
- "email": "replyto@example.com",
1527
- "name": "Example INC"
1528
- },
1529
- "state": "Colorado",
1530
- "zip": "80202"
1531
- }')
1532
- headers = JSON.parse('{"X-Mock": 201}')
1533
- response = @sg.client.senders.post(request_body: data, request_headers: headers)
1534
- self.assert_equal(response.status_code, "201")
1535
- end
1536
-
1537
- def test_senders_get
1538
- headers = JSON.parse('{"X-Mock": 200}')
1539
- response = @sg.client.senders.get(request_headers: headers)
1540
- self.assert_equal(response.status_code, "200")
1541
- end
1542
-
1543
- def test_senders__sender_id__patch
1544
- data = JSON.parse('{
1545
- "address": "123 Elm St.",
1546
- "address_2": "Apt. 456",
1547
- "city": "Denver",
1548
- "country": "United States",
1549
- "from": {
1550
- "email": "from@example.com",
1551
- "name": "Example INC"
1552
- },
1553
- "nickname": "My Sender ID",
1554
- "reply_to": {
1555
- "email": "replyto@example.com",
1556
- "name": "Example INC"
1557
- },
1558
- "state": "Colorado",
1559
- "zip": "80202"
1560
- }')
1561
- sender_id = "test_url_param"
1562
- headers = JSON.parse('{"X-Mock": 200}')
1563
- response = @sg.client.senders._(sender_id).patch(request_body: data, request_headers: headers)
1564
- self.assert_equal(response.status_code, "200")
1565
- end
1566
-
1567
- def test_senders__sender_id__get
1568
- sender_id = "test_url_param"
1569
- headers = JSON.parse('{"X-Mock": 200}')
1570
- response = @sg.client.senders._(sender_id).get(request_headers: headers)
1571
- self.assert_equal(response.status_code, "200")
1572
- end
1573
-
1574
- def test_senders__sender_id__delete
1575
- sender_id = "test_url_param"
1576
- headers = JSON.parse('{"X-Mock": 204}')
1577
- response = @sg.client.senders._(sender_id).delete(request_headers: headers)
1578
- self.assert_equal(response.status_code, "204")
1579
- end
1580
-
1581
- def test_senders__sender_id__resend_verification_post
1582
- sender_id = "test_url_param"
1583
- headers = JSON.parse('{"X-Mock": 204}')
1584
- response = @sg.client.senders._(sender_id).resend_verification.post(request_headers: headers)
1585
- self.assert_equal(response.status_code, "204")
1586
- end
1587
-
1588
- def test_stats_get
1589
- params = JSON.parse('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}')
1590
- headers = JSON.parse('{"X-Mock": 200}')
1591
-
1592
- response = @sg.client.stats.get(query_params: params, request_headers: headers)
1593
-
1594
- self.assert_equal('200', response.status_code)
1595
- end
1596
-
1597
- def test_subusers_post
1598
- data = JSON.parse('{
1599
- "email": "John@example.com",
1600
- "ips": [
1601
- "1.1.1.1",
1602
- "2.2.2.2"
1603
- ],
1604
- "password": "johns_password",
1605
- "username": "John@example.com"
1515
+ def test_senders_post
1516
+ data = JSON.parse('{
1517
+ "address": "123 Elm St.",
1518
+ "address_2": "Apt. 456",
1519
+ "city": "Denver",
1520
+ "country": "United States",
1521
+ "from": {
1522
+ "email": "from@example.com",
1523
+ "name": "Example INC"
1524
+ },
1525
+ "nickname": "My Sender ID",
1526
+ "reply_to": {
1527
+ "email": "replyto@example.com",
1528
+ "name": "Example INC"
1529
+ },
1530
+ "state": "Colorado",
1531
+ "zip": "80202"
1606
1532
  }')
1607
- headers = JSON.parse('{"X-Mock": 200}')
1608
-
1609
- response = @sg.client.subusers.post(request_body: data, request_headers: headers)
1533
+ headers = JSON.parse('{"X-Mock": 201}')
1534
+ response = @sg.client.senders.post(request_body: data, request_headers: headers)
1535
+ assert_equal(response.status_code, '201')
1536
+ end
1537
+
1538
+ def test_senders_get
1539
+ headers = JSON.parse('{"X-Mock": 200}')
1540
+ response = @sg.client.senders.get(request_headers: headers)
1541
+ assert_equal(response.status_code, '200')
1542
+ end
1543
+
1544
+ def test_senders__sender_id__patch
1545
+ data = JSON.parse('{
1546
+ "address": "123 Elm St.",
1547
+ "address_2": "Apt. 456",
1548
+ "city": "Denver",
1549
+ "country": "United States",
1550
+ "from": {
1551
+ "email": "from@example.com",
1552
+ "name": "Example INC"
1553
+ },
1554
+ "nickname": "My Sender ID",
1555
+ "reply_to": {
1556
+ "email": "replyto@example.com",
1557
+ "name": "Example INC"
1558
+ },
1559
+ "state": "Colorado",
1560
+ "zip": "80202"
1561
+ }')
1562
+ sender_id = 'test_url_param'
1563
+ headers = JSON.parse('{"X-Mock": 200}')
1564
+ response = @sg.client.senders._(sender_id).patch(request_body: data, request_headers: headers)
1565
+ assert_equal(response.status_code, '200')
1566
+ end
1567
+
1568
+ def test_senders__sender_id__get
1569
+ sender_id = 'test_url_param'
1570
+ headers = JSON.parse('{"X-Mock": 200}')
1571
+ response = @sg.client.senders._(sender_id).get(request_headers: headers)
1572
+ assert_equal(response.status_code, '200')
1573
+ end
1574
+
1575
+ def test_senders__sender_id__delete
1576
+ sender_id = 'test_url_param'
1577
+ headers = JSON.parse('{"X-Mock": 204}')
1578
+ response = @sg.client.senders._(sender_id).delete(request_headers: headers)
1579
+ assert_equal(response.status_code, '204')
1580
+ end
1581
+
1582
+ def test_senders__sender_id__resend_verification_post
1583
+ sender_id = 'test_url_param'
1584
+ headers = JSON.parse('{"X-Mock": 204}')
1585
+ response = @sg.client.senders._(sender_id).resend_verification.post(request_headers: headers)
1586
+ assert_equal(response.status_code, '204')
1587
+ end
1588
+
1589
+ def test_stats_get
1590
+ params = JSON.parse('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}')
1591
+ headers = JSON.parse('{"X-Mock": 200}')
1592
+
1593
+ response = @sg.client.stats.get(query_params: params, request_headers: headers)
1594
+
1595
+ assert_equal('200', response.status_code)
1596
+ end
1597
+
1598
+ def test_subusers_post
1599
+ data = JSON.parse('{
1600
+ "email": "John@example.com",
1601
+ "ips": [
1602
+ "1.1.1.1",
1603
+ "2.2.2.2"
1604
+ ],
1605
+ "password": "johns_password",
1606
+ "username": "John@example.com"
1607
+ }')
1608
+ headers = JSON.parse('{"X-Mock": 200}')
1609
+
1610
+ response = @sg.client.subusers.post(request_body: data, request_headers: headers)
1611
+
1612
+ assert_equal('200', response.status_code)
1613
+ end
1614
+
1615
+ def test_subusers_get
1616
+ params = JSON.parse('{"username": "test_string", "limit": 1, "offset": 1}')
1617
+ headers = JSON.parse('{"X-Mock": 200}')
1618
+
1619
+ response = @sg.client.subusers.get(query_params: params, request_headers: headers)
1620
+
1621
+ assert_equal('200', response.status_code)
1622
+ end
1623
+
1624
+ def test_subusers_reputations_get
1625
+ params = JSON.parse('{"usernames": "test_string"}')
1626
+ headers = JSON.parse('{"X-Mock": 200}')
1627
+
1628
+ response = @sg.client.subusers.reputations.get(query_params: params, request_headers: headers)
1629
+
1630
+ assert_equal('200', response.status_code)
1631
+ end
1632
+
1633
+ def test_subusers_stats_get
1634
+ params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}')
1635
+ headers = JSON.parse('{"X-Mock": 200}')
1636
+
1637
+ response = @sg.client.subusers.stats.get(query_params: params, request_headers: headers)
1638
+
1639
+ assert_equal('200', response.status_code)
1640
+ end
1610
1641
 
1611
- self.assert_equal('200', response.status_code)
1612
- end
1642
+ def test_subusers_stats_monthly_get
1643
+ params = JSON.parse('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}')
1644
+ headers = JSON.parse('{"X-Mock": 200}')
1613
1645
 
1614
- def test_subusers_get
1615
- params = JSON.parse('{"username": "test_string", "limit": 1, "offset": 1}')
1616
- headers = JSON.parse('{"X-Mock": 200}')
1646
+ response = @sg.client.subusers.stats.monthly.get(query_params: params, request_headers: headers)
1617
1647
 
1618
- response = @sg.client.subusers.get(query_params: params, request_headers: headers)
1648
+ assert_equal('200', response.status_code)
1649
+ end
1619
1650
 
1620
- self.assert_equal('200', response.status_code)
1621
- end
1651
+ def test_subusers_stats_sums_get
1652
+ params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}')
1653
+ headers = JSON.parse('{"X-Mock": 200}')
1622
1654
 
1623
- def test_subusers_reputations_get
1624
- params = JSON.parse('{"usernames": "test_string"}')
1625
- headers = JSON.parse('{"X-Mock": 200}')
1655
+ response = @sg.client.subusers.stats.sums.get(query_params: params, request_headers: headers)
1626
1656
 
1627
- response = @sg.client.subusers.reputations.get(query_params: params, request_headers: headers)
1657
+ assert_equal('200', response.status_code)
1658
+ end
1628
1659
 
1629
- self.assert_equal('200', response.status_code)
1630
- end
1631
-
1632
- def test_subusers_stats_get
1633
- params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}')
1634
- headers = JSON.parse('{"X-Mock": 200}')
1635
-
1636
- response = @sg.client.subusers.stats.get(query_params: params, request_headers: headers)
1637
-
1638
- self.assert_equal('200', response.status_code)
1639
- end
1640
-
1641
- def test_subusers_stats_monthly_get
1642
- params = JSON.parse('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}')
1643
- headers = JSON.parse('{"X-Mock": 200}')
1644
-
1645
- response = @sg.client.subusers.stats.monthly.get(query_params: params, request_headers: headers)
1646
-
1647
- self.assert_equal('200', response.status_code)
1648
- end
1649
-
1650
- def test_subusers_stats_sums_get
1651
- params = JSON.parse('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}')
1652
- headers = JSON.parse('{"X-Mock": 200}')
1653
-
1654
- response = @sg.client.subusers.stats.sums.get(query_params: params, request_headers: headers)
1655
-
1656
- self.assert_equal('200', response.status_code)
1657
- end
1658
-
1659
- def test_subusers__subuser_name__patch
1660
- data = JSON.parse('{
1661
- "disabled": false
1660
+ def test_subusers__subuser_name__patch
1661
+ data = JSON.parse('{
1662
+ "disabled": false
1662
1663
  }')
1663
- subuser_name = "test_url_param"
1664
- headers = JSON.parse('{"X-Mock": 204}')
1664
+ subuser_name = 'test_url_param'
1665
+ headers = JSON.parse('{"X-Mock": 204}')
1665
1666
 
1666
- response = @sg.client.subusers._(subuser_name).patch(request_body: data, request_headers: headers)
1667
+ response = @sg.client.subusers._(subuser_name).patch(request_body: data, request_headers: headers)
1667
1668
 
1668
- self.assert_equal('204', response.status_code)
1669
- end
1669
+ assert_equal('204', response.status_code)
1670
+ end
1670
1671
 
1671
- def test_subusers__subuser_name__delete
1672
- subuser_name = "test_url_param"
1673
- headers = JSON.parse('{"X-Mock": 204}')
1672
+ def test_subusers__subuser_name__delete
1673
+ subuser_name = 'test_url_param'
1674
+ headers = JSON.parse('{"X-Mock": 204}')
1674
1675
 
1675
- response = @sg.client.subusers._(subuser_name).delete(request_headers: headers)
1676
+ response = @sg.client.subusers._(subuser_name).delete(request_headers: headers)
1676
1677
 
1677
- self.assert_equal('204', response.status_code)
1678
- end
1678
+ assert_equal('204', response.status_code)
1679
+ end
1679
1680
 
1680
- def test_subusers__subuser_name__ips_put
1681
- data = JSON.parse('[
1682
- "127.0.0.1"
1681
+ def test_subusers__subuser_name__ips_put
1682
+ data = JSON.parse('[
1683
+ "127.0.0.1"
1683
1684
  ]')
1684
- subuser_name = "test_url_param"
1685
- headers = JSON.parse('{"X-Mock": 200}')
1685
+ subuser_name = 'test_url_param'
1686
+ headers = JSON.parse('{"X-Mock": 200}')
1686
1687
 
1687
- response = @sg.client.subusers._(subuser_name).ips.put(request_body: data, request_headers: headers)
1688
+ response = @sg.client.subusers._(subuser_name).ips.put(request_body: data, request_headers: headers)
1688
1689
 
1689
- self.assert_equal('200', response.status_code)
1690
- end
1690
+ assert_equal('200', response.status_code)
1691
+ end
1691
1692
 
1692
- def test_subusers__subuser_name__monitor_put
1693
- data = JSON.parse('{
1694
- "email": "example@example.com",
1695
- "frequency": 500
1693
+ def test_subusers__subuser_name__monitor_put
1694
+ data = JSON.parse('{
1695
+ "email": "example@example.com",
1696
+ "frequency": 500
1696
1697
  }')
1697
- subuser_name = "test_url_param"
1698
- headers = JSON.parse('{"X-Mock": 200}')
1698
+ subuser_name = 'test_url_param'
1699
+ headers = JSON.parse('{"X-Mock": 200}')
1699
1700
 
1700
- response = @sg.client.subusers._(subuser_name).monitor.put(request_body: data, request_headers: headers)
1701
+ response = @sg.client.subusers._(subuser_name).monitor.put(request_body: data, request_headers: headers)
1701
1702
 
1702
- self.assert_equal('200', response.status_code)
1703
- end
1703
+ assert_equal('200', response.status_code)
1704
+ end
1704
1705
 
1705
- def test_subusers__subuser_name__monitor_post
1706
- data = JSON.parse('{
1707
- "email": "example@example.com",
1708
- "frequency": 50000
1706
+ def test_subusers__subuser_name__monitor_post
1707
+ data = JSON.parse('{
1708
+ "email": "example@example.com",
1709
+ "frequency": 50000
1709
1710
  }')
1710
- subuser_name = "test_url_param"
1711
- headers = JSON.parse('{"X-Mock": 200}')
1711
+ subuser_name = 'test_url_param'
1712
+ headers = JSON.parse('{"X-Mock": 200}')
1712
1713
 
1713
- response = @sg.client.subusers._(subuser_name).monitor.post(request_body: data, request_headers: headers)
1714
+ response = @sg.client.subusers._(subuser_name).monitor.post(request_body: data, request_headers: headers)
1714
1715
 
1715
- self.assert_equal('200', response.status_code)
1716
- end
1716
+ assert_equal('200', response.status_code)
1717
+ end
1717
1718
 
1718
- def test_subusers__subuser_name__monitor_get
1719
- subuser_name = "test_url_param"
1720
- headers = JSON.parse('{"X-Mock": 200}')
1719
+ def test_subusers__subuser_name__monitor_get
1720
+ subuser_name = 'test_url_param'
1721
+ headers = JSON.parse('{"X-Mock": 200}')
1721
1722
 
1722
- response = @sg.client.subusers._(subuser_name).monitor.get(request_headers: headers)
1723
+ response = @sg.client.subusers._(subuser_name).monitor.get(request_headers: headers)
1723
1724
 
1724
- self.assert_equal('200', response.status_code)
1725
- end
1725
+ assert_equal('200', response.status_code)
1726
+ end
1726
1727
 
1727
- def test_subusers__subuser_name__monitor_delete
1728
- subuser_name = "test_url_param"
1729
- headers = JSON.parse('{"X-Mock": 204}')
1728
+ def test_subusers__subuser_name__monitor_delete
1729
+ subuser_name = 'test_url_param'
1730
+ headers = JSON.parse('{"X-Mock": 204}')
1730
1731
 
1731
- response = @sg.client.subusers._(subuser_name).monitor.delete(request_headers: headers)
1732
+ response = @sg.client.subusers._(subuser_name).monitor.delete(request_headers: headers)
1732
1733
 
1733
- self.assert_equal('204', response.status_code)
1734
- end
1734
+ assert_equal('204', response.status_code)
1735
+ end
1735
1736
 
1736
- def test_subusers__subuser_name__stats_monthly_get
1737
- params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
1738
- subuser_name = "test_url_param"
1739
- headers = JSON.parse('{"X-Mock": 200}')
1737
+ def test_subusers__subuser_name__stats_monthly_get
1738
+ params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
1739
+ subuser_name = 'test_url_param'
1740
+ headers = JSON.parse('{"X-Mock": 200}')
1740
1741
 
1741
- response = @sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params, request_headers: headers)
1742
+ response = @sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params, request_headers: headers)
1742
1743
 
1743
- self.assert_equal('200', response.status_code)
1744
- end
1744
+ assert_equal('200', response.status_code)
1745
+ end
1745
1746
 
1746
- def test_suppression_blocks_get
1747
- params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1748
- headers = JSON.parse('{"X-Mock": 200}')
1747
+ def test_suppression_blocks_get
1748
+ params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1749
+ headers = JSON.parse('{"X-Mock": 200}')
1749
1750
 
1750
- response = @sg.client.suppression.blocks.get(query_params: params, request_headers: headers)
1751
+ response = @sg.client.suppression.blocks.get(query_params: params, request_headers: headers)
1751
1752
 
1752
- self.assert_equal('200', response.status_code)
1753
- end
1753
+ assert_equal('200', response.status_code)
1754
+ end
1754
1755
 
1755
- def test_suppression_blocks_delete
1756
- data = JSON.parse('{
1757
- "delete_all": false,
1758
- "emails": [
1759
- "example1@example.com",
1760
- "example2@example.com"
1761
- ]
1756
+ def test_suppression_blocks_delete
1757
+ data = JSON.parse('{
1758
+ "delete_all": false,
1759
+ "emails": [
1760
+ "example1@example.com",
1761
+ "example2@example.com"
1762
+ ]
1762
1763
  }')
1763
- headers = JSON.parse('{"X-Mock": 204}')
1764
+ headers = JSON.parse('{"X-Mock": 204}')
1764
1765
 
1765
- response = @sg.client.suppression.blocks.delete(request_body: data, request_headers: headers)
1766
+ response = @sg.client.suppression.blocks.delete(request_body: data, request_headers: headers)
1766
1767
 
1767
- self.assert_equal('204', response.status_code)
1768
- end
1768
+ assert_equal('204', response.status_code)
1769
+ end
1769
1770
 
1770
- def test_suppression_blocks__email__get
1771
- email = "test_url_param"
1772
- headers = JSON.parse('{"X-Mock": 200}')
1771
+ def test_suppression_blocks__email__get
1772
+ email = 'test_url_param'
1773
+ headers = JSON.parse('{"X-Mock": 200}')
1773
1774
 
1774
- response = @sg.client.suppression.blocks._(email).get(request_headers: headers)
1775
+ response = @sg.client.suppression.blocks._(email).get(request_headers: headers)
1775
1776
 
1776
- self.assert_equal('200', response.status_code)
1777
- end
1777
+ assert_equal('200', response.status_code)
1778
+ end
1778
1779
 
1779
- def test_suppression_blocks__email__delete
1780
- email = "test_url_param"
1781
- headers = JSON.parse('{"X-Mock": 204}')
1780
+ def test_suppression_blocks__email__delete
1781
+ email = 'test_url_param'
1782
+ headers = JSON.parse('{"X-Mock": 204}')
1782
1783
 
1783
- response = @sg.client.suppression.blocks._(email).delete(request_headers: headers)
1784
+ response = @sg.client.suppression.blocks._(email).delete(request_headers: headers)
1784
1785
 
1785
- self.assert_equal('204', response.status_code)
1786
- end
1786
+ assert_equal('204', response.status_code)
1787
+ end
1787
1788
 
1788
- def test_suppression_bounces_get
1789
- params = JSON.parse('{"start_time": 1, "end_time": 1}')
1790
- headers = JSON.parse('{"X-Mock": 200}')
1789
+ def test_suppression_bounces_get
1790
+ params = JSON.parse('{"start_time": 1, "end_time": 1}')
1791
+ headers = JSON.parse('{"X-Mock": 200}')
1791
1792
 
1792
- response = @sg.client.suppression.bounces.get(query_params: params, request_headers: headers)
1793
+ response = @sg.client.suppression.bounces.get(query_params: params, request_headers: headers)
1793
1794
 
1794
- self.assert_equal('200', response.status_code)
1795
- end
1795
+ assert_equal('200', response.status_code)
1796
+ end
1796
1797
 
1797
- def test_suppression_bounces_delete
1798
- data = JSON.parse('{
1799
- "delete_all": true,
1800
- "emails": [
1801
- "example@example.com",
1802
- "example2@example.com"
1803
- ]
1798
+ def test_suppression_bounces_delete
1799
+ data = JSON.parse('{
1800
+ "delete_all": true,
1801
+ "emails": [
1802
+ "example@example.com",
1803
+ "example2@example.com"
1804
+ ]
1804
1805
  }')
1805
- headers = JSON.parse('{"X-Mock": 204}')
1806
+ headers = JSON.parse('{"X-Mock": 204}')
1806
1807
 
1807
- response = @sg.client.suppression.bounces.delete(request_body: data, request_headers: headers)
1808
+ response = @sg.client.suppression.bounces.delete(request_body: data, request_headers: headers)
1808
1809
 
1809
- self.assert_equal('204', response.status_code)
1810
- end
1810
+ assert_equal('204', response.status_code)
1811
+ end
1811
1812
 
1812
- def test_suppression_bounces__email__get
1813
- email = "test_url_param"
1814
- headers = JSON.parse('{"X-Mock": 200}')
1813
+ def test_suppression_bounces__email__get
1814
+ email = 'test_url_param'
1815
+ headers = JSON.parse('{"X-Mock": 200}')
1815
1816
 
1816
- response = @sg.client.suppression.bounces._(email).get(request_headers: headers)
1817
+ response = @sg.client.suppression.bounces._(email).get(request_headers: headers)
1817
1818
 
1818
- self.assert_equal('200', response.status_code)
1819
- end
1819
+ assert_equal('200', response.status_code)
1820
+ end
1820
1821
 
1821
- def test_suppression_bounces__email__delete
1822
- params = JSON.parse('{"email_address": "example@example.com"}')
1823
- email = "test_url_param"
1824
- headers = JSON.parse('{"X-Mock": 204}')
1822
+ def test_suppression_bounces__email__delete
1823
+ params = JSON.parse('{"email_address": "example@example.com"}')
1824
+ email = 'test_url_param'
1825
+ headers = JSON.parse('{"X-Mock": 204}')
1825
1826
 
1826
- response = @sg.client.suppression.bounces._(email).delete(query_params: params, request_headers: headers)
1827
+ response = @sg.client.suppression.bounces._(email).delete(query_params: params, request_headers: headers)
1827
1828
 
1828
- self.assert_equal('204', response.status_code)
1829
- end
1829
+ assert_equal('204', response.status_code)
1830
+ end
1830
1831
 
1831
- def test_suppression_invalid_emails_get
1832
- params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1833
- headers = JSON.parse('{"X-Mock": 200}')
1832
+ def test_suppression_invalid_emails_get
1833
+ params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1834
+ headers = JSON.parse('{"X-Mock": 200}')
1834
1835
 
1835
- response = @sg.client.suppression.invalid_emails.get(query_params: params, request_headers: headers)
1836
+ response = @sg.client.suppression.invalid_emails.get(query_params: params, request_headers: headers)
1836
1837
 
1837
- self.assert_equal('200', response.status_code)
1838
- end
1838
+ assert_equal('200', response.status_code)
1839
+ end
1839
1840
 
1840
- def test_suppression_invalid_emails_delete
1841
- data = JSON.parse('{
1842
- "delete_all": false,
1843
- "emails": [
1844
- "example1@example.com",
1845
- "example2@example.com"
1846
- ]
1841
+ def test_suppression_invalid_emails_delete
1842
+ data = JSON.parse('{
1843
+ "delete_all": false,
1844
+ "emails": [
1845
+ "example1@example.com",
1846
+ "example2@example.com"
1847
+ ]
1847
1848
  }')
1848
- headers = JSON.parse('{"X-Mock": 204}')
1849
+ headers = JSON.parse('{"X-Mock": 204}')
1849
1850
 
1850
- response = @sg.client.suppression.invalid_emails.delete(request_body: data, request_headers: headers)
1851
+ response = @sg.client.suppression.invalid_emails.delete(request_body: data, request_headers: headers)
1851
1852
 
1852
- self.assert_equal('204', response.status_code)
1853
- end
1853
+ assert_equal('204', response.status_code)
1854
+ end
1854
1855
 
1855
- def test_suppression_invalid_emails__email__get
1856
- email = "test_url_param"
1857
- headers = JSON.parse('{"X-Mock": 200}')
1856
+ def test_suppression_invalid_emails__email__get
1857
+ email = 'test_url_param'
1858
+ headers = JSON.parse('{"X-Mock": 200}')
1858
1859
 
1859
- response = @sg.client.suppression.invalid_emails._(email).get(request_headers: headers)
1860
+ response = @sg.client.suppression.invalid_emails._(email).get(request_headers: headers)
1860
1861
 
1861
- self.assert_equal('200', response.status_code)
1862
- end
1862
+ assert_equal('200', response.status_code)
1863
+ end
1863
1864
 
1864
- def test_suppression_invalid_emails__email__delete
1865
- email = "test_url_param"
1866
- headers = JSON.parse('{"X-Mock": 204}')
1865
+ def test_suppression_invalid_emails__email__delete
1866
+ email = 'test_url_param'
1867
+ headers = JSON.parse('{"X-Mock": 204}')
1867
1868
 
1868
- response = @sg.client.suppression.invalid_emails._(email).delete(request_headers: headers)
1869
+ response = @sg.client.suppression.invalid_emails._(email).delete(request_headers: headers)
1869
1870
 
1870
- self.assert_equal('204', response.status_code)
1871
- end
1871
+ assert_equal('204', response.status_code)
1872
+ end
1872
1873
 
1873
- def test_suppression_spam_report__email__get
1874
- email = "test_url_param"
1875
- headers = JSON.parse('{"X-Mock": 200}')
1874
+ def test_suppression_spam_report__email__get
1875
+ email = 'test_url_param'
1876
+ headers = JSON.parse('{"X-Mock": 200}')
1876
1877
 
1877
- response = @sg.client.suppression.spam_reports._(email).get(request_headers: headers)
1878
+ response = @sg.client.suppression.spam_reports._(email).get(request_headers: headers)
1878
1879
 
1879
- self.assert_equal('200', response.status_code)
1880
- end
1880
+ assert_equal('200', response.status_code)
1881
+ end
1881
1882
 
1882
- def test_suppression_spam_report__email__delete
1883
- email = "test_url_param"
1884
- headers = JSON.parse('{"X-Mock": 204}')
1883
+ def test_suppression_spam_report__email__delete
1884
+ email = 'test_url_param'
1885
+ headers = JSON.parse('{"X-Mock": 204}')
1885
1886
 
1886
- response = @sg.client.suppression.spam_report._(email).delete(request_headers: headers)
1887
+ response = @sg.client.suppression.spam_reports._(email).delete(request_headers: headers)
1887
1888
 
1888
- self.assert_equal('204', response.status_code)
1889
- end
1889
+ assert_equal('204', response.status_code)
1890
+ end
1890
1891
 
1891
- def test_suppression_spam_reports_get
1892
- params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1893
- headers = JSON.parse('{"X-Mock": 200}')
1892
+ def test_suppression_spam_reports_get
1893
+ params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1894
+ headers = JSON.parse('{"X-Mock": 200}')
1894
1895
 
1895
- response = @sg.client.suppression.spam_reports.get(query_params: params, request_headers: headers)
1896
+ response = @sg.client.suppression.spam_reports.get(query_params: params, request_headers: headers)
1896
1897
 
1897
- self.assert_equal('200', response.status_code)
1898
- end
1898
+ assert_equal('200', response.status_code)
1899
+ end
1899
1900
 
1900
- def test_suppression_spam_reports_delete
1901
- data = JSON.parse('{
1902
- "delete_all": false,
1903
- "emails": [
1904
- "example1@example.com",
1905
- "example2@example.com"
1906
- ]
1901
+ def test_suppression_spam_reports_delete
1902
+ data = JSON.parse('{
1903
+ "delete_all": false,
1904
+ "emails": [
1905
+ "example1@example.com",
1906
+ "example2@example.com"
1907
+ ]
1907
1908
  }')
1908
- headers = JSON.parse('{"X-Mock": 204}')
1909
+ headers = JSON.parse('{"X-Mock": 204}')
1909
1910
 
1910
- response = @sg.client.suppression.spam_reports.delete(request_body: data, request_headers: headers)
1911
+ response = @sg.client.suppression.spam_reports.delete(request_body: data, request_headers: headers)
1911
1912
 
1912
- self.assert_equal('204', response.status_code)
1913
- end
1913
+ assert_equal('204', response.status_code)
1914
+ end
1914
1915
 
1915
- def test_suppression_unsubscribes_get
1916
- params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1917
- headers = JSON.parse('{"X-Mock": 200}')
1916
+ def test_suppression_unsubscribes_get
1917
+ params = JSON.parse('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}')
1918
+ headers = JSON.parse('{"X-Mock": 200}')
1918
1919
 
1919
- response = @sg.client.suppression.unsubscribes.get(query_params: params, request_headers: headers)
1920
+ response = @sg.client.suppression.unsubscribes.get(query_params: params, request_headers: headers)
1920
1921
 
1921
- self.assert_equal('200', response.status_code)
1922
- end
1922
+ assert_equal('200', response.status_code)
1923
+ end
1923
1924
 
1924
- def test_templates_post
1925
- data = JSON.parse('{
1926
- "name": "example_name"
1925
+ def test_templates_post
1926
+ data = JSON.parse('{
1927
+ "name": "example_name"
1927
1928
  }')
1928
- headers = JSON.parse('{"X-Mock": 201}')
1929
+ headers = JSON.parse('{"X-Mock": 201}')
1929
1930
 
1930
- response = @sg.client.templates.post(request_body: data, request_headers: headers)
1931
+ response = @sg.client.templates.post(request_body: data, request_headers: headers)
1931
1932
 
1932
- self.assert_equal('201', response.status_code)
1933
- end
1933
+ assert_equal('201', response.status_code)
1934
+ end
1934
1935
 
1935
- def test_templates_get
1936
- headers = JSON.parse('{"X-Mock": 200}')
1936
+ def test_templates_get
1937
+ headers = JSON.parse('{"X-Mock": 200}')
1937
1938
 
1938
- response = @sg.client.templates.get(request_headers: headers)
1939
+ response = @sg.client.templates.get(request_headers: headers)
1939
1940
 
1940
- self.assert_equal('200', response.status_code)
1941
- end
1941
+ assert_equal('200', response.status_code)
1942
+ end
1942
1943
 
1943
- def test_templates__template_id__patch
1944
- data = JSON.parse('{
1945
- "name": "new_example_name"
1944
+ def test_templates__template_id__patch
1945
+ data = JSON.parse('{
1946
+ "name": "new_example_name"
1946
1947
  }')
1947
- template_id = "test_url_param"
1948
- headers = JSON.parse('{"X-Mock": 200}')
1948
+ template_id = 'test_url_param'
1949
+ headers = JSON.parse('{"X-Mock": 200}')
1949
1950
 
1950
- response = @sg.client.templates._(template_id).patch(request_body: data, request_headers: headers)
1951
+ response = @sg.client.templates._(template_id).patch(request_body: data, request_headers: headers)
1951
1952
 
1952
- self.assert_equal('200', response.status_code)
1953
- end
1953
+ assert_equal('200', response.status_code)
1954
+ end
1954
1955
 
1955
- def test_templates__template_id__get
1956
- template_id = "test_url_param"
1957
- headers = JSON.parse('{"X-Mock": 200}')
1956
+ def test_templates__template_id__get
1957
+ template_id = 'test_url_param'
1958
+ headers = JSON.parse('{"X-Mock": 200}')
1958
1959
 
1959
- response = @sg.client.templates._(template_id).get(request_headers: headers)
1960
+ response = @sg.client.templates._(template_id).get(request_headers: headers)
1960
1961
 
1961
- self.assert_equal('200', response.status_code)
1962
- end
1962
+ assert_equal('200', response.status_code)
1963
+ end
1963
1964
 
1964
- def test_templates__template_id__delete
1965
- template_id = "test_url_param"
1966
- headers = JSON.parse('{"X-Mock": 204}')
1965
+ def test_templates__template_id__delete
1966
+ template_id = 'test_url_param'
1967
+ headers = JSON.parse('{"X-Mock": 204}')
1967
1968
 
1968
- response = @sg.client.templates._(template_id).delete(request_headers: headers)
1969
+ response = @sg.client.templates._(template_id).delete(request_headers: headers)
1969
1970
 
1970
- self.assert_equal('204', response.status_code)
1971
- end
1971
+ assert_equal('204', response.status_code)
1972
+ end
1972
1973
 
1973
- def test_templates__template_id__versions_post
1974
- data = JSON.parse('{
1975
- "active": 1,
1976
- "html_content": "<%body%>",
1977
- "name": "example_version_name",
1978
- "plain_content": "<%body%>",
1979
- "subject": "<%subject%>",
1980
- "template_id": "ddb96bbc-9b92-425e-8979-99464621b543"
1974
+ def test_templates__template_id__versions_post
1975
+ data = JSON.parse('{
1976
+ "active": 1,
1977
+ "html_content": "<%body%>",
1978
+ "name": "example_version_name",
1979
+ "plain_content": "<%body%>",
1980
+ "subject": "<%subject%>",
1981
+ "template_id": "ddb96bbc-9b92-425e-8979-99464621b543"
1981
1982
  }')
1982
- template_id = "test_url_param"
1983
- headers = JSON.parse('{"X-Mock": 201}')
1983
+ template_id = 'test_url_param'
1984
+ headers = JSON.parse('{"X-Mock": 201}')
1984
1985
 
1985
- response = @sg.client.templates._(template_id).versions.post(request_body: data, request_headers: headers)
1986
+ response = @sg.client.templates._(template_id).versions.post(request_body: data, request_headers: headers)
1986
1987
 
1987
- self.assert_equal('201', response.status_code)
1988
- end
1988
+ assert_equal('201', response.status_code)
1989
+ end
1989
1990
 
1990
- def test_templates__template_id__versions__version_id__patch
1991
- data = JSON.parse('{
1992
- "active": 1,
1993
- "html_content": "<%body%>",
1994
- "name": "updated_example_name",
1995
- "plain_content": "<%body%>",
1996
- "subject": "<%subject%>"
1991
+ def test_templates__template_id__versions__version_id__patch
1992
+ data = JSON.parse('{
1993
+ "active": 1,
1994
+ "html_content": "<%body%>",
1995
+ "name": "updated_example_name",
1996
+ "plain_content": "<%body%>",
1997
+ "subject": "<%subject%>"
1997
1998
  }')
1998
- template_id = "test_url_param"
1999
- version_id = "test_url_param"
2000
- headers = JSON.parse('{"X-Mock": 200}')
1999
+ template_id = 'test_url_param'
2000
+ version_id = 'test_url_param'
2001
+ headers = JSON.parse('{"X-Mock": 200}')
2001
2002
 
2002
- response = @sg.client.templates._(template_id).versions._(version_id).patch(request_body: data, request_headers: headers)
2003
+ response = @sg.client.templates._(template_id).versions._(version_id).patch(request_body: data, request_headers: headers)
2003
2004
 
2004
- self.assert_equal('200', response.status_code)
2005
- end
2005
+ assert_equal('200', response.status_code)
2006
+ end
2006
2007
 
2007
- def test_templates__template_id__versions__version_id__get
2008
- template_id = "test_url_param"
2009
- version_id = "test_url_param"
2010
- headers = JSON.parse('{"X-Mock": 200}')
2008
+ def test_templates__template_id__versions__version_id__get
2009
+ template_id = 'test_url_param'
2010
+ version_id = 'test_url_param'
2011
+ headers = JSON.parse('{"X-Mock": 200}')
2011
2012
 
2012
- response = @sg.client.templates._(template_id).versions._(version_id).get(request_headers: headers)
2013
+ response = @sg.client.templates._(template_id).versions._(version_id).get(request_headers: headers)
2013
2014
 
2014
- self.assert_equal('200', response.status_code)
2015
- end
2015
+ assert_equal('200', response.status_code)
2016
+ end
2016
2017
 
2017
- def test_templates__template_id__versions__version_id__delete
2018
- template_id = "test_url_param"
2019
- version_id = "test_url_param"
2020
- headers = JSON.parse('{"X-Mock": 204}')
2018
+ def test_templates__template_id__versions__version_id__delete
2019
+ template_id = 'test_url_param'
2020
+ version_id = 'test_url_param'
2021
+ headers = JSON.parse('{"X-Mock": 204}')
2021
2022
 
2022
- response = @sg.client.templates._(template_id).versions._(version_id).delete(request_headers: headers)
2023
+ response = @sg.client.templates._(template_id).versions._(version_id).delete(request_headers: headers)
2023
2024
 
2024
- self.assert_equal('204', response.status_code)
2025
- end
2025
+ assert_equal('204', response.status_code)
2026
+ end
2026
2027
 
2027
- def test_templates__template_id__versions__version_id__activate_post
2028
- template_id = "test_url_param"
2029
- version_id = "test_url_param"
2030
- headers = JSON.parse('{"X-Mock": 200}')
2028
+ def test_templates__template_id__versions__version_id__activate_post
2029
+ template_id = 'test_url_param'
2030
+ version_id = 'test_url_param'
2031
+ headers = JSON.parse('{"X-Mock": 200}')
2031
2032
 
2032
- response = @sg.client.templates._(template_id).versions._(version_id).activate.post(request_headers: headers)
2033
+ response = @sg.client.templates._(template_id).versions._(version_id).activate.post(request_headers: headers)
2033
2034
 
2034
- self.assert_equal('200', response.status_code)
2035
- end
2035
+ assert_equal('200', response.status_code)
2036
+ end
2036
2037
 
2037
- def test_tracking_settings_get
2038
- params = JSON.parse('{"limit": 1, "offset": 1}')
2039
- headers = JSON.parse('{"X-Mock": 200}')
2038
+ def test_tracking_settings_get
2039
+ params = JSON.parse('{"limit": 1, "offset": 1}')
2040
+ headers = JSON.parse('{"X-Mock": 200}')
2040
2041
 
2041
- response = @sg.client.tracking_settings.get(query_params: params, request_headers: headers)
2042
+ response = @sg.client.tracking_settings.get(query_params: params, request_headers: headers)
2042
2043
 
2043
- self.assert_equal('200', response.status_code)
2044
- end
2044
+ assert_equal('200', response.status_code)
2045
+ end
2045
2046
 
2046
- def test_tracking_settings_click_patch
2047
- data = JSON.parse('{
2048
- "enabled": true
2047
+ def test_tracking_settings_click_patch
2048
+ data = JSON.parse('{
2049
+ "enabled": true
2049
2050
  }')
2050
- headers = JSON.parse('{"X-Mock": 200}')
2051
+ headers = JSON.parse('{"X-Mock": 200}')
2051
2052
 
2052
- response = @sg.client.tracking_settings.click.patch(request_body: data, request_headers: headers)
2053
+ response = @sg.client.tracking_settings.click.patch(request_body: data, request_headers: headers)
2053
2054
 
2054
- self.assert_equal('200', response.status_code)
2055
- end
2055
+ assert_equal('200', response.status_code)
2056
+ end
2056
2057
 
2057
- def test_tracking_settings_click_get
2058
- headers = JSON.parse('{"X-Mock": 200}')
2058
+ def test_tracking_settings_click_get
2059
+ headers = JSON.parse('{"X-Mock": 200}')
2059
2060
 
2060
- response = @sg.client.tracking_settings.click.get(request_headers: headers)
2061
+ response = @sg.client.tracking_settings.click.get(request_headers: headers)
2061
2062
 
2062
- self.assert_equal('200', response.status_code)
2063
- end
2063
+ assert_equal('200', response.status_code)
2064
+ end
2064
2065
 
2065
- def test_tracking_settings_google_analytics_patch
2066
- data = JSON.parse('{
2067
- "enabled": true,
2068
- "utm_campaign": "website",
2069
- "utm_content": "",
2070
- "utm_medium": "email",
2071
- "utm_source": "sendgrid.com",
2072
- "utm_term": ""
2066
+ def test_tracking_settings_google_analytics_patch
2067
+ data = JSON.parse('{
2068
+ "enabled": true,
2069
+ "utm_campaign": "website",
2070
+ "utm_content": "",
2071
+ "utm_medium": "email",
2072
+ "utm_source": "sendgrid.com",
2073
+ "utm_term": ""
2073
2074
  }')
2074
- headers = JSON.parse('{"X-Mock": 200}')
2075
+ headers = JSON.parse('{"X-Mock": 200}')
2075
2076
 
2076
- response = @sg.client.tracking_settings.google_analytics.patch(request_body: data, request_headers: headers)
2077
+ response = @sg.client.tracking_settings.google_analytics.patch(request_body: data, request_headers: headers)
2077
2078
 
2078
- self.assert_equal('200', response.status_code)
2079
- end
2079
+ assert_equal('200', response.status_code)
2080
+ end
2080
2081
 
2081
- def test_tracking_settings_google_analytics_get
2082
- headers = JSON.parse('{"X-Mock": 200}')
2082
+ def test_tracking_settings_google_analytics_get
2083
+ headers = JSON.parse('{"X-Mock": 200}')
2083
2084
 
2084
- response = @sg.client.tracking_settings.google_analytics.get(request_headers: headers)
2085
+ response = @sg.client.tracking_settings.google_analytics.get(request_headers: headers)
2085
2086
 
2086
- self.assert_equal('200', response.status_code)
2087
- end
2087
+ assert_equal('200', response.status_code)
2088
+ end
2088
2089
 
2089
- def test_tracking_settings_open_patch
2090
- data = JSON.parse('{
2091
- "enabled": true
2090
+ def test_tracking_settings_open_patch
2091
+ data = JSON.parse('{
2092
+ "enabled": true
2092
2093
  }')
2093
- headers = JSON.parse('{"X-Mock": 200}')
2094
+ headers = JSON.parse('{"X-Mock": 200}')
2094
2095
 
2095
- response = @sg.client.tracking_settings.open.patch(request_body: data, request_headers: headers)
2096
+ response = @sg.client.tracking_settings.open.patch(request_body: data, request_headers: headers)
2096
2097
 
2097
- self.assert_equal('200', response.status_code)
2098
- end
2098
+ assert_equal('200', response.status_code)
2099
+ end
2099
2100
 
2100
- def test_tracking_settings_open_get
2101
- headers = JSON.parse('{"X-Mock": 200}')
2101
+ def test_tracking_settings_open_get
2102
+ headers = JSON.parse('{"X-Mock": 200}')
2102
2103
 
2103
- response = @sg.client.tracking_settings.open.get(request_headers: headers)
2104
+ response = @sg.client.tracking_settings.open.get(request_headers: headers)
2104
2105
 
2105
- self.assert_equal('200', response.status_code)
2106
- end
2106
+ assert_equal('200', response.status_code)
2107
+ end
2107
2108
 
2108
- def test_tracking_settings_subscription_patch
2109
- data = JSON.parse('{
2110
- "enabled": true,
2111
- "html_content": "html content",
2112
- "landing": "landing page html",
2113
- "plain_content": "text content",
2114
- "replace": "replacement tag",
2115
- "url": "url"
2109
+ def test_tracking_settings_subscription_patch
2110
+ data = JSON.parse('{
2111
+ "enabled": true,
2112
+ "html_content": "html content",
2113
+ "landing": "landing page html",
2114
+ "plain_content": "text content",
2115
+ "replace": "replacement tag",
2116
+ "url": "url"
2116
2117
  }')
2117
- headers = JSON.parse('{"X-Mock": 200}')
2118
+ headers = JSON.parse('{"X-Mock": 200}')
2118
2119
 
2119
- response = @sg.client.tracking_settings.subscription.patch(request_body: data, request_headers: headers)
2120
+ response = @sg.client.tracking_settings.subscription.patch(request_body: data, request_headers: headers)
2120
2121
 
2121
- self.assert_equal('200', response.status_code)
2122
- end
2122
+ assert_equal('200', response.status_code)
2123
+ end
2123
2124
 
2124
- def test_tracking_settings_subscription_get
2125
- headers = JSON.parse('{"X-Mock": 200}')
2125
+ def test_tracking_settings_subscription_get
2126
+ headers = JSON.parse('{"X-Mock": 200}')
2126
2127
 
2127
- response = @sg.client.tracking_settings.subscription.get(request_headers: headers)
2128
+ response = @sg.client.tracking_settings.subscription.get(request_headers: headers)
2128
2129
 
2129
- self.assert_equal('200', response.status_code)
2130
- end
2130
+ assert_equal('200', response.status_code)
2131
+ end
2131
2132
 
2132
- def test_user_account_get
2133
- headers = JSON.parse('{"X-Mock": 200}')
2133
+ def test_user_account_get
2134
+ headers = JSON.parse('{"X-Mock": 200}')
2134
2135
 
2135
- response = @sg.client.user.account.get(request_headers: headers)
2136
+ response = @sg.client.user.account.get(request_headers: headers)
2136
2137
 
2137
- self.assert_equal('200', response.status_code)
2138
- end
2138
+ assert_equal('200', response.status_code)
2139
+ end
2139
2140
 
2140
- def test_user_credits_get
2141
- headers = JSON.parse('{"X-Mock": 200}')
2141
+ def test_user_credits_get
2142
+ headers = JSON.parse('{"X-Mock": 200}')
2142
2143
 
2143
- response = @sg.client.user.credits.get(request_headers: headers)
2144
+ response = @sg.client.user.credits.get(request_headers: headers)
2144
2145
 
2145
- self.assert_equal('200', response.status_code)
2146
- end
2146
+ assert_equal('200', response.status_code)
2147
+ end
2147
2148
 
2148
- def test_user_email_put
2149
- data = JSON.parse('{
2150
- "email": "example@example.com"
2149
+ def test_user_email_put
2150
+ data = JSON.parse('{
2151
+ "email": "example@example.com"
2151
2152
  }')
2152
- headers = JSON.parse('{"X-Mock": 200}')
2153
+ headers = JSON.parse('{"X-Mock": 200}')
2153
2154
 
2154
- response = @sg.client.user.email.put(request_body: data, request_headers: headers)
2155
+ response = @sg.client.user.email.put(request_body: data, request_headers: headers)
2155
2156
 
2156
- self.assert_equal('200', response.status_code)
2157
- end
2157
+ assert_equal('200', response.status_code)
2158
+ end
2158
2159
 
2159
- def test_user_email_get
2160
- headers = JSON.parse('{"X-Mock": 200}')
2160
+ def test_user_email_get
2161
+ headers = JSON.parse('{"X-Mock": 200}')
2161
2162
 
2162
- response = @sg.client.user.email.get(request_headers: headers)
2163
+ response = @sg.client.user.email.get(request_headers: headers)
2163
2164
 
2164
- self.assert_equal('200', response.status_code)
2165
- end
2165
+ assert_equal('200', response.status_code)
2166
+ end
2166
2167
 
2167
- def test_user_password_put
2168
- data = JSON.parse('{
2169
- "new_password": "new_password",
2170
- "old_password": "old_password"
2168
+ def test_user_password_put
2169
+ data = JSON.parse('{
2170
+ "new_password": "new_password",
2171
+ "old_password": "old_password"
2171
2172
  }')
2172
- headers = JSON.parse('{"X-Mock": 200}')
2173
+ headers = JSON.parse('{"X-Mock": 200}')
2173
2174
 
2174
- response = @sg.client.user.password.put(request_body: data, request_headers: headers)
2175
+ response = @sg.client.user.password.put(request_body: data, request_headers: headers)
2175
2176
 
2176
- self.assert_equal('200', response.status_code)
2177
- end
2177
+ assert_equal('200', response.status_code)
2178
+ end
2178
2179
 
2179
- def test_user_profile_patch
2180
- data = JSON.parse('{
2181
- "city": "Orange",
2182
- "first_name": "Example",
2183
- "last_name": "User"
2180
+ def test_user_profile_patch
2181
+ data = JSON.parse('{
2182
+ "city": "Orange",
2183
+ "first_name": "Example",
2184
+ "last_name": "User"
2184
2185
  }')
2185
- headers = JSON.parse('{"X-Mock": 200}')
2186
+ headers = JSON.parse('{"X-Mock": 200}')
2186
2187
 
2187
- response = @sg.client.user.profile.patch(request_body: data, request_headers: headers)
2188
+ response = @sg.client.user.profile.patch(request_body: data, request_headers: headers)
2188
2189
 
2189
- self.assert_equal('200', response.status_code)
2190
- end
2190
+ assert_equal('200', response.status_code)
2191
+ end
2191
2192
 
2192
- def test_user_profile_get
2193
- headers = JSON.parse('{"X-Mock": 200}')
2193
+ def test_user_profile_get
2194
+ headers = JSON.parse('{"X-Mock": 200}')
2194
2195
 
2195
- response = @sg.client.user.profile.get(request_headers: headers)
2196
+ response = @sg.client.user.profile.get(request_headers: headers)
2196
2197
 
2197
- self.assert_equal('200', response.status_code)
2198
- end
2198
+ assert_equal('200', response.status_code)
2199
+ end
2199
2200
 
2200
- def test_user_scheduled_sends_post
2201
- data = JSON.parse('{
2202
- "batch_id": "YOUR_BATCH_ID",
2203
- "status": "pause"
2201
+ def test_user_scheduled_sends_post
2202
+ data = JSON.parse('{
2203
+ "batch_id": "YOUR_BATCH_ID",
2204
+ "status": "pause"
2204
2205
  }')
2205
- headers = JSON.parse('{"X-Mock": 201}')
2206
+ headers = JSON.parse('{"X-Mock": 201}')
2206
2207
 
2207
- response = @sg.client.user.scheduled_sends.post(request_body: data, request_headers: headers)
2208
+ response = @sg.client.user.scheduled_sends.post(request_body: data, request_headers: headers)
2208
2209
 
2209
- self.assert_equal('201', response.status_code)
2210
- end
2210
+ assert_equal('201', response.status_code)
2211
+ end
2211
2212
 
2212
- def test_user_scheduled_sends_get
2213
- headers = JSON.parse('{"X-Mock": 200}')
2213
+ def test_user_scheduled_sends_get
2214
+ headers = JSON.parse('{"X-Mock": 200}')
2214
2215
 
2215
- response = @sg.client.user.scheduled_sends.get(request_headers: headers)
2216
+ response = @sg.client.user.scheduled_sends.get(request_headers: headers)
2216
2217
 
2217
- self.assert_equal('200', response.status_code)
2218
- end
2218
+ assert_equal('200', response.status_code)
2219
+ end
2219
2220
 
2220
- def test_user_scheduled_sends__batch_id__patch
2221
- data = JSON.parse('{
2222
- "status": "pause"
2221
+ def test_user_scheduled_sends__batch_id__patch
2222
+ data = JSON.parse('{
2223
+ "status": "pause"
2223
2224
  }')
2224
- batch_id = "test_url_param"
2225
- headers = JSON.parse('{"X-Mock": 204}')
2225
+ batch_id = 'test_url_param'
2226
+ headers = JSON.parse('{"X-Mock": 204}')
2226
2227
 
2227
- response = @sg.client.user.scheduled_sends._(batch_id).patch(request_body: data, request_headers: headers)
2228
+ response = @sg.client.user.scheduled_sends._(batch_id).patch(request_body: data, request_headers: headers)
2228
2229
 
2229
- self.assert_equal('204', response.status_code)
2230
- end
2230
+ assert_equal('204', response.status_code)
2231
+ end
2231
2232
 
2232
- def test_user_scheduled_sends__batch_id__get
2233
- batch_id = "test_url_param"
2234
- headers = JSON.parse('{"X-Mock": 200}')
2233
+ def test_user_scheduled_sends__batch_id__get
2234
+ batch_id = 'test_url_param'
2235
+ headers = JSON.parse('{"X-Mock": 200}')
2235
2236
 
2236
- response = @sg.client.user.scheduled_sends._(batch_id).get(request_headers: headers)
2237
+ response = @sg.client.user.scheduled_sends._(batch_id).get(request_headers: headers)
2237
2238
 
2238
- self.assert_equal('200', response.status_code)
2239
- end
2239
+ assert_equal('200', response.status_code)
2240
+ end
2240
2241
 
2241
- def test_user_scheduled_sends__batch_id__delete
2242
- batch_id = "test_url_param"
2243
- headers = JSON.parse('{"X-Mock": 204}')
2242
+ def test_user_scheduled_sends__batch_id__delete
2243
+ batch_id = 'test_url_param'
2244
+ headers = JSON.parse('{"X-Mock": 204}')
2244
2245
 
2245
- response = @sg.client.user.scheduled_sends._(batch_id).delete(request_headers: headers)
2246
+ response = @sg.client.user.scheduled_sends._(batch_id).delete(request_headers: headers)
2246
2247
 
2247
- self.assert_equal('204', response.status_code)
2248
- end
2248
+ assert_equal('204', response.status_code)
2249
+ end
2249
2250
 
2250
- def test_user_settings_enforced_tls_patch
2251
- data = JSON.parse('{
2252
- "require_tls": true,
2253
- "require_valid_cert": false
2251
+ def test_user_settings_enforced_tls_patch
2252
+ data = JSON.parse('{
2253
+ "require_tls": true,
2254
+ "require_valid_cert": false
2254
2255
  }')
2255
- headers = JSON.parse('{"X-Mock": 200}')
2256
+ headers = JSON.parse('{"X-Mock": 200}')
2256
2257
 
2257
- response = @sg.client.user.settings.enforced_tls.patch(request_body: data, request_headers: headers)
2258
+ response = @sg.client.user.settings.enforced_tls.patch(request_body: data, request_headers: headers)
2258
2259
 
2259
- self.assert_equal('200', response.status_code)
2260
- end
2260
+ assert_equal('200', response.status_code)
2261
+ end
2261
2262
 
2262
- def test_user_settings_enforced_tls_get
2263
- headers = JSON.parse('{"X-Mock": 200}')
2263
+ def test_user_settings_enforced_tls_get
2264
+ headers = JSON.parse('{"X-Mock": 200}')
2264
2265
 
2265
- response = @sg.client.user.settings.enforced_tls.get(request_headers: headers)
2266
+ response = @sg.client.user.settings.enforced_tls.get(request_headers: headers)
2266
2267
 
2267
- self.assert_equal('200', response.status_code)
2268
- end
2268
+ assert_equal('200', response.status_code)
2269
+ end
2269
2270
 
2270
- def test_user_username_put
2271
- data = JSON.parse('{
2272
- "username": "test_username"
2271
+ def test_user_username_put
2272
+ data = JSON.parse('{
2273
+ "username": "test_username"
2273
2274
  }')
2274
- headers = JSON.parse('{"X-Mock": 200}')
2275
+ headers = JSON.parse('{"X-Mock": 200}')
2275
2276
 
2276
- response = @sg.client.user.username.put(request_body: data, request_headers: headers)
2277
+ response = @sg.client.user.username.put(request_body: data, request_headers: headers)
2277
2278
 
2278
- self.assert_equal('200', response.status_code)
2279
- end
2279
+ assert_equal('200', response.status_code)
2280
+ end
2280
2281
 
2281
- def test_user_username_get
2282
- headers = JSON.parse('{"X-Mock": 200}')
2282
+ def test_user_username_get
2283
+ headers = JSON.parse('{"X-Mock": 200}')
2283
2284
 
2284
- response = @sg.client.user.username.get(request_headers: headers)
2285
+ response = @sg.client.user.username.get(request_headers: headers)
2285
2286
 
2286
- self.assert_equal('200', response.status_code)
2287
- end
2287
+ assert_equal('200', response.status_code)
2288
+ end
2288
2289
 
2289
- def test_user_webhooks_event_settings_patch
2290
- data = JSON.parse('{
2291
- "bounce": true,
2292
- "click": true,
2293
- "deferred": true,
2294
- "delivered": true,
2295
- "dropped": true,
2296
- "enabled": true,
2297
- "group_resubscribe": true,
2298
- "group_unsubscribe": true,
2299
- "open": true,
2300
- "processed": true,
2301
- "spam_report": true,
2302
- "unsubscribe": true,
2303
- "url": "url"
2290
+ def test_user_webhooks_event_settings_patch
2291
+ data = JSON.parse('{
2292
+ "bounce": true,
2293
+ "click": true,
2294
+ "deferred": true,
2295
+ "delivered": true,
2296
+ "dropped": true,
2297
+ "enabled": true,
2298
+ "group_resubscribe": true,
2299
+ "group_unsubscribe": true,
2300
+ "open": true,
2301
+ "processed": true,
2302
+ "spam_report": true,
2303
+ "unsubscribe": true,
2304
+ "url": "url"
2304
2305
  }')
2305
- headers = JSON.parse('{"X-Mock": 200}')
2306
+ headers = JSON.parse('{"X-Mock": 200}')
2306
2307
 
2307
- response = @sg.client.user.webhooks.event.settings.patch(request_body: data, request_headers: headers)
2308
+ response = @sg.client.user.webhooks.event.settings.patch(request_body: data, request_headers: headers)
2308
2309
 
2309
- self.assert_equal('200', response.status_code)
2310
- end
2310
+ assert_equal('200', response.status_code)
2311
+ end
2311
2312
 
2312
- def test_user_webhooks_event_settings_get
2313
- headers = JSON.parse('{"X-Mock": 200}')
2313
+ def test_user_webhooks_event_settings_get
2314
+ headers = JSON.parse('{"X-Mock": 200}')
2314
2315
 
2315
- response = @sg.client.user.webhooks.event.settings.get(request_headers: headers)
2316
+ response = @sg.client.user.webhooks.event.settings.get(request_headers: headers)
2316
2317
 
2317
- self.assert_equal('200', response.status_code)
2318
- end
2318
+ assert_equal('200', response.status_code)
2319
+ end
2319
2320
 
2320
- def test_user_webhooks_event_test_post
2321
- data = JSON.parse('{
2322
- "url": "url"
2321
+ def test_user_webhooks_event_test_post
2322
+ data = JSON.parse('{
2323
+ "url": "url"
2323
2324
  }')
2324
- headers = JSON.parse('{"X-Mock": 204}')
2325
+ headers = JSON.parse('{"X-Mock": 204}')
2325
2326
 
2326
- response = @sg.client.user.webhooks.event.test.post(request_body: data, request_headers: headers)
2327
+ response = @sg.client.user.webhooks.event.test.post(request_body: data, request_headers: headers)
2327
2328
 
2328
- self.assert_equal('204', response.status_code)
2329
- end
2329
+ assert_equal('204', response.status_code)
2330
+ end
2330
2331
 
2331
- def test_user_webhooks_parse_settings_post
2332
- data = JSON.parse('{
2333
- "hostname": "myhostname.com",
2334
- "send_raw": false,
2335
- "spam_check": true,
2336
- "url": "http://email.myhosthame.com"
2332
+ def test_user_webhooks_parse_settings_post
2333
+ data = JSON.parse('{
2334
+ "hostname": "myhostname.com",
2335
+ "send_raw": false,
2336
+ "spam_check": true,
2337
+ "url": "http://email.myhosthame.com"
2337
2338
  }')
2338
- headers = JSON.parse('{"X-Mock": 201}')
2339
+ headers = JSON.parse('{"X-Mock": 201}')
2339
2340
 
2340
- response = @sg.client.user.webhooks.parse.settings.post(request_body: data, request_headers: headers)
2341
+ response = @sg.client.user.webhooks.parse.settings.post(request_body: data, request_headers: headers)
2341
2342
 
2342
- self.assert_equal('201', response.status_code)
2343
- end
2343
+ assert_equal('201', response.status_code)
2344
+ end
2344
2345
 
2345
- def test_user_webhooks_parse_settings_get
2346
- headers = JSON.parse('{"X-Mock": 200}')
2346
+ def test_user_webhooks_parse_settings_get
2347
+ headers = JSON.parse('{"X-Mock": 200}')
2347
2348
 
2348
- response = @sg.client.user.webhooks.parse.settings.get(request_headers: headers)
2349
+ response = @sg.client.user.webhooks.parse.settings.get(request_headers: headers)
2349
2350
 
2350
- self.assert_equal('200', response.status_code)
2351
- end
2351
+ assert_equal('200', response.status_code)
2352
+ end
2352
2353
 
2353
- def test_user_webhooks_parse_settings__hostname__patch
2354
- data = JSON.parse('{
2355
- "send_raw": true,
2356
- "spam_check": false,
2357
- "url": "http://newdomain.com/parse"
2354
+ def test_user_webhooks_parse_settings__hostname__patch
2355
+ data = JSON.parse('{
2356
+ "send_raw": true,
2357
+ "spam_check": false,
2358
+ "url": "http://newdomain.com/parse"
2358
2359
  }')
2359
- hostname = "test_url_param"
2360
- headers = JSON.parse('{"X-Mock": 200}')
2360
+ hostname = 'test_url_param'
2361
+ headers = JSON.parse('{"X-Mock": 200}')
2361
2362
 
2362
- response = @sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data, request_headers: headers)
2363
+ response = @sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data, request_headers: headers)
2363
2364
 
2364
- self.assert_equal('200', response.status_code)
2365
- end
2365
+ assert_equal('200', response.status_code)
2366
+ end
2366
2367
 
2367
- def test_user_webhooks_parse_settings__hostname__get
2368
- hostname = "test_url_param"
2369
- headers = JSON.parse('{"X-Mock": 200}')
2368
+ def test_user_webhooks_parse_settings__hostname__get
2369
+ hostname = 'test_url_param'
2370
+ headers = JSON.parse('{"X-Mock": 200}')
2370
2371
 
2371
- response = @sg.client.user.webhooks.parse.settings._(hostname).get(request_headers: headers)
2372
+ response = @sg.client.user.webhooks.parse.settings._(hostname).get(request_headers: headers)
2372
2373
 
2373
- self.assert_equal('200', response.status_code)
2374
- end
2374
+ assert_equal('200', response.status_code)
2375
+ end
2375
2376
 
2376
- def test_user_webhooks_parse_settings__hostname__delete
2377
- hostname = "test_url_param"
2378
- headers = JSON.parse('{"X-Mock": 204}')
2377
+ def test_user_webhooks_parse_settings__hostname__delete
2378
+ hostname = 'test_url_param'
2379
+ headers = JSON.parse('{"X-Mock": 204}')
2379
2380
 
2380
- response = @sg.client.user.webhooks.parse.settings._(hostname).delete(request_headers: headers)
2381
+ response = @sg.client.user.webhooks.parse.settings._(hostname).delete(request_headers: headers)
2381
2382
 
2382
- self.assert_equal('204', response.status_code)
2383
- end
2383
+ assert_equal('204', response.status_code)
2384
+ end
2384
2385
 
2385
- def test_user_webhooks_parse_stats_get
2386
- params = JSON.parse('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}')
2387
- headers = JSON.parse('{"X-Mock": 200}')
2386
+ def test_user_webhooks_parse_stats_get
2387
+ params = JSON.parse('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}')
2388
+ headers = JSON.parse('{"X-Mock": 200}')
2388
2389
 
2389
- response = @sg.client.user.webhooks.parse.stats.get(query_params: params, request_headers: headers)
2390
+ response = @sg.client.user.webhooks.parse.stats.get(query_params: params, request_headers: headers)
2390
2391
 
2391
- self.assert_equal('200', response.status_code)
2392
- end
2392
+ assert_equal('200', response.status_code)
2393
+ end
2393
2394
 
2394
- def test_whitelabel_domains_post
2395
- data = JSON.parse('{
2396
- "automatic_security": false,
2397
- "custom_spf": true,
2398
- "default": true,
2399
- "domain": "example.com",
2400
- "ips": [
2401
- "192.168.1.1",
2402
- "192.168.1.2"
2403
- ],
2404
- "subdomain": "news",
2405
- "username": "john@example.com"
2395
+ def test_whitelabel_domains_post
2396
+ data = JSON.parse('{
2397
+ "automatic_security": false,
2398
+ "custom_spf": true,
2399
+ "default": true,
2400
+ "domain": "example.com",
2401
+ "ips": [
2402
+ "192.168.1.1",
2403
+ "192.168.1.2"
2404
+ ],
2405
+ "subdomain": "news",
2406
+ "username": "john@example.com"
2406
2407
  }')
2407
- headers = JSON.parse('{"X-Mock": 201}')
2408
+ headers = JSON.parse('{"X-Mock": 201}')
2408
2409
 
2409
- response = @sg.client.whitelabel.domains.post(request_body: data, request_headers: headers)
2410
+ response = @sg.client.whitelabel.domains.post(request_body: data, request_headers: headers)
2410
2411
 
2411
- self.assert_equal('201', response.status_code)
2412
- end
2412
+ assert_equal('201', response.status_code)
2413
+ end
2413
2414
 
2414
- def test_whitelabel_domains_get
2415
- params = JSON.parse('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}')
2416
- headers = JSON.parse('{"X-Mock": 200}')
2415
+ def test_whitelabel_domains_get
2416
+ params = JSON.parse('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}')
2417
+ headers = JSON.parse('{"X-Mock": 200}')
2417
2418
 
2418
- response = @sg.client.whitelabel.domains.get(query_params: params, request_headers: headers)
2419
+ response = @sg.client.whitelabel.domains.get(query_params: params, request_headers: headers)
2419
2420
 
2420
- self.assert_equal('200', response.status_code)
2421
- end
2421
+ assert_equal('200', response.status_code)
2422
+ end
2422
2423
 
2423
- def test_whitelabel_domains_default_get
2424
- headers = JSON.parse('{"X-Mock": 200}')
2424
+ def test_whitelabel_domains_default_get
2425
+ headers = JSON.parse('{"X-Mock": 200}')
2425
2426
 
2426
- response = @sg.client.whitelabel.domains.default.get(request_headers: headers)
2427
+ response = @sg.client.whitelabel.domains.default.get(request_headers: headers)
2427
2428
 
2428
- self.assert_equal('200', response.status_code)
2429
- end
2429
+ assert_equal('200', response.status_code)
2430
+ end
2430
2431
 
2431
- def test_whitelabel_domains_subuser_get
2432
- headers = JSON.parse('{"X-Mock": 200}')
2432
+ def test_whitelabel_domains_subuser_get
2433
+ headers = JSON.parse('{"X-Mock": 200}')
2433
2434
 
2434
- response = @sg.client.whitelabel.domains.subuser.get(request_headers: headers)
2435
+ response = @sg.client.whitelabel.domains.subuser.get(request_headers: headers)
2435
2436
 
2436
- self.assert_equal('200', response.status_code)
2437
- end
2437
+ assert_equal('200', response.status_code)
2438
+ end
2438
2439
 
2439
- def test_whitelabel_domains_subuser_delete
2440
- headers = JSON.parse('{"X-Mock": 204}')
2440
+ def test_whitelabel_domains_subuser_delete
2441
+ headers = JSON.parse('{"X-Mock": 204}')
2441
2442
 
2442
- response = @sg.client.whitelabel.domains.subuser.delete(request_headers: headers)
2443
+ response = @sg.client.whitelabel.domains.subuser.delete(request_headers: headers)
2443
2444
 
2444
- self.assert_equal('204', response.status_code)
2445
- end
2445
+ assert_equal('204', response.status_code)
2446
+ end
2446
2447
 
2447
- def test_whitelabel_domains__domain_id__patch
2448
- data = JSON.parse('{
2449
- "custom_spf": true,
2450
- "default": false
2448
+ def test_whitelabel_domains__domain_id__patch
2449
+ data = JSON.parse('{
2450
+ "custom_spf": true,
2451
+ "default": false
2451
2452
  }')
2452
- domain_id = "test_url_param"
2453
- headers = JSON.parse('{"X-Mock": 200}')
2453
+ domain_id = 'test_url_param'
2454
+ headers = JSON.parse('{"X-Mock": 200}')
2454
2455
 
2455
- response = @sg.client.whitelabel.domains._(domain_id).patch(request_body: data, request_headers: headers)
2456
+ response = @sg.client.whitelabel.domains._(domain_id).patch(request_body: data, request_headers: headers)
2456
2457
 
2457
- self.assert_equal('200', response.status_code)
2458
- end
2458
+ assert_equal('200', response.status_code)
2459
+ end
2459
2460
 
2460
- def test_whitelabel_domains__domain_id__get
2461
- domain_id = "test_url_param"
2462
- headers = JSON.parse('{"X-Mock": 200}')
2461
+ def test_whitelabel_domains__domain_id__get
2462
+ domain_id = 'test_url_param'
2463
+ headers = JSON.parse('{"X-Mock": 200}')
2463
2464
 
2464
- response = @sg.client.whitelabel.domains._(domain_id).get(request_headers: headers)
2465
+ response = @sg.client.whitelabel.domains._(domain_id).get(request_headers: headers)
2465
2466
 
2466
- self.assert_equal('200', response.status_code)
2467
- end
2467
+ assert_equal('200', response.status_code)
2468
+ end
2468
2469
 
2469
- def test_whitelabel_domains__domain_id__delete
2470
- domain_id = "test_url_param"
2471
- headers = JSON.parse('{"X-Mock": 204}')
2470
+ def test_whitelabel_domains__domain_id__delete
2471
+ domain_id = 'test_url_param'
2472
+ headers = JSON.parse('{"X-Mock": 204}')
2472
2473
 
2473
- response = @sg.client.whitelabel.domains._(domain_id).delete(request_headers: headers)
2474
+ response = @sg.client.whitelabel.domains._(domain_id).delete(request_headers: headers)
2474
2475
 
2475
- self.assert_equal('204', response.status_code)
2476
- end
2476
+ assert_equal('204', response.status_code)
2477
+ end
2477
2478
 
2478
- def test_whitelabel_domains__domain_id__subuser_post
2479
- data = JSON.parse('{
2480
- "username": "jane@example.com"
2479
+ def test_whitelabel_domains__domain_id__subuser_post
2480
+ data = JSON.parse('{
2481
+ "username": "jane@example.com"
2481
2482
  }')
2482
- domain_id = "test_url_param"
2483
- headers = JSON.parse('{"X-Mock": 201}')
2483
+ domain_id = 'test_url_param'
2484
+ headers = JSON.parse('{"X-Mock": 201}')
2484
2485
 
2485
- response = @sg.client.whitelabel.domains._(domain_id).subuser.post(request_body: data, request_headers: headers)
2486
+ response = @sg.client.whitelabel.domains._(domain_id).subuser.post(request_body: data, request_headers: headers)
2486
2487
 
2487
- self.assert_equal('201', response.status_code)
2488
- end
2488
+ assert_equal('201', response.status_code)
2489
+ end
2489
2490
 
2490
- def test_whitelabel_domains__id__ips_post
2491
- data = JSON.parse('{
2492
- "ip": "192.168.0.1"
2491
+ def test_whitelabel_domains__id__ips_post
2492
+ data = JSON.parse('{
2493
+ "ip": "192.168.0.1"
2493
2494
  }')
2494
- id = "test_url_param"
2495
- headers = JSON.parse('{"X-Mock": 200}')
2495
+ id = 'test_url_param'
2496
+ headers = JSON.parse('{"X-Mock": 200}')
2496
2497
 
2497
- response = @sg.client.whitelabel.domains._(id).ips.post(request_body: data, request_headers: headers)
2498
+ response = @sg.client.whitelabel.domains._(id).ips.post(request_body: data, request_headers: headers)
2498
2499
 
2499
- self.assert_equal('200', response.status_code)
2500
- end
2500
+ assert_equal('200', response.status_code)
2501
+ end
2501
2502
 
2502
- def test_whitelabel_domains__id__ips__ip__delete
2503
- id = "test_url_param"
2504
- ip = "test_url_param"
2505
- headers = JSON.parse('{"X-Mock": 200}')
2503
+ def test_whitelabel_domains__id__ips__ip__delete
2504
+ id = 'test_url_param'
2505
+ ip = 'test_url_param'
2506
+ headers = JSON.parse('{"X-Mock": 200}')
2506
2507
 
2507
- response = @sg.client.whitelabel.domains._(id).ips._(ip).delete(request_headers: headers)
2508
+ response = @sg.client.whitelabel.domains._(id).ips._(ip).delete(request_headers: headers)
2508
2509
 
2509
- self.assert_equal('200', response.status_code)
2510
- end
2510
+ assert_equal('200', response.status_code)
2511
+ end
2511
2512
 
2512
- def test_whitelabel_domains__id__validate_post
2513
- id = "test_url_param"
2514
- headers = JSON.parse('{"X-Mock": 200}')
2513
+ def test_whitelabel_domains__id__validate_post
2514
+ id = 'test_url_param'
2515
+ headers = JSON.parse('{"X-Mock": 200}')
2515
2516
 
2516
- response = @sg.client.whitelabel.domains._(id).validate.post(request_headers: headers)
2517
+ response = @sg.client.whitelabel.domains._(id).validate.post(request_headers: headers)
2517
2518
 
2518
- self.assert_equal('200', response.status_code)
2519
- end
2519
+ assert_equal('200', response.status_code)
2520
+ end
2520
2521
 
2521
- def test_whitelabel_ips_post
2522
- data = JSON.parse('{
2523
- "domain": "example.com",
2524
- "ip": "192.168.1.1",
2525
- "subdomain": "email"
2522
+ def test_whitelabel_ips_post
2523
+ data = JSON.parse('{
2524
+ "domain": "example.com",
2525
+ "ip": "192.168.1.1",
2526
+ "subdomain": "email"
2526
2527
  }')
2527
- headers = JSON.parse('{"X-Mock": 201}')
2528
+ headers = JSON.parse('{"X-Mock": 201}')
2528
2529
 
2529
- response = @sg.client.whitelabel.ips.post(request_body: data, request_headers: headers)
2530
+ response = @sg.client.whitelabel.ips.post(request_body: data, request_headers: headers)
2530
2531
 
2531
- self.assert_equal('201', response.status_code)
2532
- end
2532
+ assert_equal('201', response.status_code)
2533
+ end
2533
2534
 
2534
- def test_whitelabel_ips_get
2535
- params = JSON.parse('{"ip": "test_string", "limit": 1, "offset": 1}')
2536
- headers = JSON.parse('{"X-Mock": 200}')
2535
+ def test_whitelabel_ips_get
2536
+ params = JSON.parse('{"ip": "test_string", "limit": 1, "offset": 1}')
2537
+ headers = JSON.parse('{"X-Mock": 200}')
2537
2538
 
2538
- response = @sg.client.whitelabel.ips.get(query_params: params, request_headers: headers)
2539
+ response = @sg.client.whitelabel.ips.get(query_params: params, request_headers: headers)
2539
2540
 
2540
- self.assert_equal('200', response.status_code)
2541
- end
2541
+ assert_equal('200', response.status_code)
2542
+ end
2542
2543
 
2543
- def test_whitelabel_ips__id__get
2544
- id = "test_url_param"
2545
- headers = JSON.parse('{"X-Mock": 200}')
2544
+ def test_whitelabel_ips__id__get
2545
+ id = 'test_url_param'
2546
+ headers = JSON.parse('{"X-Mock": 200}')
2546
2547
 
2547
- response = @sg.client.whitelabel.ips._(id).get(request_headers: headers)
2548
+ response = @sg.client.whitelabel.ips._(id).get(request_headers: headers)
2548
2549
 
2549
- self.assert_equal('200', response.status_code)
2550
- end
2550
+ assert_equal('200', response.status_code)
2551
+ end
2551
2552
 
2552
- def test_whitelabel_ips__id__delete
2553
- id = "test_url_param"
2554
- headers = JSON.parse('{"X-Mock": 204}')
2553
+ def test_whitelabel_ips__id__delete
2554
+ id = 'test_url_param'
2555
+ headers = JSON.parse('{"X-Mock": 204}')
2555
2556
 
2556
- response = @sg.client.whitelabel.ips._(id).delete(request_headers: headers)
2557
+ response = @sg.client.whitelabel.ips._(id).delete(request_headers: headers)
2557
2558
 
2558
- self.assert_equal('204', response.status_code)
2559
- end
2559
+ assert_equal('204', response.status_code)
2560
+ end
2560
2561
 
2561
- def test_whitelabel_ips__id__validate_post
2562
- id = "test_url_param"
2563
- headers = JSON.parse('{"X-Mock": 200}')
2562
+ def test_whitelabel_ips__id__validate_post
2563
+ id = 'test_url_param'
2564
+ headers = JSON.parse('{"X-Mock": 200}')
2564
2565
 
2565
- response = @sg.client.whitelabel.ips._(id).validate.post(request_headers: headers)
2566
+ response = @sg.client.whitelabel.ips._(id).validate.post(request_headers: headers)
2566
2567
 
2567
- self.assert_equal('200', response.status_code)
2568
- end
2568
+ assert_equal('200', response.status_code)
2569
+ end
2569
2570
 
2570
- def test_whitelabel_links_post
2571
- data = JSON.parse('{
2572
- "default": true,
2573
- "domain": "example.com",
2574
- "subdomain": "mail"
2571
+ def test_whitelabel_links_post
2572
+ data = JSON.parse('{
2573
+ "default": true,
2574
+ "domain": "example.com",
2575
+ "subdomain": "mail"
2575
2576
  }')
2576
- params = JSON.parse('{"limit": 1, "offset": 1}')
2577
- headers = JSON.parse('{"X-Mock": 201}')
2577
+ params = JSON.parse('{"limit": 1, "offset": 1}')
2578
+ headers = JSON.parse('{"X-Mock": 201}')
2578
2579
 
2579
- response = @sg.client.whitelabel.links.post(request_body: data, query_params: params, request_headers: headers)
2580
+ response = @sg.client.whitelabel.links.post(request_body: data, query_params: params, request_headers: headers)
2580
2581
 
2581
- self.assert_equal('201', response.status_code)
2582
- end
2582
+ assert_equal('201', response.status_code)
2583
+ end
2583
2584
 
2584
- def test_whitelabel_links_get
2585
- params = JSON.parse('{"limit": 1}')
2586
- headers = JSON.parse('{"X-Mock": 200}')
2585
+ def test_whitelabel_links_get
2586
+ params = JSON.parse('{"limit": 1}')
2587
+ headers = JSON.parse('{"X-Mock": 200}')
2587
2588
 
2588
- response = @sg.client.whitelabel.links.get(query_params: params, request_headers: headers)
2589
+ response = @sg.client.whitelabel.links.get(query_params: params, request_headers: headers)
2589
2590
 
2590
- self.assert_equal('200', response.status_code)
2591
- end
2591
+ assert_equal('200', response.status_code)
2592
+ end
2592
2593
 
2593
- def test_whitelabel_links_default_get
2594
- params = JSON.parse('{"domain": "test_string"}')
2595
- headers = JSON.parse('{"X-Mock": 200}')
2594
+ def test_whitelabel_links_default_get
2595
+ params = JSON.parse('{"domain": "test_string"}')
2596
+ headers = JSON.parse('{"X-Mock": 200}')
2596
2597
 
2597
- response = @sg.client.whitelabel.links.default.get(query_params: params, request_headers: headers)
2598
+ response = @sg.client.whitelabel.links.default.get(query_params: params, request_headers: headers)
2598
2599
 
2599
- self.assert_equal('200', response.status_code)
2600
- end
2600
+ assert_equal('200', response.status_code)
2601
+ end
2601
2602
 
2602
- def test_whitelabel_links_subuser_get
2603
- params = JSON.parse('{"username": "test_string"}')
2604
- headers = JSON.parse('{"X-Mock": 200}')
2603
+ def test_whitelabel_links_subuser_get
2604
+ params = JSON.parse('{"username": "test_string"}')
2605
+ headers = JSON.parse('{"X-Mock": 200}')
2605
2606
 
2606
- response = @sg.client.whitelabel.links.subuser.get(query_params: params, request_headers: headers)
2607
+ response = @sg.client.whitelabel.links.subuser.get(query_params: params, request_headers: headers)
2607
2608
 
2608
- self.assert_equal('200', response.status_code)
2609
- end
2609
+ assert_equal('200', response.status_code)
2610
+ end
2610
2611
 
2611
- def test_whitelabel_links_subuser_delete
2612
- params = JSON.parse('{"username": "test_string"}')
2613
- headers = JSON.parse('{"X-Mock": 204}')
2612
+ def test_whitelabel_links_subuser_delete
2613
+ params = JSON.parse('{"username": "test_string"}')
2614
+ headers = JSON.parse('{"X-Mock": 204}')
2614
2615
 
2615
- response = @sg.client.whitelabel.links.subuser.delete(query_params: params, request_headers: headers)
2616
+ response = @sg.client.whitelabel.links.subuser.delete(query_params: params, request_headers: headers)
2616
2617
 
2617
- self.assert_equal('204', response.status_code)
2618
- end
2618
+ assert_equal('204', response.status_code)
2619
+ end
2619
2620
 
2620
- def test_whitelabel_links__id__patch
2621
- data = JSON.parse('{
2622
- "default": true
2621
+ def test_whitelabel_links__id__patch
2622
+ data = JSON.parse('{
2623
+ "default": true
2623
2624
  }')
2624
- id = "test_url_param"
2625
- headers = JSON.parse('{"X-Mock": 200}')
2625
+ id = 'test_url_param'
2626
+ headers = JSON.parse('{"X-Mock": 200}')
2626
2627
 
2627
- response = @sg.client.whitelabel.links._(id).patch(request_body: data, request_headers: headers)
2628
+ response = @sg.client.whitelabel.links._(id).patch(request_body: data, request_headers: headers)
2628
2629
 
2629
- self.assert_equal('200', response.status_code)
2630
- end
2630
+ assert_equal('200', response.status_code)
2631
+ end
2631
2632
 
2632
- def test_whitelabel_links__id__get
2633
- id = "test_url_param"
2634
- headers = JSON.parse('{"X-Mock": 200}')
2633
+ def test_whitelabel_links__id__get
2634
+ id = 'test_url_param'
2635
+ headers = JSON.parse('{"X-Mock": 200}')
2635
2636
 
2636
- response = @sg.client.whitelabel.links._(id).get(request_headers: headers)
2637
+ response = @sg.client.whitelabel.links._(id).get(request_headers: headers)
2637
2638
 
2638
- self.assert_equal('200', response.status_code)
2639
- end
2639
+ assert_equal('200', response.status_code)
2640
+ end
2640
2641
 
2641
- def test_whitelabel_links__id__delete
2642
- id = "test_url_param"
2643
- headers = JSON.parse('{"X-Mock": 204}')
2642
+ def test_whitelabel_links__id__delete
2643
+ id = 'test_url_param'
2644
+ headers = JSON.parse('{"X-Mock": 204}')
2644
2645
 
2645
- response = @sg.client.whitelabel.links._(id).delete(request_headers: headers)
2646
+ response = @sg.client.whitelabel.links._(id).delete(request_headers: headers)
2646
2647
 
2647
- self.assert_equal('204', response.status_code)
2648
- end
2648
+ assert_equal('204', response.status_code)
2649
+ end
2649
2650
 
2650
- def test_whitelabel_links__id__validate_post
2651
- id = "test_url_param"
2652
- headers = JSON.parse('{"X-Mock": 200}')
2651
+ def test_whitelabel_links__id__validate_post
2652
+ id = 'test_url_param'
2653
+ headers = JSON.parse('{"X-Mock": 200}')
2653
2654
 
2654
- response = @sg.client.whitelabel.links._(id).validate.post(request_headers: headers)
2655
+ response = @sg.client.whitelabel.links._(id).validate.post(request_headers: headers)
2655
2656
 
2656
- self.assert_equal('200', response.status_code)
2657
- end
2657
+ assert_equal('200', response.status_code)
2658
+ end
2658
2659
 
2659
- def test_whitelabel_links__link_id__subuser_post
2660
- data = JSON.parse('{
2661
- "username": "jane@example.com"
2660
+ def test_whitelabel_links__link_id__subuser_post
2661
+ data = JSON.parse('{
2662
+ "username": "jane@example.com"
2662
2663
  }')
2663
- link_id = "test_url_param"
2664
- headers = JSON.parse('{"X-Mock": 200}')
2665
-
2666
- response = @sg.client.whitelabel.links._(link_id).subuser.post(request_body: data, request_headers: headers)
2667
-
2668
- self.assert_equal('200', response.status_code)
2669
- end
2670
-
2671
-
2672
- def test_license_file_correct_year_range
2673
- if File.exist?('./LICENSE.txt')
2674
- # get only the first line from the license txt file
2675
- year_range = File.open('./LICENSE.txt', &:readline).gsub(/[^\d-]/, '')
2676
- self.assert_equal("2014-#{Time.now.year}", year_range)
2677
- end
2678
- end
2679
-
2680
- def test_docker_exists
2681
- assert(File.file?('./Dockerfile') || File.file?('./docker/Dockerfile'))
2682
- end
2664
+ link_id = 'test_url_param'
2665
+ headers = JSON.parse('{"X-Mock": 200}')
2683
2666
 
2684
- # def test_docker_compose_exists
2685
- # assert(File.file?('./docker-compose.yml') || File.file?('./docker/docker-compose.yml'))
2686
- # end
2667
+ response = @sg.client.whitelabel.links._(link_id).subuser.post(request_body: data, request_headers: headers)
2687
2668
 
2688
- def test_env_sample_exists
2689
- assert(File.file?('./.env_sample'))
2690
- end
2669
+ assert_equal('200', response.status_code)
2670
+ end
2691
2671
 
2692
- def test_gitignore_exists
2693
- assert(File.file?('./.gitignore'))
2694
- end
2672
+ def test_license_file_year
2673
+ # Read the third line from the license file
2674
+ year = IO.readlines('./LICENSE')[2].gsub(/[^\d]/, '')
2675
+ assert_equal(Time.now.year.to_s, year)
2676
+ end
2695
2677
 
2696
- def test_travis_exists
2697
- assert(File.file?('./.travis.yml'))
2698
- end
2678
+ def test_env_sample_exists
2679
+ assert(File.file?('./.env_sample'))
2680
+ end
2699
2681
 
2700
- def test_codeclimate_exists
2701
- assert(File.file?('./.codeclimate.yml'))
2702
- end
2682
+ def test_gitignore_exists
2683
+ assert(File.file?('./.gitignore'))
2684
+ end
2703
2685
 
2704
- def test_changelog_exists
2705
- assert(File.file?('./CHANGELOG.md'))
2706
- end
2686
+ def test_gh_actions_exists
2687
+ assert(File.file?('./.github/workflows/test-and-deploy.yml'))
2688
+ end
2707
2689
 
2708
- def test_code_of_conduct_exists
2709
- assert(File.file?('./CODE_OF_CONDUCT.md'))
2710
- end
2690
+ def test_changelog_exists
2691
+ assert(File.file?('./CHANGELOG.md'))
2692
+ end
2711
2693
 
2712
- def test_contributing_exists
2713
- assert(File.file?('./CONTRIBUTING.md'))
2714
- end
2694
+ def test_code_of_conduct_exists
2695
+ assert(File.file?('./CODE_OF_CONDUCT.md'))
2696
+ end
2715
2697
 
2716
- def test_issue_template_exists
2717
- assert(File.file?('./.github/ISSUE_TEMPLATE'))
2718
- end
2698
+ def test_contributing_exists
2699
+ assert(File.file?('./CONTRIBUTING.md'))
2700
+ end
2719
2701
 
2720
- def test_license_exists
2721
- assert(File.file?('./LICENSE.txt'))
2722
- end
2702
+ def test_license_exists
2703
+ assert(File.file?('./LICENSE'))
2704
+ end
2723
2705
 
2724
- def test_pull_request_template_exists
2725
- assert(File.file?('./.github/PULL_REQUEST_TEMPLATE'))
2726
- end
2706
+ def test_pull_request_template_exists
2707
+ assert(File.file?('./PULL_REQUEST_TEMPLATE.md'))
2708
+ end
2727
2709
 
2728
- def test_readme_exists
2729
- assert(File.file?('./README.md'))
2730
- end
2710
+ def test_readme_exists
2711
+ assert(File.file?('./README.md'))
2712
+ end
2731
2713
 
2732
- def test_troubleshooting_exists
2733
- assert(File.file?('./TROUBLESHOOTING.md'))
2734
- end
2714
+ def test_troubleshooting_exists
2715
+ assert(File.file?('./TROUBLESHOOTING.md'))
2716
+ end
2735
2717
 
2736
- def test_usage_exists
2737
- assert(File.file?('./USAGE.md'))
2738
- end
2718
+ def test_usage_exists
2719
+ assert(File.file?('./USAGE.md'))
2720
+ end
2739
2721
 
2740
- def test_use_cases_exists
2741
- assert(File.file?('./USE_CASES.md'))
2742
- end
2722
+ def test_use_cases_exists
2723
+ assert(File.file?('./use-cases/README.md'))
2724
+ end
2743
2725
  end