sendgrid-ruby 6.3.2 → 6.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -1
  3. data/.rubocop.yml +8 -0
  4. data/.rubocop_todo.yml +109 -0
  5. data/.travis.yml +2 -3
  6. data/CHANGELOG.md +61 -9
  7. data/CONTRIBUTING.md +10 -20
  8. data/FIRST_TIMERS.md +79 -0
  9. data/ISSUE_TEMPLATE.md +5 -1
  10. data/{LICENSE.md → LICENSE} +0 -0
  11. data/Makefile +3 -2
  12. data/PULL_REQUEST_TEMPLATE.md +5 -5
  13. data/README.md +24 -29
  14. data/Rakefile +2 -3
  15. data/TROUBLESHOOTING.md +5 -5
  16. data/USAGE.md +146 -39
  17. data/examples/accesssettings/accesssettings.rb +9 -12
  18. data/examples/alerts/alerts.rb +8 -11
  19. data/examples/apikeys/apikeys.rb +12 -15
  20. data/examples/asm/asm.rb +27 -30
  21. data/examples/browsers/browsers.rb +0 -3
  22. data/examples/campaigns/campaigns.rb +29 -32
  23. data/examples/categories/categories.rb +0 -3
  24. data/examples/clients/clients.rb +1 -4
  25. data/examples/contactdb/contactdb.rb +63 -66
  26. data/examples/devices/devices.rb +0 -3
  27. data/examples/emailactivity/emailactivity.rb +52 -0
  28. data/examples/geo/geo.rb +0 -3
  29. data/examples/helpers/eventwebhook/example.rb +4 -4
  30. data/examples/helpers/mail/example.rb +19 -13
  31. data/examples/helpers/settings/example.rb +1 -1
  32. data/examples/helpers/stats/example.rb +4 -4
  33. data/examples/ips/ips.rb +19 -22
  34. data/examples/mail/mail.rb +72 -75
  35. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  36. data/examples/mailsettings/mailsettings.rb +21 -24
  37. data/examples/partnersettings/partnersettings.rb +3 -6
  38. data/examples/scopes/scopes.rb +8 -10
  39. data/examples/senderauthentication/senderauthentication.rb +41 -44
  40. data/examples/senders/senders.rb +28 -31
  41. data/examples/stats/stats.rb +0 -3
  42. data/examples/subusers/subusers.rb +17 -20
  43. data/examples/suppression/suppression.rb +15 -18
  44. data/examples/templates/templates.rb +29 -31
  45. data/examples/trackingsettings/trackingsettings.rb +14 -17
  46. data/examples/user/user.rb +41 -44
  47. data/lib/rack/sendgrid_webhook_verification.rb +5 -2
  48. data/lib/sendgrid/base_interface.rb +2 -1
  49. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +4 -6
  50. data/lib/sendgrid/helpers/inbound/README.md +5 -5
  51. data/lib/sendgrid/helpers/inbound/app.rb +2 -2
  52. data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
  53. data/lib/sendgrid/helpers/inbound/send.rb +3 -3
  54. data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
  55. data/lib/sendgrid/helpers/mail/README.md +3 -3
  56. data/lib/sendgrid/helpers/mail/asm.rb +6 -18
  57. data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
  58. data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
  59. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
  60. data/lib/sendgrid/helpers/mail/category.rb +2 -2
  61. data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
  62. data/lib/sendgrid/helpers/mail/content.rb +4 -3
  63. data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
  64. data/lib/sendgrid/helpers/mail/email.rb +5 -4
  65. data/lib/sendgrid/helpers/mail/footer.rb +7 -27
  66. data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
  67. data/lib/sendgrid/helpers/mail/header.rb +6 -10
  68. data/lib/sendgrid/helpers/mail/mail.rb +30 -48
  69. data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
  70. data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
  71. data/lib/sendgrid/helpers/mail/personalization.rb +34 -27
  72. data/lib/sendgrid/helpers/mail/section.rb +6 -10
  73. data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
  74. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
  75. data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
  76. data/lib/sendgrid/helpers/mail/tracking_settings.rb +8 -20
  77. data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
  78. data/lib/sendgrid/helpers/settings/README.md +2 -2
  79. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  80. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  81. data/lib/sendgrid/helpers/stats/metrics.rb +5 -5
  82. data/lib/sendgrid/sendgrid.rb +1 -1
  83. data/lib/sendgrid/twilio_email.rb +1 -1
  84. data/lib/sendgrid/version.rb +1 -1
  85. data/mail_helper_v3.md +12 -12
  86. data/sendgrid-ruby.gemspec +8 -9
  87. data/spec/fixtures/event_webhook.rb +17 -11
  88. data/spec/rack/sendgrid_webhook_verification_spec.rb +30 -4
  89. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +38 -36
  90. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
  91. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
  92. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  93. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
  94. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
  95. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  96. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  97. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  98. data/spec/spec_helper.rb +1 -1
  99. data/static/img/github-fork.png +0 -0
  100. data/static/img/github-sign-up.png +0 -0
  101. data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
  102. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  103. data/test/sendgrid/helpers/mail/test_email.rb +9 -11
  104. data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
  105. data/test/sendgrid/helpers/mail/test_personalizations.rb +106 -93
  106. data/test/sendgrid/permissions/test_scopes.rb +1 -3
  107. data/test/sendgrid/test_sendgrid-ruby.rb +1947 -1959
  108. data/twilio_sendgrid_logo.png +0 -0
  109. data/use-cases/README.md +16 -0
  110. data/use-cases/domain-authentication.md +5 -0
  111. data/use-cases/email-statistics.md +52 -0
  112. data/use-cases/legacy-templates.md +98 -0
  113. data/use-cases/sms.md +39 -0
  114. data/use-cases/transactional-templates.md +111 -0
  115. data/use-cases/twilio-email.md +13 -0
  116. data/use-cases/twilio-setup.md +54 -0
  117. metadata +52 -41
  118. data/USE_CASES.md +0 -405
  119. data/docker/Dockerfile +0 -12
  120. data/docker/README.md +0 -30
