sendgrid-ruby 3.0.4 → 3.0.5

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.
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve email statistics by mailbox provider. #
22
9
  # GET /mailbox_providers/stats #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve all mail settings #
22
9
  # GET /mail_settings #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Returns a list of all partner settings. #
22
9
  # GET /partner_settings #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve a list of scopes for which this user has access. #
22
9
  # GET /scopes #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve global email statistics #
22
9
  # GET /stats #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Create Subuser #
22
9
  # POST /subusers #
@@ -39,7 +26,7 @@ puts response.headers
39
26
  # List all Subusers #
40
27
  # GET /subusers #
41
28
 
42
- params = JSON.parse('{"username": "test_string", "limit": 0, "offset": 0}')
29
+ params = JSON.parse('{"username": "test_string", "limit": 1, "offset": 1}')
43
30
  response = sg.client.subusers.get(query_params: params)
44
31
  puts response.status_code
45
32
  puts response.body
@@ -173,7 +160,7 @@ puts response.headers
173
160
  # Retrieve the monthly email statistics for a single subuser #
174
161
  # GET /subusers/{subuser_name}/stats/monthly #
175
162
 
176
- params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 0, "sort_by_metric": "test_string", "offset": 1}')
163
+ params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
177
164
  subuser_name = "test_url_param"
178
165
  response = sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params)
179
166
  puts response.status_code
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve all blocks #
22
9
  # GET /suppression/blocks #
@@ -60,7 +47,7 @@ puts response.headers
60
47
  # Retrieve all bounces #
61
48
  # GET /suppression/bounces #
62
49
 
63
- params = JSON.parse('{"start_time": 0, "end_time": 0}')
50
+ params = JSON.parse('{"start_time": 1, "end_time": 1}')
64
51
  response = sg.client.suppression.bounces.get(query_params: params)
65
52
  puts response.status_code
66
53
  puts response.body
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Create a transactional template. #
22
9
  # POST /templates #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Retrieve Tracking Settings #
22
9
  # GET /tracking_settings #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Get a user's account information. #
22
9
  # GET /user/account #
@@ -236,7 +223,22 @@ puts response.body
236
223
  puts response.headers
237
224
 
238
225
  ##################################################
239
- # Retrieve Parse Webhook settings #
226
+ # Create a parse setting #
227
+ # POST /user/webhooks/parse/settings #
228
+
229
+ data = JSON.parse('{
230
+ "hostname": "myhostname.com",
231
+ "send_raw": false,
232
+ "spam_check": true,
233
+ "url": "http://email.myhosthame.com"
234
+ }')
235
+ response = sg.client.user.webhooks.parse.settings.post(request_body: data)
236
+ puts response.status_code
237
+ puts response.body
238
+ puts response.headers
239
+
240
+ ##################################################
241
+ # Retrieve all parse settings #
240
242
  # GET /user/webhooks/parse/settings #
241
243
 
242
244
  response = sg.client.user.webhooks.parse.settings.get()
@@ -244,6 +246,41 @@ puts response.status_code
244
246
  puts response.body
245
247
  puts response.headers
246
248
 
249
+ ##################################################
250
+ # Update a parse setting #
251
+ # PATCH /user/webhooks/parse/settings/{hostname} #
252
+
253
+ data = JSON.parse('{
254
+ "send_raw": true,
255
+ "spam_check": false,
256
+ "url": "http://newdomain.com/parse"
257
+ }')
258
+ hostname = "test_url_param"
259
+ response = sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data)
260
+ puts response.status_code
261
+ puts response.body
262
+ puts response.headers
263
+
264
+ ##################################################
265
+ # Retrieve a specific parse setting #
266
+ # GET /user/webhooks/parse/settings/{hostname} #
267
+
268
+ hostname = "test_url_param"
269
+ response = sg.client.user.webhooks.parse.settings._(hostname).get()
270
+ puts response.status_code
271
+ puts response.body
272
+ puts response.headers
273
+
274
+ ##################################################
275
+ # Delete a parse setting #
276
+ # DELETE /user/webhooks/parse/settings/{hostname} #
277
+
278
+ hostname = "test_url_param"
279
+ response = sg.client.user.webhooks.parse.settings._(hostname).delete()
280
+ puts response.status_code
281
+ puts response.body
282
+ puts response.headers
283
+
247
284
  ##################################################
