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