@@ -1,9 +1,7 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Retrieve all categories #
9
7
  # GET /categories #
@@ -33,4 +31,3 @@ response = sg.client.categories.stats.sums.get(query_params: params)
33
31
  puts response.status_code
34
32
  puts response.body
35
33
  puts response.headers
36
-
@@ -1,9 +1,7 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Retrieve email statistics by client type. #
9
7
  # GET /clients/stats #
@@ -19,9 +17,8 @@ puts response.headers
19
17
  # GET /clients/{client_type}/stats #
20
18
 
21
19
  params = JSON.parse('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}')
22
- client_type = "test_url_param"
20
+ client_type = 'test_url_param'
23
21
  response = sg.client.clients._(client_type).stats.get(query_params: params)
24
22
  puts response.status_code
25
23
  puts response.body
26
24
  puts response.headers
27
-
@@ -1,15 +1,13 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Create a Custom Field #
9
7
  # POST /contactdb/custom_fields #
10
8
 
11
9
  data = JSON.parse('{
12
- "name": "pet",
10
+ "name": "pet",
13
11
  "type": "text"
14
12
  }')
15
13
  response = sg.client.contactdb.custom_fields.post(request_body: data)
@@ -21,7 +19,7 @@ puts response.headers
21
19
  # Retrieve all custom fields #
22
20
  # GET /contactdb/custom_fields #
23
21
 
24
- response = sg.client.contactdb.custom_fields.get()
22
+ response = sg.client.contactdb.custom_fields.get
25
23
  puts response.status_code
26
24
  puts response.body
27
25
  puts response.headers
@@ -30,8 +28,8 @@ puts response.headers
30
28
  # Retrieve a Custom Field #
31
29
  # GET /contactdb/custom_fields/{custom_field_id} #
32
30
 
33
- custom_field_id = "test_url_param"
34
- response = sg.client.contactdb.custom_fields._(custom_field_id).get()
31
+ custom_field_id = 'test_url_param'
32
+ response = sg.client.contactdb.custom_fields._(custom_field_id).get
35
33
  puts response.status_code
36
34
  puts response.body
37
35
  puts response.headers
@@ -40,8 +38,8 @@ puts response.headers
40
38
  # Delete a Custom Field #
41
39
  # DELETE /contactdb/custom_fields/{custom_field_id} #
42
40
 
43
- custom_field_id = "test_url_param"
44
- response = sg.client.contactdb.custom_fields._(custom_field_id).delete()
41
+ custom_field_id = 'test_url_param'
42
+ response = sg.client.contactdb.custom_fields._(custom_field_id).delete
45
43
  puts response.status_code
46
44
  puts response.body
47
45
  puts response.headers
@@ -62,7 +60,7 @@ puts response.headers
62
60
  # Retrieve all lists #
63
61
  # GET /contactdb/lists #
64
62
 
65
- response = sg.client.contactdb.lists.get()
63
+ response = sg.client.contactdb.lists.get
66
64
  puts response.status_code
67
65
  puts response.body
68
66
  puts response.headers
@@ -72,9 +70,9 @@ puts response.headers
72
70
  # DELETE /contactdb/lists #
