sendgrid4r 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env.example +6 -8
- data/.rubocop.yml +1 -1
- data/README.md +0 -2
- data/lib/sendgrid4r/rest/api.rb +6 -0
- data/lib/sendgrid4r/rest/api_keys/api_keys.rb +5 -5
- data/lib/sendgrid4r/rest/asm/global_suppressions.rb +3 -3
- data/lib/sendgrid4r/rest/asm/groups.rb +4 -4
- data/lib/sendgrid4r/rest/asm/suppressions.rb +4 -4
- data/lib/sendgrid4r/rest/categories/categories.rb +1 -1
- data/lib/sendgrid4r/rest/contacts/custom_fields.rb +3 -3
- data/lib/sendgrid4r/rest/contacts/lists.rb +10 -10
- data/lib/sendgrid4r/rest/contacts/recipients.rb +10 -10
- data/lib/sendgrid4r/rest/contacts/segments.rb +5 -5
- data/lib/sendgrid4r/rest/ips/addresses.rb +3 -3
- data/lib/sendgrid4r/rest/ips/pools.rb +4 -4
- data/lib/sendgrid4r/rest/ips/warmup.rb +6 -6
- data/lib/sendgrid4r/rest/request.rb +2 -2
- data/lib/sendgrid4r/rest/subusers/subusers.rb +63 -3
- data/lib/sendgrid4r/rest/templates/templates.rb +14 -9
- data/lib/sendgrid4r/rest/templates/versions.rb +12 -10
- data/lib/sendgrid4r/rest/whitelabel/domains.rb +257 -0
- data/lib/sendgrid4r/rest/whitelabel/ips.rb +140 -0
- data/lib/sendgrid4r/rest/whitelabel/links.rb +185 -0
- data/lib/sendgrid4r/version.rb +1 -1
- data/sendgrid4r.gemspec +1 -1
- data/spec/client_spec.rb +93 -1
- data/spec/rest/api_keys/api_keys_spec.rb +23 -55
- data/spec/rest/asm/global_suppressions_spec.rb +40 -68
- data/spec/rest/asm/groups_spec.rb +31 -82
- data/spec/rest/asm/suppressions_spec.rb +33 -76
- data/spec/rest/categories/categories_spec.rb +8 -27
- data/spec/rest/contacts/custom_fields_spec.rb +18 -71
- data/spec/rest/contacts/lists_spec.rb +64 -187
- data/spec/rest/contacts/recipients_spec.rb +41 -196
- data/spec/rest/contacts/reserved_fields_spec.rb +2 -20
- data/spec/rest/contacts/segments_spec.rb +47 -33
- data/spec/rest/email_activity/email_activity_spec.rb +8 -21
- data/spec/rest/ips/addresses_spec.rb +18 -77
- data/spec/rest/ips/pools_spec.rb +21 -80
- data/spec/rest/ips/warmup_spec.rb +11 -58
- data/spec/rest/settings/enforced_tls_spec.rb +3 -40
- data/spec/rest/settings/mail_spec.rb +21 -294
- data/spec/rest/settings/partner_spec.rb +6 -79
- data/spec/rest/settings/tracking_spec.rb +10 -147
- data/spec/rest/stats/advanced_spec.rb +13 -135
- data/spec/rest/stats/category_spec.rb +5 -48
- data/spec/rest/stats/global_spec.rb +3 -5
- data/spec/rest/stats/parse_spec.rb +1 -24
- data/spec/rest/stats/subuser_spec.rb +6 -49
- data/spec/rest/subusers/subusers_spec.rb +156 -81
- data/spec/rest/templates/templates_spec.rb +32 -81
- data/spec/rest/templates/versions_spec.rb +50 -28
- data/spec/rest/whitelabel/domains_spec.rb +637 -0
- data/spec/rest/whitelabel/ips_spec.rb +231 -0
- data/spec/rest/whitelabel/links_spec.rb +359 -0
- metadata +22 -8
@@ -5,9 +5,7 @@ describe SendGrid4r::REST::Ips::Warmup do
|
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
Dotenv.load
|
8
|
-
@client = SendGrid4r::Client.new(
|
9
|
-
username: ENV['SILVER_SENDGRID_USERNAME'],
|
10
|
-
password: ENV['SILVER_SENDGRID_PASSWORD'])
|
8
|
+
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
|
11
9
|
end
|
12
10
|
|
13
11
|
context 'account is silver' do
|
@@ -17,10 +15,10 @@ describe SendGrid4r::REST::Ips::Warmup do
|
|
17
15
|
warmup_ips = @client.get_warmup_ips
|
18
16
|
if warmup_ips.length > 0
|
19
17
|
warmup_ips.each do |warmup_ip|
|
20
|
-
@client.delete_warmup_ip(warmup_ip.ip)
|
18
|
+
@client.delete_warmup_ip(ip: warmup_ip.ip)
|
21
19
|
end
|
22
20
|
end
|
23
|
-
rescue => e
|
21
|
+
rescue RestClient::ExceptionWithResponse => e
|
24
22
|
puts e.inspect
|
25
23
|
raise e
|
26
24
|
end
|
@@ -35,66 +33,21 @@ describe SendGrid4r::REST::Ips::Warmup do
|
|
35
33
|
# post warmup ip
|
36
34
|
ips = @client.get_ips
|
37
35
|
expect(ips.length).to be > 0
|
38
|
-
warmup_ip = @client.post_warmup_ip(ips[0].ip)
|
36
|
+
warmup_ip = @client.post_warmup_ip(ip: ips[0].ip)
|
39
37
|
expect(warmup_ip.ip).to eq(ips[0].ip)
|
40
|
-
warmup_ip = @client.get_warmup_ip(warmup_ip.ip)
|
38
|
+
warmup_ip = @client.get_warmup_ip(ip: warmup_ip.ip)
|
41
39
|
expect(warmup_ip.ip).to eq(ips[0].ip)
|
42
40
|
# delete the warmup ip
|
43
|
-
@client.delete_warmup_ip(warmup_ip.ip)
|
41
|
+
@client.delete_warmup_ip(ip: warmup_ip.ip)
|
44
42
|
expect do
|
45
|
-
@client.get_warmup_ip(warmup_ip.ip)
|
43
|
+
@client.get_warmup_ip(ip: warmup_ip.ip)
|
46
44
|
end.to raise_error(RestClient::ResourceNotFound)
|
47
|
-
rescue => ex
|
45
|
+
rescue RestClient::ExceptionWithResponse => ex
|
48
46
|
puts ex.inspect
|
49
47
|
raise ex
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
53
|
-
|
54
|
-
context 'with block call' do
|
55
|
-
it 'warmup_ip spec' do
|
56
|
-
# get warmup ips
|
57
|
-
@client.get_warmup_ips do |resp, req, res|
|
58
|
-
resp =
|
59
|
-
SendGrid4r::REST::Ips::Warmup.create_warmup_ips(
|
60
|
-
JSON.parse(resp)
|
61
|
-
)
|
62
|
-
expect(resp).to be_a(Array)
|
63
|
-
expect(req).to be_a(RestClient::Request)
|
64
|
-
expect(res).to be_a(Net::HTTPOK)
|
65
|
-
end
|
66
|
-
# post warmup ip
|
67
|
-
warmup_ip = nil
|
68
|
-
ips = @client.get_ips
|
69
|
-
expect(ips.length).to be > 0
|
70
|
-
@client.post_warmup_ip(ips[0].ip) do |resp, req, res|
|
71
|
-
resp =
|
72
|
-
SendGrid4r::REST::Ips::Warmup.create_warmup_ip(
|
73
|
-
JSON.parse(resp)
|
74
|
-
)
|
75
|
-
warmup_ip = resp
|
76
|
-
expect(resp).to be_a(SendGrid4r::REST::Ips::Warmup::WarmupIp)
|
77
|
-
expect(req).to be_a(RestClient::Request)
|
78
|
-
expect(res).to be_a(Net::HTTPCreated)
|
79
|
-
end
|
80
|
-
# get warmup ip
|
81
|
-
@client.get_warmup_ip(warmup_ip.ip) do |resp, req, res|
|
82
|
-
resp =
|
83
|
-
SendGrid4r::REST::Ips::Warmup.create_warmup_ip(
|
84
|
-
JSON.parse(resp)
|
85
|
-
)
|
86
|
-
expect(resp).to be_a(SendGrid4r::REST::Ips::Warmup::WarmupIp)
|
87
|
-
expect(req).to be_a(RestClient::Request)
|
88
|
-
expect(res).to be_a(Net::HTTPOK)
|
89
|
-
end
|
90
|
-
# delete the warmup ip
|
91
|
-
@client.delete_warmup_ip(warmup_ip.ip) do |resp, req, res|
|
92
|
-
expect(resp).to eq('')
|
93
|
-
expect(req).to be_a(RestClient::Request)
|
94
|
-
expect(res).to be_a(Net::HTTPNoContent)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
51
|
end
|
99
52
|
end
|
100
53
|
|
@@ -134,19 +87,19 @@ describe SendGrid4r::REST::Ips::Warmup do
|
|
134
87
|
|
135
88
|
it '#get_warmup_ip' do
|
136
89
|
allow(client).to receive(:execute).and_return(warmup_ip)
|
137
|
-
actual = client.get_warmup_ip('')
|
90
|
+
actual = client.get_warmup_ip(ip: '')
|
138
91
|
expect(actual).to be_a(SendGrid4r::REST::Ips::Warmup::WarmupIp)
|
139
92
|
end
|
140
93
|
|
141
94
|
it '#post_warmup_ip' do
|
142
95
|
allow(client).to receive(:execute).and_return(warmup_ip)
|
143
|
-
actual = client.post_warmup_ip('')
|
96
|
+
actual = client.post_warmup_ip(ip: '')
|
144
97
|
expect(actual).to be_a(SendGrid4r::REST::Ips::Warmup::WarmupIp)
|
145
98
|
end
|
146
99
|
|
147
100
|
it '#delete_warmup_ip' do
|
148
101
|
allow(client).to receive(:execute).and_return('')
|
149
|
-
actual = client.delete_warmup_ip('')
|
102
|
+
actual = client.delete_warmup_ip(ip: '')
|
150
103
|
expect(actual).to eq('')
|
151
104
|
end
|
152
105
|
|
@@ -5,9 +5,7 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
Dotenv.load
|
8
|
-
@client = SendGrid4r::Client.new(
|
9
|
-
username: ENV['SENDGRID_USERNAME'],
|
10
|
-
password: ENV['SENDGRID_PASSWORD'])
|
8
|
+
@client = SendGrid4r::Client.new(api_key: ENV['API_KEY'])
|
11
9
|
end
|
12
10
|
|
13
11
|
context 'without block call' do
|
@@ -17,7 +15,7 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
17
15
|
expect(
|
18
16
|
actual
|
19
17
|
).to be_a(SendGrid4r::REST::Settings::EnforcedTls::EnforcedTls)
|
20
|
-
rescue => e
|
18
|
+
rescue RestClient::ExceptionWithResponse => e
|
21
19
|
puts e.inspect
|
22
20
|
raise e
|
23
21
|
end
|
@@ -33,47 +31,12 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
33
31
|
edit = @client.patch_enforced_tls(params: actual)
|
34
32
|
expect(actual.require_tls).to eq(edit.require_tls)
|
35
33
|
expect(actual.require_valid_cert).to eq(edit.require_valid_cert)
|
36
|
-
rescue => e
|
34
|
+
rescue RestClient::ExceptionWithResponse => e
|
37
35
|
puts e.inspect
|
38
36
|
raise e
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
42
|
-
|
43
|
-
context 'with block call' do
|
44
|
-
it '#get_enforced_tls' do
|
45
|
-
@client.get_enforced_tls do |resp, req, res|
|
46
|
-
resp =
|
47
|
-
SendGrid4r::REST::Settings::EnforcedTls.create_enforced_tls(
|
48
|
-
JSON.parse(resp)
|
49
|
-
)
|
50
|
-
expect(resp).to be_a(
|
51
|
-
SendGrid4r::REST::Settings::EnforcedTls::EnforcedTls
|
52
|
-
)
|
53
|
-
expect(req).to be_a(RestClient::Request)
|
54
|
-
expect(res).to be_a(Net::HTTPOK)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
it '#patch_enforced_tls' do
|
59
|
-
# get original enforced_tls settings
|
60
|
-
actual = @client.get_enforced_tls
|
61
|
-
# patch both value
|
62
|
-
actual.require_tls = false
|
63
|
-
actual.require_valid_cert = false
|
64
|
-
@client.patch_enforced_tls(params: actual) do |resp, req, res|
|
65
|
-
resp =
|
66
|
-
SendGrid4r::REST::Settings::EnforcedTls.create_enforced_tls(
|
67
|
-
JSON.parse(resp)
|
68
|
-
)
|
69
|
-
expect(resp).to be_a(
|
70
|
-
SendGrid4r::REST::Settings::EnforcedTls::EnforcedTls
|
71
|
-
)
|
72
|
-
expect(req).to be_a(RestClient::Request)
|
73
|
-
expect(res).to be_a(Net::HTTPOK)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
40
|
end
|
78
41
|
|
79
42
|
describe 'unit test', :ut do
|
@@ -5,9 +5,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
Dotenv.load
|
8
|
-
@client = SendGrid4r::Client.new(
|
9
|
-
username: ENV['SENDGRID_USERNAME'],
|
10
|
-
password: ENV['SENDGRID_PASSWORD'])
|
8
|
+
@client = SendGrid4r::Client.new(api_key: ENV['API_KEY'])
|
11
9
|
end
|
12
10
|
|
13
11
|
context 'without block call' do
|
@@ -17,7 +15,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
17
15
|
expect(
|
18
16
|
actual
|
19
17
|
).to be_a(SendGrid4r::REST::Settings::Results)
|
20
|
-
rescue => e
|
18
|
+
rescue RestClient::ExceptionWithResponse => e
|
21
19
|
puts e.inspect
|
22
20
|
raise e
|
23
21
|
end
|
@@ -29,7 +27,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
29
27
|
expect(actual).to be_a(
|
30
28
|
SendGrid4r::REST::Settings::Mail::AddressWhitelist
|
31
29
|
)
|
32
|
-
rescue => e
|
30
|
+
rescue RestClient::ExceptionWithResponse => e
|
33
31
|
puts e.inspect
|
34
32
|
raise e
|
35
33
|
end
|
@@ -46,7 +44,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
46
44
|
expect(edit.enabled).to eq(false)
|
47
45
|
expect(edit.list[0]).to eq('test@white.list.com')
|
48
46
|
expect(edit.list[1]).to eq('white.list.com')
|
49
|
-
rescue => e
|
47
|
+
rescue RestClient::ExceptionWithResponse => e
|
50
48
|
puts e.inspect
|
51
49
|
raise e
|
52
50
|
end
|
@@ -56,7 +54,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
56
54
|
begin
|
57
55
|
actual = @client.get_settings_bcc
|
58
56
|
expect(actual).to be_a(SendGrid4r::REST::Settings::Mail::Bcc)
|
59
|
-
rescue => e
|
57
|
+
rescue RestClient::ExceptionWithResponse => e
|
60
58
|
puts e.inspect
|
61
59
|
raise e
|
62
60
|
end
|
@@ -72,7 +70,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
72
70
|
edit = @client.patch_settings_bcc(params: actual)
|
73
71
|
expect(edit.enabled).to eq(false)
|
74
72
|
expect(edit.email).to eq('test@bcc.com')
|
75
|
-
rescue => e
|
73
|
+
rescue RestClient::ExceptionWithResponse => e
|
76
74
|
puts e.inspect
|
77
75
|
raise e
|
78
76
|
end
|
@@ -82,7 +80,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
82
80
|
begin
|
83
81
|
actual = @client.get_settings_bounce_purge
|
84
82
|
expect(actual).to be_a(SendGrid4r::REST::Settings::Mail::BouncePurge)
|
85
|
-
rescue => e
|
83
|
+
rescue RestClient::ExceptionWithResponse => e
|
86
84
|
puts e.inspect
|
87
85
|
raise e
|
88
86
|
end
|
@@ -100,7 +98,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
100
98
|
expect(edit.enabled).to eq(false)
|
101
99
|
# expect(actual.hard_bounces).to eq(123)
|
102
100
|
# expect(actual.soft_bounces).to eq(321)
|
103
|
-
rescue => e
|
101
|
+
rescue RestClient::ExceptionWithResponse => e
|
104
102
|
puts e.inspect
|
105
103
|
raise e
|
106
104
|
end
|
@@ -112,7 +110,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
112
110
|
expect(actual).to be_a(
|
113
111
|
SendGrid4r::REST::Settings::Mail::EventNotification
|
114
112
|
)
|
115
|
-
rescue => e
|
113
|
+
rescue RestClient::ExceptionWithResponse => e
|
116
114
|
puts e.inspect
|
117
115
|
raise e
|
118
116
|
end
|
@@ -150,7 +148,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
150
148
|
expect(edit.open).to eq(true)
|
151
149
|
expect(edit.click).to eq(true)
|
152
150
|
expect(edit.dropped).to eq(true)
|
153
|
-
rescue => e
|
151
|
+
rescue RestClient::ExceptionWithResponse => e
|
154
152
|
puts e.inspect
|
155
153
|
raise e
|
156
154
|
end
|
@@ -159,7 +157,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
159
157
|
it '#test_settings_event_notification' do
|
160
158
|
begin
|
161
159
|
@client.test_settings_event_notification(url: ENV['EVENT_URL'])
|
162
|
-
rescue => e
|
160
|
+
rescue RestClient::ExceptionWithResponse => e
|
163
161
|
puts e.inspect
|
164
162
|
raise e
|
165
163
|
end
|
@@ -169,7 +167,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
169
167
|
begin
|
170
168
|
actual = @client.get_settings_footer
|
171
169
|
expect(actual).to be_a(SendGrid4r::REST::Settings::Mail::Footer)
|
172
|
-
rescue => e
|
170
|
+
rescue RestClient::ExceptionWithResponse => e
|
173
171
|
puts e.inspect
|
174
172
|
raise e
|
175
173
|
end
|
@@ -187,7 +185,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
187
185
|
expect(edit.enabled).to eq(false)
|
188
186
|
expect(edit.html_content).to eq('abc...')
|
189
187
|
expect(edit.plain_content).to eq('xyz...')
|
190
|
-
rescue => e
|
188
|
+
rescue RestClient::ExceptionWithResponse => e
|
191
189
|
puts e.inspect
|
192
190
|
raise e
|
193
191
|
end
|
@@ -199,7 +197,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
199
197
|
expect(actual).to be_a(
|
200
198
|
SendGrid4r::REST::Settings::Mail::ForwardBounce
|
201
199
|
)
|
202
|
-
rescue => e
|
200
|
+
rescue RestClient::ExceptionWithResponse => e
|
203
201
|
puts e.inspect
|
204
202
|
raise e
|
205
203
|
end
|
@@ -215,7 +213,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
215
213
|
edit = @client.patch_settings_forward_bounce(params: actual)
|
216
214
|
expect(edit.enabled).to eq(false)
|
217
215
|
expect(edit.email).to eq(ENV['MAIL'])
|
218
|
-
rescue => e
|
216
|
+
rescue RestClient::ExceptionWithResponse => e
|
219
217
|
puts e.inspect
|
220
218
|
raise e
|
221
219
|
end
|
@@ -227,7 +225,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
227
225
|
expect(actual).to be_a(
|
228
226
|
SendGrid4r::REST::Settings::Mail::ForwardSpam
|
229
227
|
)
|
230
|
-
rescue => e
|
228
|
+
rescue RestClient::ExceptionWithResponse => e
|
231
229
|
puts e.inspect
|
232
230
|
raise e
|
233
231
|
end
|
@@ -243,7 +241,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
243
241
|
edit = @client.patch_settings_forward_spam(params: actual)
|
244
242
|
expect(edit.enabled).to eq(false)
|
245
243
|
expect(edit.email).to eq(ENV['MAIL'])
|
246
|
-
rescue => e
|
244
|
+
rescue RestClient::ExceptionWithResponse => e
|
247
245
|
puts e.inspect
|
248
246
|
raise e
|
249
247
|
end
|
@@ -253,7 +251,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
253
251
|
begin
|
254
252
|
actual = @client.get_settings_template
|
255
253
|
expect(actual).to be_a(SendGrid4r::REST::Settings::Mail::Template)
|
256
|
-
rescue => e
|
254
|
+
rescue RestClient::ExceptionWithResponse => e
|
257
255
|
puts e.inspect
|
258
256
|
raise e
|
259
257
|
end
|
@@ -269,7 +267,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
269
267
|
edit = @client.patch_settings_template(params: actual)
|
270
268
|
expect(edit.enabled).to eq(false)
|
271
269
|
expect(edit.html_content).to eq('...<% body %>')
|
272
|
-
rescue => e
|
270
|
+
rescue RestClient::ExceptionWithResponse => e
|
273
271
|
puts e.inspect
|
274
272
|
raise e
|
275
273
|
end
|
@@ -279,7 +277,7 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
279
277
|
begin
|
280
278
|
actual = @client.get_settings_plain_content
|
281
279
|
expect(actual).to be_a(SendGrid4r::REST::Settings::Mail::PlainContent)
|
282
|
-
rescue => e
|
280
|
+
rescue RestClient::ExceptionWithResponse => e
|
283
281
|
puts e.inspect
|
284
282
|
raise e
|
285
283
|
end
|
@@ -293,283 +291,12 @@ describe SendGrid4r::REST::Settings::Mail do
|
|
293
291
|
actual.enabled = false
|
294
292
|
edit = @client.patch_settings_plain_content(params: actual)
|
295
293
|
expect(edit.enabled).to eq(false)
|
296
|
-
rescue => e
|
294
|
+
rescue RestClient::ExceptionWithResponse => e
|
297
295
|
puts e.inspect
|
298
296
|
raise e
|
299
297
|
end
|
300
298
|
end
|
301
299
|
end
|
302
|
-
|
303
|
-
context 'with block call' do
|
304
|
-
it '#get_mail_settings' do
|
305
|
-
@client.get_mail_settings do |resp, req, res|
|
306
|
-
resp =
|
307
|
-
SendGrid4r::REST::Settings.create_results(
|
308
|
-
JSON.parse(resp)
|
309
|
-
)
|
310
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Results)
|
311
|
-
resp.result.each do |result|
|
312
|
-
expect(result).to be_a(SendGrid4r::REST::Settings::Result)
|
313
|
-
end
|
314
|
-
expect(req).to be_a(RestClient::Request)
|
315
|
-
expect(res).to be_a(Net::HTTPOK)
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
it '#get_settings_address_whitelist' do
|
320
|
-
@client.get_settings_address_whitelist do |resp, req, res|
|
321
|
-
resp =
|
322
|
-
SendGrid4r::REST::Settings::Mail.create_address_whitelist(
|
323
|
-
JSON.parse(resp)
|
324
|
-
)
|
325
|
-
expect(resp).to be_a(
|
326
|
-
SendGrid4r::REST::Settings::Mail::AddressWhitelist
|
327
|
-
)
|
328
|
-
expect(req).to be_a(RestClient::Request)
|
329
|
-
expect(res).to be_a(Net::HTTPOK)
|
330
|
-
end
|
331
|
-
end
|
332
|
-
|
333
|
-
it '#patch_settings_address_whitelist' do
|
334
|
-
params = @client.get_settings_address_whitelist
|
335
|
-
@client.patch_settings_address_whitelist(
|
336
|
-
params: params
|
337
|
-
) do |resp, req, res|
|
338
|
-
resp =
|
339
|
-
SendGrid4r::REST::Settings::Mail.create_address_whitelist(
|
340
|
-
JSON.parse(resp)
|
341
|
-
)
|
342
|
-
expect(resp).to be_a(
|
343
|
-
SendGrid4r::REST::Settings::Mail::AddressWhitelist
|
344
|
-
)
|
345
|
-
expect(req).to be_a(RestClient::Request)
|
346
|
-
expect(res).to be_a(Net::HTTPOK)
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
it '#get_settings_bcc' do
|
351
|
-
@client.get_settings_bcc do |resp, req, res|
|
352
|
-
resp =
|
353
|
-
SendGrid4r::REST::Settings::Mail.create_bcc(
|
354
|
-
JSON.parse(resp)
|
355
|
-
)
|
356
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Bcc)
|
357
|
-
expect(req).to be_a(RestClient::Request)
|
358
|
-
expect(res).to be_a(Net::HTTPOK)
|
359
|
-
end
|
360
|
-
end
|
361
|
-
|
362
|
-
it '#patch_settings_bcc' do
|
363
|
-
params = @client.get_settings_bcc
|
364
|
-
@client.patch_settings_bcc(params: params) do |resp, req, res|
|
365
|
-
resp =
|
366
|
-
SendGrid4r::REST::Settings::Mail.create_bcc(
|
367
|
-
JSON.parse(resp)
|
368
|
-
)
|
369
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Bcc)
|
370
|
-
expect(req).to be_a(RestClient::Request)
|
371
|
-
expect(res).to be_a(Net::HTTPOK)
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
it '#get_settings_bounce_purge' do
|
376
|
-
@client.get_settings_bounce_purge do |resp, req, res|
|
377
|
-
resp =
|
378
|
-
SendGrid4r::REST::Settings::Mail.create_bounce_purge(
|
379
|
-
JSON.parse(resp)
|
380
|
-
)
|
381
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::BouncePurge)
|
382
|
-
expect(req).to be_a(RestClient::Request)
|
383
|
-
expect(res).to be_a(Net::HTTPOK)
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
it '#patch_settings_bounce_purge' do
|
388
|
-
params = @client.get_settings_bounce_purge
|
389
|
-
@client.patch_settings_bounce_purge(params: params) do |resp, req, res|
|
390
|
-
resp =
|
391
|
-
SendGrid4r::REST::Settings::Mail.create_bounce_purge(
|
392
|
-
JSON.parse(resp)
|
393
|
-
)
|
394
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::BouncePurge)
|
395
|
-
expect(req).to be_a(RestClient::Request)
|
396
|
-
expect(res).to be_a(Net::HTTPOK)
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
it '#get_settings_event_notification' do
|
401
|
-
@client.get_settings_event_notification do |resp, req, res|
|
402
|
-
resp =
|
403
|
-
SendGrid4r::REST::Settings::Mail.create_event_notification(
|
404
|
-
JSON.parse(resp)
|
405
|
-
)
|
406
|
-
expect(resp).to be_a(
|
407
|
-
SendGrid4r::REST::Settings::Mail::EventNotification
|
408
|
-
)
|
409
|
-
expect(req).to be_a(RestClient::Request)
|
410
|
-
expect(res).to be_a(Net::HTTPOK)
|
411
|
-
end
|
412
|
-
end
|
413
|
-
|
414
|
-
it '#patch_settings_event_notification' do
|
415
|
-
params = @client.get_settings_event_notification
|
416
|
-
@client.patch_settings_event_notification(
|
417
|
-
params: params
|
418
|
-
) do |resp, req, res|
|
419
|
-
resp =
|
420
|
-
SendGrid4r::REST::Settings::Mail.create_event_notification(
|
421
|
-
JSON.parse(resp)
|
422
|
-
)
|
423
|
-
expect(resp).to be_a(
|
424
|
-
SendGrid4r::REST::Settings::Mail::EventNotification
|
425
|
-
)
|
426
|
-
expect(req).to be_a(RestClient::Request)
|
427
|
-
expect(res).to be_a(Net::HTTPOK)
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
it '#test_settings_event_notification' do
|
432
|
-
begin
|
433
|
-
@client.test_settings_event_notification(
|
434
|
-
url: ENV['EVENT_URL']
|
435
|
-
) do |resp, req, res|
|
436
|
-
expect(resp).to eq('')
|
437
|
-
expect(req).to be_a(RestClient::Request)
|
438
|
-
expect(res).to be_a(Net::HTTPNoContent)
|
439
|
-
end
|
440
|
-
rescue => e
|
441
|
-
puts e.inspect
|
442
|
-
raise e
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
|
-
it '#get_settings_footer' do
|
447
|
-
@client.get_settings_footer do |resp, req, res|
|
448
|
-
resp =
|
449
|
-
SendGrid4r::REST::Settings::Mail.create_footer(
|
450
|
-
JSON.parse(resp)
|
451
|
-
)
|
452
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Footer)
|
453
|
-
expect(req).to be_a(RestClient::Request)
|
454
|
-
expect(res).to be_a(Net::HTTPOK)
|
455
|
-
end
|
456
|
-
end
|
457
|
-
|
458
|
-
it '#patch_settings_footer' do
|
459
|
-
params = @client.get_settings_footer
|
460
|
-
@client.patch_settings_footer(params: params) do |resp, req, res|
|
461
|
-
resp =
|
462
|
-
SendGrid4r::REST::Settings::Mail.create_footer(
|
463
|
-
JSON.parse(resp)
|
464
|
-
)
|
465
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Footer)
|
466
|
-
expect(req).to be_a(RestClient::Request)
|
467
|
-
expect(res).to be_a(Net::HTTPOK)
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
it '#get_settings_forward_bounce' do
|
472
|
-
@client.get_settings_forward_bounce do |resp, req, res|
|
473
|
-
resp =
|
474
|
-
SendGrid4r::REST::Settings::Mail.create_forward_bounce(
|
475
|
-
JSON.parse(resp)
|
476
|
-
)
|
477
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::ForwardBounce)
|
478
|
-
expect(req).to be_a(RestClient::Request)
|
479
|
-
expect(res).to be_a(Net::HTTPOK)
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
|
-
it '#patch_settings_forward_bounce' do
|
484
|
-
params = @client.get_settings_forward_bounce
|
485
|
-
@client.patch_settings_forward_bounce(
|
486
|
-
params: params
|
487
|
-
) do |resp, req, res|
|
488
|
-
resp =
|
489
|
-
SendGrid4r::REST::Settings::Mail.create_forward_bounce(
|
490
|
-
JSON.parse(resp)
|
491
|
-
)
|
492
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::ForwardBounce)
|
493
|
-
expect(req).to be_a(RestClient::Request)
|
494
|
-
expect(res).to be_a(Net::HTTPOK)
|
495
|
-
end
|
496
|
-
end
|
497
|
-
|
498
|
-
it '#get_settings_forward_spam' do
|
499
|
-
@client.get_settings_forward_spam do |resp, req, res|
|
500
|
-
resp =
|
501
|
-
SendGrid4r::REST::Settings::Mail.create_forward_spam(
|
502
|
-
JSON.parse(resp)
|
503
|
-
)
|
504
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::ForwardSpam)
|
505
|
-
expect(req).to be_a(RestClient::Request)
|
506
|
-
expect(res).to be_a(Net::HTTPOK)
|
507
|
-
end
|
508
|
-
end
|
509
|
-
|
510
|
-
it '#patch_settings_forward_spam' do
|
511
|
-
params = @client.get_settings_forward_spam
|
512
|
-
@client.patch_settings_forward_spam(params: params) do |resp, req, res|
|
513
|
-
resp =
|
514
|
-
SendGrid4r::REST::Settings::Mail.create_forward_spam(
|
515
|
-
JSON.parse(resp)
|
516
|
-
)
|
517
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::ForwardSpam)
|
518
|
-
expect(req).to be_a(RestClient::Request)
|
519
|
-
expect(res).to be_a(Net::HTTPOK)
|
520
|
-
end
|
521
|
-
end
|
522
|
-
|
523
|
-
it '#get_settings_template' do
|
524
|
-
@client.get_settings_template do |resp, req, res|
|
525
|
-
resp =
|
526
|
-
SendGrid4r::REST::Settings::Mail.create_template(
|
527
|
-
JSON.parse(resp)
|
528
|
-
)
|
529
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Template)
|
530
|
-
expect(req).to be_a(RestClient::Request)
|
531
|
-
expect(res).to be_a(Net::HTTPOK)
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
it '#patch_settings_template' do
|
536
|
-
params = @client.get_settings_template
|
537
|
-
@client.patch_settings_template(params: params) do |resp, req, res|
|
538
|
-
resp =
|
539
|
-
SendGrid4r::REST::Settings::Mail.create_template(
|
540
|
-
JSON.parse(resp)
|
541
|
-
)
|
542
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::Template)
|
543
|
-
expect(req).to be_a(RestClient::Request)
|
544
|
-
expect(res).to be_a(Net::HTTPOK)
|
545
|
-
end
|
546
|
-
end
|
547
|
-
|
548
|
-
it '#get_settings_plain_content' do
|
549
|
-
@client.get_settings_template do |resp, req, res|
|
550
|
-
resp =
|
551
|
-
SendGrid4r::REST::Settings::Mail.create_plain_content(
|
552
|
-
JSON.parse(resp)
|
553
|
-
)
|
554
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::PlainContent)
|
555
|
-
expect(req).to be_a(RestClient::Request)
|
556
|
-
expect(res).to be_a(Net::HTTPOK)
|
557
|
-
end
|
558
|
-
end
|
559
|
-
|
560
|
-
it '#patch_settings_plain_content' do
|
561
|
-
params = @client.get_settings_plain_content
|
562
|
-
@client.patch_settings_plain_content(params: params) do |resp, req, res|
|
563
|
-
resp =
|
564
|
-
SendGrid4r::REST::Settings::Mail.create_plain_content(
|
565
|
-
JSON.parse(resp)
|
566
|
-
)
|
567
|
-
expect(resp).to be_a(SendGrid4r::REST::Settings::Mail::PlainContent)
|
568
|
-
expect(req).to be_a(RestClient::Request)
|
569
|
-
expect(res).to be_a(Net::HTTPOK)
|
570
|
-
end
|
571
|
-
end
|
572
|
-
end
|
573
300
|
end
|
574
301
|
|
575
302
|
describe 'unit test', :ut do
|