248
285
  # Retrieves Inbound Parse Webhook statistics. #
249
286
  # GET /user/webhooks/parse/stats #
@@ -4,19 +4,6 @@ require 'sendgrid-ruby'
4
4
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
5
 
6
6
 
7
- import com.fasterxml.jackson.databind.JsonNode;
8
- import com.fasterxml.jackson.databind.ObjectMapper;
9
-
10
- import com.sendgrid.Client;
11
- import com.sendgrid.Method;
12
- import com.sendgrid.Request;
13
- import com.sendgrid.Response;
14
- import com.sendgrid.SendGrid;
15
-
16
- import java.io.IOException;
17
- import java.util.HashMap;
18
- import java.util.Map;
19
-
20
7
  ##################################################
21
8
  # Create a domain whitelabel. #
22
9
  # POST /whitelabel/domains #
@@ -21,7 +21,8 @@ module SendGrid
21
21
  @user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
22
22
  @request_headers = JSON.parse('
23
23
  {
24
- "Authorization": "Bearer ' + @api_key + '"
24
+ "Authorization": "Bearer ' + @api_key + '",
25
+ "Accept": "application/json"
25
26
  }
26
27
  ')
27
28
 
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '3.0.4'
2
+ VERSION = '3.0.5'
3
3
  end
@@ -1,4 +1,4 @@
1
- require_relative "../../lib/sendgrid/client"
1
+ require_relative '../../lib/sendgrid-ruby.rb'
2
2
  require 'ruby_http_client'
3
3
  require 'minitest/autorun'
4
4
 
@@ -24,11 +24,13 @@ class TestAPI < Minitest::Test
24
24
  test_headers = JSON.parse('
25
25
  {
26
26
  "Authorization": "Bearer SENDGRID_API_KEY",
27
+ "Accept": "application/json",
27
28
  "X-Test": "test"
28
29
  }
29
30
  ')
30
31
  assert_equal(test_headers, sg.request_headers)
31
32
  assert_equal("v3", sg.version)
33
+ assert_equal("3.0.5", SendGrid::VERSION)
32
34
  assert_instance_of(SendGrid::Client, sg.client)
33
35
  end
34
36
 
@@ -91,9 +93,51 @@ class TestAPI < Minitest::Test
91
93
  self.assert_equal(response.status_code, "204")
92
94
  end
93
95
 
96
+ def test_alerts_post
97
+ data = JSON.parse('{
98
+ "email_to": "example@example.com",
99
+ "frequency": "daily",
100
+ "type": "stats_notification"
101
+ }')
102
+ headers = JSON.parse('{"X-Mock": 201}')
103
+ response = @sg.client.alerts.post(request_body: data, request_headers: headers)
104
+ self.assert_equal(response.status_code, "201")
105
+ end
106
+
107
+ def test_alerts_get
108
+ headers = JSON.parse('{"X-Mock": 200}')
109
+ response = @sg.client.alerts.get(request_headers: headers)
110
+ self.assert_equal(response.status_code, "200")
111
+ end
112
+
113
+ def test_alerts__alert_id__patch
114
+ data = JSON.parse('{
115
+ "email_to": "example@example.com"
116
+ }')
117
+ alert_id = "test_url_param"
118
+ headers = JSON.parse('{"X-Mock": 200}')
119
+ response = @sg.client.alerts._(alert_id).patch(request_body: data, request_headers: headers)
120
+ self.assert_equal(response.status_code, "200")
121
+ end
122
+
123
+ def test_alerts__alert_id__get
124
+ alert_id = "test_url_param"
125
+ headers = JSON.parse('{"X-Mock": 200}')
126
+ response = @sg.client.alerts._(alert_id).get(request_headers: headers)
127
+ self.assert_equal(response.status_code, "200")
128
+ end
129
+
130
+ def test_alerts__alert_id__delete
131
+ alert_id = "test_url_param"
132
+ headers = JSON.parse('{"X-Mock": 204}')
133
+ response = @sg.client.alerts._(alert_id).delete(request_headers: headers)
134
+ self.assert_equal(response.status_code, "204")
135
+ end
136
+
94
137
  def test_api_keys_post
95
138
  data = JSON.parse('{
96
139
  "name": "My API Key",
140
+ "sample": "data",
97
141
  "scopes": [
98
142
  "mail.send",
99
143
  "alerts.create",
@@ -106,8 +150,9 @@ class TestAPI < Minitest::Test
106
150
  end
107
151
 
108
152
  def test_api_keys_get
153
+ params = JSON.parse('{"limit": 1}')
109
154
  headers = JSON.parse('{"X-Mock": 200}')
110
- response = @sg.client.api_keys.get(request_headers: headers)
155
+ response = @sg.client.api_keys.get(query_params: params, request_headers: headers)
111
156
  self.assert_equal(response.status_code, "200")
112
157
  end
113
158
 
@@ -151,18 +196,19 @@ class TestAPI < Minitest::Test
151
196
 
152
197
  def test_asm_groups_post
153
198
  data = JSON.parse('{
154
- "description": "A group description",
155
- "is_default": false,
156
- "name": "A group name"
199
+ "description": "Suggestions for products our users might like.",
200
+ "is_default": true,
201
+ "name": "Product Suggestions"
157
202
  }')
158
- headers = JSON.parse('{"X-Mock": 200}')
203
+ headers = JSON.parse('{"X-Mock": 201}')
159
204
  response = @sg.client.asm.groups.post(request_body: data, request_headers: headers)
160
- self.assert_equal(response.status_code, "200")
205
+ self.assert_equal(response.status_code, "201")
161
206
  end
162
207
 
163
208
  def test_asm_groups_get
209
+ params = JSON.parse('{"id": 1}')
164
210
  headers = JSON.parse('{"X-Mock": 200}')
165
- response = @sg.client.asm.groups.get(request_headers: headers)
211
+ response = @sg.client.asm.groups.get(query_params: params, request_headers: headers)
166
212
  self.assert_equal(response.status_code, "200")
167
213
  end
168
214
 
@@ -212,6 +258,20 @@ class TestAPI < Minitest::Test
212
258
  self.assert_equal(response.status_code, "200")
213
259
  end
214
260
 
261
+ def test_asm_groups__group_id__suppressions_search_post
262
+ data = JSON.parse('{
263
+ "recipient_emails": [
264
+ "exists1@example.com",
265
+ "exists2@example.com",
266
+ "doesnotexists@example.com"
267
+ ]
268
+ }')
269
+ group_id = "test_url_param"
270
+ headers = JSON.parse('{"X-Mock": 200}')
271
+ response = @sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data, request_headers: headers)
272
+ self.assert_equal(response.status_code, "200")
273
+ end
274
+
215
275
  def test_asm_groups__group_id__suppressions__email__delete
216
276
  group_id = "test_url_param"
217
277
  email = "test_url_param"
@@ -220,6 +280,12 @@ class TestAPI < Minitest::Test
220
280
  self.assert_equal(response.status_code, "204")
221
281
  end
222
282
 
283
+ def test_asm_suppressions_get
284
+ headers = JSON.parse('{"X-Mock": 200}')
285
+ response = @sg.client.asm.suppressions.get(request_headers: headers)
286
+ self.assert_equal(response.status_code, "200")
287
+ end
288
+
223
289
  def test_asm_suppressions_global_post
224
290
  data = JSON.parse('{
225
291
  "recipient_emails": [
@@ -246,6 +312,13 @@ class TestAPI < Minitest::Test
246
312
  self.assert_equal(response.status_code, "204")
247
313
  end
248
314
 
315
+ def test_asm_suppressions__email__get
316
+ email = "test_url_param"
317
+ headers = JSON.parse('{"X-Mock": 200}')
318
+ response = @sg.client.asm.suppressions._(email).get(request_headers: headers)
319
+ self.assert_equal(response.status_code, "200")
320
+ end
321
+
249
322
  def test_browsers_stats_get
250
323
  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"}')
251
324
  headers = JSON.parse('{"X-Mock": 200}')
@@ -280,7 +353,7 @@ class TestAPI < Minitest::Test
280
353
  end
281
354
 
282
355
  def test_campaigns_get
283
- params = JSON.parse('{"limit": 0, "offset": 0}')
356
+ params = JSON.parse('{"limit": 1, "offset": 1}')
284
357
  headers = JSON.parse('{"X-Mock": 200}')
285
358
  response = @sg.client.campaigns.get(query_params: params, request_headers: headers)
286
359
  self.assert_equal(response.status_code, "200")
@@ -464,7 +537,7 @@ class TestAPI < Minitest::Test
464
537
  data = JSON.parse('{
465
538
  "name": "newlistname"
466
539
  }')
467
- params = JSON.parse('{"list_id": 0}')
540
+ params = JSON.parse('{"list_id": 1}')
468
541
  list_id = "test_url_param"
469
542
  headers = JSON.parse('{"X-Mock": 200}')
470
543
  response = @sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params, request_headers: headers)
@@ -472,7 +545,7 @@ class TestAPI < Minitest::Test
472
545
  end
473
546
 
474
547
  def test_contactdb_lists__list_id__get
475
- params = JSON.parse('{"list_id": 0}')
548
+ params = JSON.parse('{"list_id": 1}')
476
549
  list_id = "test_url_param"
477
550
  headers = JSON.parse('{"X-Mock": 200}')
478
551
  response = @sg.client.contactdb.lists._(list_id).get(query_params: params, request_headers: headers)
@@ -499,7 +572,7 @@ class TestAPI < Minitest::Test
499
572
  end
500
573
 
501
574
  def test_contactdb_lists__list_id__recipients_get
502
- params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 0}')
575
+ params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}')
503
576
  list_id = "test_url_param"
504
577
  headers = JSON.parse('{"X-Mock": 200}')
505
578
  response = @sg.client.contactdb.lists._(list_id).recipients.get(query_params: params, request_headers: headers)
@@ -515,7 +588,7 @@ class TestAPI < Minitest::Test
515
588
  end
516
589
 
517
590
  def test_contactdb_lists__list_id__recipients__recipient_id__delete
518
- params = JSON.parse('{"recipient_id": 0, "list_id": 0}')
591
+ params = JSON.parse('{"recipient_id": 1, "list_id": 1}')
519
592
  list_id = "test_url_param"
520
593
  recipient_id = "test_url_param"
521
594
  headers = JSON.parse('{"X-Mock": 204}')
@@ -586,7 +659,7 @@ class TestAPI < Minitest::Test
586
659
  end
587
660
 
588
661
  def test_contactdb_recipients_search_get
589
- params = JSON.parse('{"{field_name}": "test_string"}')
662
+ params = JSON.parse('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}')
590
663
  headers = JSON.parse('{"X-Mock": 200}')
591
664
  response = @sg.client.contactdb.recipients.search.get(query_params: params, request_headers: headers)
592
665
  self.assert_equal(response.status_code, "200")
@@ -676,7 +749,7 @@ class TestAPI < Minitest::Test
676
749
  end
677
750
 
678
751
  def test_contactdb_segments__segment_id__get
679
- params = JSON.parse('{"segment_id": 0}')
752
+ params = JSON.parse('{"segment_id": 1}')
680
753
  segment_id = "test_url_param"
681
754
  headers = JSON.parse('{"X-Mock": 200}')
682
755
  response = @sg.client.contactdb.segments._(segment_id).get(query_params: params, request_headers: headers)
@@ -832,7 +905,7 @@ class TestAPI < Minitest::Test
832
905
  self.assert_equal(response.status_code, "200")
833
906
  end
834
907
 
835
- def test_mail_send_beta_post
908
+ def test_mail_send_post
836
909
  data = JSON.parse('{
837
910
  "asm": {
838
911
  "group_id": 1,
@@ -922,13 +995,8 @@ class TestAPI < Minitest::Test
922
995
  "send_at": 1409348513,
923
996
  "subject": "Hello, World!",
924
997
  "substitutions": {
925
- "sub": {
926
- "%name%": [
927
- "John",
928
- "Jane",
929
- "Sam"
930
- ]
931
- }
998
+ "id": "substitutions",
999
+ "type": "object"
932
1000
  },
933
1001
  "to": [
934
1002
  {
@@ -977,7 +1045,7 @@ class TestAPI < Minitest::Test
977
1045
  }
978
1046
  }')
979
1047
  headers = JSON.parse('{"X-Mock": 202}')
980
- response = @sg.client.mail._("send").beta.post(request_body: data, request_headers: headers)
1048
+ response = @sg.client.mail._("send").post(request_body: data, request_headers: headers)
981
1049
  self.assert_equal(response.status_code, "202")
982
1050
  end
983
1051
 
@@ -1197,7 +1265,7 @@ class TestAPI < Minitest::Test
1197
1265
  end
1198
1266
 
1199
1267
  def test_subusers_get
1200
- params = JSON.parse('{"username": "test_string", "limit": 0, "offset": 0}')
1268
+ params = JSON.parse('{"username": "test_string", "limit": 1, "offset": 1}')
1201
1269
  headers = JSON.parse('{"X-Mock": 200}')
1202
1270
  response = @sg.client.subusers.get(query_params: params, request_headers: headers)
1203
1271
  self.assert_equal(response.status_code, "200")
@@ -1295,7 +1363,7 @@ class TestAPI < Minitest::Test
1295
1363
  end
1296
1364
 
1297
1365
  def test_subusers__subuser_name__stats_monthly_get
1298
- params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 0, "sort_by_metric": "test_string", "offset": 1}')
1366
+ params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
1299
1367
  subuser_name = "test_url_param"
1300
1368
  headers = JSON.parse('{"X-Mock": 200}')
1301
1369
  response = @sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params, request_headers: headers)
@@ -1337,7 +1405,7 @@ class TestAPI < Minitest::Test
1337
1405
  end
1338
1406
 
1339
1407
  def test_suppression_bounces_get
1340
- params = JSON.parse('{"start_time": 0, "end_time": 0}')
1408
+ params = JSON.parse('{"start_time": 1, "end_time": 1}')
1341
1409
  headers = JSON.parse('{"X-Mock": 200}')
1342
1410
  response = @sg.client.suppression.bounces.get(query_params: params, request_headers: headers)
1343
1411
  self.assert_equal(response.status_code, "200")
@@ -1777,12 +1845,50 @@ class TestAPI < Minitest::Test
1777
1845
  self.assert_equal(response.status_code, "204")
1778
1846
  end
1779
1847
 
1848
+ def test_user_webhooks_parse_settings_post
1849
+ data = JSON.parse('{
1850
+ "hostname": "myhostname.com",
1851
+ "send_raw": false,
1852
+ "spam_check": true,
1853
+ "url": "http://email.myhosthame.com"
1854
+ }')
1855
+ headers = JSON.parse('{"X-Mock": 201}')
1856
+ response = @sg.client.user.webhooks.parse.settings.post(request_body: data, request_headers: headers)
1857
+ self.assert_equal(response.status_code, "201")
1858
+ end
1859
+
1780
1860
  def test_user_webhooks_parse_settings_get
1781
1861
  headers = JSON.parse('{"X-Mock": 200}')
1782
1862
  response = @sg.client.user.webhooks.parse.settings.get(request_headers: headers)
1783
1863
  self.assert_equal(response.status_code, "200")
1784
1864
  end
1785
1865
 
1866
+ def test_user_webhooks_parse_settings__hostname__patch
1867
+ data = JSON.parse('{
1868
+ "send_raw": true,
1869
+ "spam_check": false,
1870
+ "url": "http://newdomain.com/parse"
1871
+ }')
1872
+ hostname = "test_url_param"
1873
+ headers = JSON.parse('{"X-Mock": 200}')
1874
+ response = @sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data, request_headers: headers)
1875
+ self.assert_equal(response.status_code, "200")
1876
+ end
1877
+
1878
+ def test_user_webhooks_parse_settings__hostname__get
1879
+ hostname = "test_url_param"
1880
+ headers = JSON.parse('{"X-Mock": 200}')
1881
+ response = @sg.client.user.webhooks.parse.settings._(hostname).get(request_headers: headers)
1882
+ self.assert_equal(response.status_code, "200")
1883
+ end
1884
+
1885
+ def test_user_webhooks_parse_settings__hostname__delete
1886
+ hostname = "test_url_param"
1887
+ headers = JSON.parse('{"X-Mock": 204}')
1888
+ response = @sg.client.user.webhooks.parse.settings._(hostname).delete(request_headers: headers)
1889
+ self.assert_equal(response.status_code, "204")
1890
+ end
1891
+
1786
1892
  def test_user_webhooks_parse_stats_get
1787
1893
  params = JSON.parse('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}')
1788
1894
  headers = JSON.parse('{"X-Mock": 200}')