73
71
 
74
72
  data = JSON.parse('[
75
- 1,
76
- 2,
77
- 3,
73
+ 1,
74
+ 2,
75
+ 3,
78
76
  4
79
77
  ]')
80
78
  response = sg.client.contactdb.lists.delete(request_body: data)
@@ -90,7 +88,7 @@ data = JSON.parse('{
90
88
  "name": "newlistname"
91
89
  }')
92
90
  params = JSON.parse('{"list_id": 1}')
93
- list_id = "test_url_param"
91
+ list_id = 'test_url_param'
94
92
  response = sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params)
95
93
  puts response.status_code
96
94
  puts response.body
@@ -101,7 +99,7 @@ puts response.headers
101
99
  # GET /contactdb/lists/{list_id} #
102
100
 
103
101
  params = JSON.parse('{"list_id": 1}')
104
- list_id = "test_url_param"
102
+ list_id = 'test_url_param'
105
103
  response = sg.client.contactdb.lists._(list_id).get(query_params: params)
106
104
  puts response.status_code
107
105
  puts response.body
@@ -112,7 +110,7 @@ puts response.headers
112
110
  # DELETE /contactdb/lists/{list_id} #
113
111
 
114
112
  params = JSON.parse('{"delete_contacts": "true"}')
115
- list_id = "test_url_param"
113
+ list_id = 'test_url_param'
116
114
  response = sg.client.contactdb.lists._(list_id).delete(query_params: params)
117
115
  puts response.status_code
118
116
  puts response.body
@@ -123,10 +121,10 @@ puts response.headers
123
121
  # POST /contactdb/lists/{list_id}/recipients #
124
122
 
125
123
  data = JSON.parse('[
126
- "recipient_id1",
124
+ "recipient_id1",
127
125
  "recipient_id2"
128
126
  ]')
129
- list_id = "test_url_param"
127
+ list_id = 'test_url_param'
130
128
  response = sg.client.contactdb.lists._(list_id).recipients.post(request_body: data)
131
129
  puts response.status_code
132
130
  puts response.body
@@ -137,7 +135,7 @@ puts response.headers
137
135
  # GET /contactdb/lists/{list_id}/recipients #
138
136
 
139
137
  params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}')
140
- list_id = "test_url_param"
138
+ list_id = 'test_url_param'
141
139
  response = sg.client.contactdb.lists._(list_id).recipients.get(query_params: params)
142
140
  puts response.status_code
143
141
  puts response.body
@@ -147,9 +145,9 @@ puts response.headers
147
145
  # Add a Single Recipient to a List #
148
146
  # POST /contactdb/lists/{list_id}/recipients/{recipient_id} #
149
147
 
150
- list_id = "test_url_param"
151
- recipient_id = "test_url_param"
152
- response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post()
148
+ list_id = 'test_url_param'
149
+ recipient_id = 'test_url_param'
150
+ response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).post
153
151
  puts response.status_code
154
152
  puts response.body
155
153
  puts response.headers
@@ -159,8 +157,8 @@ puts response.headers
159
157
  # DELETE /contactdb/lists/{list_id}/recipients/{recipient_id} #
160
158
 
161
159
  params = JSON.parse('{"recipient_id": 1, "list_id": 1}')
162
- list_id = "test_url_param"
163
- recipient_id = "test_url_param"
160
+ list_id = 'test_url_param'
161
+ recipient_id = 'test_url_param'
164
162
  response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params)
165
163
  puts response.status_code
166
164
  puts response.body
@@ -172,8 +170,8 @@ puts response.headers
172
170
 
173
171
  data = JSON.parse('[
174
172
  {
175
- "email": "jones@example.com",
176
- "first_name": "Guy",
173
+ "email": "jones@example.com",
174
+ "first_name": "Guy",
177
175
  "last_name": "Jones"
178
176
  }
179
177
  ]')
@@ -188,15 +186,15 @@ puts response.headers
188
186
 
189
187
  data = JSON.parse('[
190
188
  {
191
- "age": 25,
192
- "email": "example@example.com",
193
- "first_name": "",
189
+ "age": 25,
190
+ "email": "example@example.com",
191
+ "first_name": "",
194
192
  "last_name": "User"
195
- },
193
+ },
196
194
  {
197
- "age": 25,
198
- "email": "example2@example.com",
199
- "first_name": "Example",
195
+ "age": 25,
196
+ "email": "example2@example.com",
197
+ "first_name": "Example",
200
198
  "last_name": "User"
201
199
  }
202
200
  ]')
@@ -220,7 +218,7 @@ puts response.headers
220
218
  # DELETE /contactdb/recipients #
