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