221
219
 
222
220
  data = JSON.parse('[
223
- "recipient_id1",
221
+ "recipient_id1",
224
222
  "recipient_id2"
225
223
  ]')
226
224
  response = sg.client.contactdb.recipients.delete(request_body: data)
@@ -232,7 +230,7 @@ puts response.headers
232
230
  # Retrieve the count of billable recipients #
233
231
  # GET /contactdb/recipients/billable_count #
234
232
 
235
- response = sg.client.contactdb.recipients.billable_count.get()
233
+ response = sg.client.contactdb.recipients.billable_count.get
236
234
  puts response.status_code
237
235
  puts response.body
238
236
  puts response.headers
@@ -241,7 +239,7 @@ puts response.headers
241
239
  # Retrieve a Count of Recipients #
242
240
  # GET /contactdb/recipients/count #
243
241
 
244
- response = sg.client.contactdb.recipients.count.get()
242
+ response = sg.client.contactdb.recipients.count.get
245
243
  puts response.status_code
246
244
  puts response.body
247
245
  puts response.headers
@@ -260,8 +258,8 @@ puts response.headers
260
258
  # Retrieve a single recipient #
261
259
  # GET /contactdb/recipients/{recipient_id} #
262
260
 
263
- recipient_id = "test_url_param"
264
- response = sg.client.contactdb.recipients._(recipient_id).get()
261
+ recipient_id = 'test_url_param'
262
+ response = sg.client.contactdb.recipients._(recipient_id).get
265
263
  puts response.status_code
266
264
  puts response.body
267
265
  puts response.headers
@@ -270,8 +268,8 @@ puts response.headers
270
268
  # Delete a Recipient #
271
269
  # DELETE /contactdb/recipients/{recipient_id} #
272
270
 
273
- recipient_id = "test_url_param"
274
- response = sg.client.contactdb.recipients._(recipient_id).delete()
271
+ recipient_id = 'test_url_param'
272
+ response = sg.client.contactdb.recipients._(recipient_id).delete
275
273
  puts response.status_code
276
274
  puts response.body
277
275
  puts response.headers
@@ -280,8 +278,8 @@ puts response.headers
280
278
  # Retrieve the lists that a recipient is on #
281
279
  # GET /contactdb/recipients/{recipient_id}/lists #
282
280
 
283
- recipient_id = "test_url_param"
284
- response = sg.client.contactdb.recipients._(recipient_id).lists.get()
281
+ recipient_id = 'test_url_param'
282
+ response = sg.client.contactdb.recipients._(recipient_id).lists.get
285
283
  puts response.status_code
286
284
  puts response.body
287
285
  puts response.headers
@@ -290,7 +288,7 @@ puts response.headers
290
288
  # Retrieve reserved fields #
291
289
  # GET /contactdb/reserved_fields #
292
290
 
293
- response = sg.client.contactdb.reserved_fields.get()
291
+ response = sg.client.contactdb.reserved_fields.get
294
292
  puts response.status_code
295
293
  puts response.body
296
294
  puts response.headers
@@ -302,25 +300,25 @@ puts response.headers
302
300
  data = JSON.parse('{
303
301
  "conditions": [
304
302
  {
305
- "and_or": "",
306
- "field": "last_name",
307
- "operator": "eq",
303
+ "and_or": "",
304
+ "field": "last_name",
305
+ "operator": "eq",
308
306
  "value": "Miller"
309
- },
307
+ },
310
308
  {
311
- "and_or": "and",
312
- "field": "last_clicked",
313
- "operator": "gt",
309
+ "and_or": "and",
310
+ "field": "last_clicked",
311
+ "operator": "gt",
314
312
  "value": "01/02/2015"
315
- },
313
+ },
316
314
  {
317
- "and_or": "or",
318
- "field": "clicks.campaign_identifier",
319
- "operator": "eq",
315
+ "and_or": "or",
316
+ "field": "clicks.campaign_identifier",
317
+ "operator": "eq",
320
318
  "value": "513"
321
319
  }
322
- ],
323
- "list_id": 4,
320
+ ],
321
+ "list_id": 4,
324
322
  "name": "Last Name Miller"
325
323
  }')
326
324
  response = sg.client.contactdb.segments.post(request_body: data)
@@ -332,7 +330,7 @@ puts response.headers
332
330
  # Retrieve all segments #
333
331
  # GET /contactdb/segments #
334
332
 
335
- response = sg.client.contactdb.segments.get()
333
+ response = sg.client.contactdb.segments.get
336
334
  puts response.status_code
337
335
  puts response.body
338
336
  puts response.headers
@@ -344,17 +342,17 @@ puts response.headers
344
342
  data = JSON.parse('{
345
343
  "conditions": [
346
344
  {
347
- "and_or": "",
348
- "field": "last_name",
349
- "operator": "eq",
345
+ "and_or": "",
346
+ "field": "last_name",
347
+ "operator": "eq",
350
348
  "value": "Miller"
351
349
  }
352
- ],
353
- "list_id": 5,
350
+ ],
351
+ "list_id": 5,
354
352
  "name": "The Millers"
355
353
  }')
356
354
  params = JSON.parse('{"segment_id": "test_string"}')
357
- segment_id = "test_url_param"
355
+ segment_id = 'test_url_param'
358
356
  response = sg.client.contactdb.segments._(segment_id).patch(request_body: data, query_params: params)
359
357
  puts response.status_code
360
358
  puts response.body
@@ -365,7 +363,7 @@ puts response.headers
365
363
  # GET /contactdb/segments/{segment_id} #
366
364
 
367
365
  params = JSON.parse('{"segment_id": 1}')
368
- segment_id = "test_url_param"
366
+ segment_id = 'test_url_param'
369
367
  response = sg.client.contactdb.segments._(segment_id).get(query_params: params)
370
368
  puts response.status_code
371
369
  puts response.body
@@ -376,7 +374,7 @@ puts response.headers
376
374
  # DELETE /contactdb/segments/{segment_id} #
377
375
 
378
376
  params = JSON.parse('{"delete_contacts": "true"}')
379
- segment_id = "test_url_param"
377
+ segment_id = 'test_url_param'
380
378
  response = sg.client.contactdb.segments._(segment_id).delete(query_params: params)
381
379
  puts response.status_code
382
380
  puts response.body
@@ -387,9 +385,8 @@ puts response.headers
387
385
  # GET /contactdb/segments/{segment_id}/recipients #
388
386
 
389
387
  params = JSON.parse('{"page": 1, "page_size": 1}')
390
- segment_id = "test_url_param"
388
+ segment_id = 'test_url_param'
391
389
  response = sg.client.contactdb.segments._(segment_id).recipients.get(query_params: params)
392
390
  puts response.status_code
393
391
  puts response.body
394
392
  puts response.headers
395
-
@@ -1,9 +1,7 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Retrieve email statistics by device type. #
9
7
  # GET /devices/stats #
@@ -13,4 +11,3 @@ response = sg.client.devices.stats.get(query_params: params)
13
11
  puts response.status_code
14
12
  puts response.body
15
13
  puts response.headers
16
-
@@ -0,0 +1,52 @@
1
+ require 'sendgrid-ruby'
2
+
3
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
4
+
5
+ ##################################################
6
+ # Filter all messages #
7
+ # GET /messages #
8
+
9
+ require 'erb'
10
+
11
+ filter_key = 'to_email'
12
+ filter_operator = ERB::Util.url_encode('=')
13
+ filter_value = 'testing@sendgrid.net'
14
+ filter_value = ERB::Util.url_encode(format('"%s"', filter_value))
15
+ query_params = {}
16
+ query_params['query'] = format("%s%s%s", filter_key, filter_operator, filter_value)
17
+ query_params['limit'] = '1'
18
+
19
+ params = query_params
20
+ response = sg.client.messages.get(query_params: params)
21
+ puts response.status_code
22
+ puts response.body
23
+ puts response.headers
24
+
25
+ ##################################################
26
+ # Filter messages by message ID #
27
+ # GET /messages/{msg_id} #
28
+
29
+ msg_id = "test_url_param"
30
+ response = sg.client.messages._(msg_id).get
31
+ puts response.status_code
32
+ puts response.body
33
+ puts response.headers
34
+
35
+ ##################################################
36
+ # Request a CSV #
37
+ # POST /messages/download #
38
+
39
+ response = sg.client.messages.download.post
40
+ puts response.status_code
41
+ puts response.body
42
+ puts response.headers
43
+
44
+ ##################################################
45
+ # Download CSV #
46
+ # GET /messages/download/{download_uuid} #
47
+
48
+ download_uuid = "test_url_param"
49
+ response = sg.client.messages.download._(download_uuid).get
50
+ puts response.status_code
51
+ puts response.body
52
+ puts response.headers
@@ -1,9 +1,7 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Retrieve email statistics by country and state/province. #
9
7
  # GET /geo/stats #
@@ -13,4 +11,3 @@ response = sg.client.geo.stats.get(query_params: params)
13
11
  puts response.status_code
14
12
  puts response.body
15
13
  puts response.headers
16
-