sendgrid-ruby 5.3.0 → 6.7.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.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +120 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +8 -0
  6. data/.rubocop_todo.yml +127 -0
  7. data/CHANGELOG.md +261 -8
  8. data/CODE_OF_CONDUCT.md +57 -25
  9. data/CONTRIBUTING.md +24 -71
  10. data/Dockerfile +14 -0
  11. data/FIRST_TIMERS.md +53 -0
  12. data/Gemfile +0 -1
  13. data/LICENSE +21 -0
  14. data/Makefile +14 -0
  15. data/PULL_REQUEST_TEMPLATE.md +31 -0
  16. data/README.md +39 -43
  17. data/Rakefile +3 -4
  18. data/TROUBLESHOOTING.md +41 -21
  19. data/UPGRADE.md +5 -0
  20. data/USAGE.md +1231 -1122
  21. data/examples/accesssettings/accesssettings.rb +9 -12
  22. data/examples/alerts/alerts.rb +8 -11
  23. data/examples/apikeys/apikeys.rb +12 -15
  24. data/examples/asm/asm.rb +27 -30
  25. data/examples/browsers/browsers.rb +0 -3
  26. data/examples/campaigns/campaigns.rb +29 -32
  27. data/examples/categories/categories.rb +0 -3
  28. data/examples/clients/clients.rb +1 -4
  29. data/examples/contactdb/contactdb.rb +63 -66
  30. data/examples/dataresidency/setregion.rb +48 -0
  31. data/examples/devices/devices.rb +0 -3
  32. data/examples/emailactivity/emailactivity.rb +52 -0
  33. data/examples/geo/geo.rb +0 -3
  34. data/examples/helpers/eventwebhook/example.rb +16 -0
  35. data/examples/helpers/mail/example.rb +30 -19
  36. data/examples/helpers/settings/example.rb +1 -1
  37. data/examples/helpers/stats/example.rb +4 -4
  38. data/examples/ips/ips.rb +31 -21
  39. data/examples/mail/mail.rb +73 -76
  40. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  41. data/examples/mailsettings/mailsettings.rb +21 -24
  42. data/examples/partnersettings/partnersettings.rb +3 -6
  43. data/examples/scopes/scopes.rb +49 -5
  44. data/examples/{whitelabel/whitelabel.rb → senderauthentication/senderauthentication.rb} +68 -71
  45. data/examples/senders/senders.rb +28 -31
  46. data/examples/stats/stats.rb +0 -3
  47. data/examples/subusers/subusers.rb +17 -20
  48. data/examples/suppression/suppression.rb +23 -26
  49. data/examples/templates/templates.rb +29 -31
  50. data/examples/trackingsettings/trackingsettings.rb +14 -17
  51. data/examples/user/user.rb +41 -44
  52. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  53. data/lib/sendgrid/base_interface.rb +57 -0
  54. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  55. data/lib/sendgrid/helpers/inbound/README.md +26 -9
  56. data/lib/sendgrid/helpers/inbound/app.rb +15 -3
  57. data/lib/sendgrid/helpers/inbound/public/index.html +2 -2
  58. data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +2 -2
  59. data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +2 -2
  60. data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +2 -2
  61. data/lib/sendgrid/helpers/inbound/send.rb +5 -5
  62. data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
  63. data/lib/sendgrid/helpers/mail/README.md +4 -4
  64. data/lib/sendgrid/helpers/mail/asm.rb +4 -18
  65. data/lib/sendgrid/helpers/mail/attachment.rb +30 -38
  66. data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
  67. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
  68. data/lib/sendgrid/helpers/mail/category.rb +2 -12
  69. data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
  70. data/lib/sendgrid/helpers/mail/content.rb +4 -18
  71. data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
  72. data/lib/sendgrid/helpers/mail/email.rb +10 -20
  73. data/lib/sendgrid/helpers/mail/footer.rb +5 -27
  74. data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
  75. data/lib/sendgrid/helpers/mail/header.rb +4 -10
  76. data/lib/sendgrid/helpers/mail/mail.rb +37 -87
  77. data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
  78. data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
  79. data/lib/sendgrid/helpers/mail/personalization.rb +38 -27
  80. data/lib/sendgrid/helpers/mail/section.rb +4 -10
  81. data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
  82. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
  83. data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
  84. data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
  85. data/lib/sendgrid/helpers/permissions/scope.rb +28 -0
  86. data/lib/sendgrid/helpers/permissions/scopes.yml +309 -0
  87. data/lib/sendgrid/helpers/settings/README.md +3 -3
  88. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  89. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  90. data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
  91. data/lib/sendgrid/helpers/stats/stats_response.rb +1 -3
  92. data/lib/sendgrid/sendgrid.rb +21 -0
  93. data/lib/sendgrid/twilio_email.rb +21 -0
  94. data/lib/sendgrid/version.rb +1 -1
  95. data/lib/sendgrid-ruby.rb +7 -1
  96. data/mail_helper_v3.md +21 -21
  97. data/sendgrid-ruby.gemspec +12 -12
  98. data/spec/fixtures/event_webhook.rb +22 -0
  99. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  100. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  101. data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
  102. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +3 -3
  103. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +3 -3
  104. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  105. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +3 -3
  106. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +3 -3
  107. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  108. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  109. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  110. data/spec/sendgrid/sendgrid_spec.rb +11 -0
  111. data/spec/sendgrid/twilio_email_spec.rb +11 -0
  112. data/spec/spec_helper.rb +3 -1
  113. data/static/img/github-fork.png +0 -0
  114. data/static/img/github-sign-up.png +0 -0
  115. data/test/sendgrid/helpers/mail/test_attachment.rb +33 -0
  116. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  117. data/test/sendgrid/helpers/mail/test_data_residency.rb +44 -0
  118. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  119. data/test/sendgrid/helpers/mail/test_mail.rb +126 -119
  120. data/test/sendgrid/helpers/mail/test_personalizations.rb +145 -92
  121. data/test/sendgrid/permissions/test_scopes.rb +36 -0
  122. data/test/sendgrid/test_sendgrid-ruby.rb +1961 -1979
  123. data/twilio_sendgrid_logo.png +0 -0
  124. data/use-cases/README.md +17 -0
  125. data/use-cases/domain-authentication.md +5 -0
  126. data/use-cases/email-statistics.md +52 -0
  127. data/use-cases/legacy-templates.md +98 -0
  128. data/use-cases/personalizations.md +34 -0
  129. data/use-cases/sms.md +39 -0
  130. data/use-cases/transactional-templates.md +111 -0
  131. data/use-cases/twilio-email.md +13 -0
  132. data/use-cases/twilio-setup.md +54 -0
  133. metadata +99 -45
  134. data/.codeclimate.yml +0 -21
  135. data/.github/ISSUE_TEMPLATE +0 -17
  136. data/.github/PULL_REQUEST_TEMPLATE +0 -24
  137. data/.travis.yml +0 -29
  138. data/LICENSE.txt +0 -22
  139. data/USE_CASES.md +0 -147
  140. data/docker/Dockerfile +0 -12
  141. data/docker/README.md +0 -30
  142. data/lib/sendgrid/client.rb +0 -35
  143. data/test/prism.sh +0 -42
@@ -1,23 +1,21 @@
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
- # Create a domain whitelabel. #
6
+ # Create a domain authentication. #
9
7
  # POST /whitelabel/domains #
10
8
 
11
9
  data = JSON.parse('{
12
- "automatic_security": false,
13
- "custom_spf": true,
14
- "default": true,
15
- "domain": "example.com",
10
+ "automatic_security": false,
11
+ "custom_spf": true,
12
+ "default": true,
13
+ "domain": "example.com",
16
14
  "ips": [
17
- "192.168.1.1",
15
+ "192.168.1.1",
18
16
  "192.168.1.2"
19
- ],
20
- "subdomain": "news",
17
+ ],
18
+ "subdomain": "news",
21
19
  "username": "john@example.com"
22
20
  }')
23
21
  response = sg.client.whitelabel.domains.post(request_body: data)
@@ -26,7 +24,7 @@ puts response.body
26
24
  puts response.headers
27
25
 
28
26
  ##################################################
29
- # List all domain whitelabels. #
27
+ # List all domain authentications. #
30
28
  # GET /whitelabel/domains #
31
29
 
32
30
  params = JSON.parse('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}')
@@ -36,120 +34,120 @@ puts response.body
36
34
  puts response.headers
37
35
 
38
36
  ##################################################
39
- # Get the default domain whitelabel. #
37
+ # Get the default domain authentication. #
40
38
  # GET /whitelabel/domains/default #
41
39
 
42
- response = sg.client.whitelabel.domains.default.get()
40
+ response = sg.client.whitelabel.domains.default.get
43
41
  puts response.status_code
44
42
  puts response.body
45
43
  puts response.headers
46
44
 
47
45
  ##################################################
48
- # List the domain whitelabel associated with the given user. #
46
+ # List the domain authentication associated with the given user. #
49
47
  # GET /whitelabel/domains/subuser #
50
48
 
51
- response = sg.client.whitelabel.domains.subuser.get()
49
+ response = sg.client.whitelabel.domains.subuser.get
52
50
  puts response.status_code
53
51
  puts response.body
54
52
  puts response.headers
55
53
 
56
54
  ##################################################
57
- # Disassociate a domain whitelabel from a given user. #
55
+ # Disassociate a domain authentication from a given user. #
58
56
  # DELETE /whitelabel/domains/subuser #
59
57
 
60
- response = sg.client.whitelabel.domains.subuser.delete()
58
+ response = sg.client.whitelabel.domains.subuser.delete
61
59
  puts response.status_code
62
60
  puts response.body
63
61
  puts response.headers
64
62
 
65
63
  ##################################################
66
- # Update a domain whitelabel. #
64
+ # Update a domain authentication. #
67
65
  # PATCH /whitelabel/domains/{domain_id} #
68
66
 
69
67
  data = JSON.parse('{
70
- "custom_spf": true,
68
+ "custom_spf": true,
71
69
  "default": false
72
70
  }')
73
- domain_id = "test_url_param"
71
+ domain_id = 'test_url_param'
74
72
  response = sg.client.whitelabel.domains._(domain_id).patch(request_body: data)
75
73
  puts response.status_code
76
74
  puts response.body
77
75
  puts response.headers
78
76
 
79
77
  ##################################################
80
- # Retrieve a domain whitelabel. #
78
+ # Retrieve a domain authentication. #
81
79
  # GET /whitelabel/domains/{domain_id} #
82
80
 
83
- domain_id = "test_url_param"
84
- response = sg.client.whitelabel.domains._(domain_id).get()
81
+ domain_id = 'test_url_param'
82
+ response = sg.client.whitelabel.domains._(domain_id).get
85
83
  puts response.status_code
86
84
  puts response.body
87
85
  puts response.headers
88
86
 
89
87
  ##################################################
90
- # Delete a domain whitelabel. #
88
+ # Delete a domain authentication. #
91
89
  # DELETE /whitelabel/domains/{domain_id} #
92
90
 
93
- domain_id = "test_url_param"
94
- response = sg.client.whitelabel.domains._(domain_id).delete()
91
+ domain_id = 'test_url_param'
92
+ response = sg.client.whitelabel.domains._(domain_id).delete
95
93
  puts response.status_code
96
94
  puts response.body
97
95
  puts response.headers
98
96
 
99
97
  ##################################################
100
- # Associate a domain whitelabel with a given user. #
98
+ # Associate a domain authentication with a given user. #
101
99
  # POST /whitelabel/domains/{domain_id}/subuser #
102
100
 
103
101
  data = JSON.parse('{
104
102
  "username": "jane@example.com"
105
103
  }')
106
- domain_id = "test_url_param"
104
+ domain_id = 'test_url_param'
107
105
  response = sg.client.whitelabel.domains._(domain_id).subuser.post(request_body: data)
108
106
  puts response.status_code
109
107
  puts response.body
110
108
  puts response.headers
111
109
 
112
110
  ##################################################
113
- # Add an IP to a domain whitelabel. #
111
+ # Add an IP to a domain authentication. #
114
112
  # POST /whitelabel/domains/{id}/ips #
115
113
 
116
114
  data = JSON.parse('{
117
115
  "ip": "192.168.0.1"
118
116
  }')
119
- id = "test_url_param"
117
+ id = 'test_url_param'
120
118
  response = sg.client.whitelabel.domains._(id).ips.post(request_body: data)
121
119
  puts response.status_code
122
120
  puts response.body
123
121
  puts response.headers
124
122
 
125
123
  ##################################################
126
- # Remove an IP from a domain whitelabel. #
124
+ # Remove an IP from a domain authentication. #
127
125
  # DELETE /whitelabel/domains/{id}/ips/{ip} #
128
126
 
129
- id = "test_url_param"
130
- ip = "test_url_param"
131
- response = sg.client.whitelabel.domains._(id).ips._(ip).delete()
127
+ id = 'test_url_param'
128
+ ip = 'test_url_param'
129
+ response = sg.client.whitelabel.domains._(id).ips._(ip).delete
132
130
  puts response.status_code
133
131
  puts response.body
134
132
  puts response.headers
135
133
 
136
134
  ##################################################
137
- # Validate a domain whitelabel. #
135
+ # Validate a domain authentication. #
138
136
  # POST /whitelabel/domains/{id}/validate #
139
137
 
140
- id = "test_url_param"
141
- response = sg.client.whitelabel.domains._(id).validate.post()
138
+ id = 'test_url_param'
139
+ response = sg.client.whitelabel.domains._(id).validate.post
142
140
  puts response.status_code
143
141
  puts response.body
144
142
  puts response.headers
145
143
 
146
144
  ##################################################
147
- # Create an IP whitelabel #
145
+ # Create a reverse DNS record #
148
146
  # POST /whitelabel/ips #
149
147
 
150
148
  data = JSON.parse('{
151
- "domain": "example.com",
152
- "ip": "192.168.1.1",
149
+ "domain": "example.com",
150
+ "ip": "192.168.1.1",
153
151
  "subdomain": "email"
154
152
  }')
155
153
  response = sg.client.whitelabel.ips.post(request_body: data)
@@ -158,7 +156,7 @@ puts response.body
158
156
  puts response.headers
159
157
 
160
158
  ##################################################
161
- # Retrieve all IP whitelabels #
159
+ # Retrieve a reverse DNS record #
162
160
  # GET /whitelabel/ips #
163
161
 
164
162
  params = JSON.parse('{"ip": "test_string", "limit": 1, "offset": 1}')
@@ -168,42 +166,42 @@ puts response.body
168
166
  puts response.headers
169
167
 
170
168
  ##################################################
171
- # Retrieve an IP whitelabel #
169
+ # Retrieve a reverse DNS record #
172
170
  # GET /whitelabel/ips/{id} #
173
171
 
174
- id = "test_url_param"
175
- response = sg.client.whitelabel.ips._(id).get()
172
+ id = 'test_url_param'
173
+ response = sg.client.whitelabel.ips._(id).get
176
174
  puts response.status_code
177
175
  puts response.body
178
176
  puts response.headers
179
177
 
180
178
  ##################################################
181
- # Delete an IP whitelabel #
179
+ # Delete a reverse DNS record #
182
180
  # DELETE /whitelabel/ips/{id} #
183
181
 
184
- id = "test_url_param"
185
- response = sg.client.whitelabel.ips._(id).delete()
182
+ id = 'test_url_param'
183
+ response = sg.client.whitelabel.ips._(id).delete
186
184
  puts response.status_code
187
185
  puts response.body
188
186
  puts response.headers
189
187
 
190
188
  ##################################################
191
- # Validate an IP whitelabel #
189
+ # Validate a reverse DNS record #
192
190
  # POST /whitelabel/ips/{id}/validate #
193
191
 
194
- id = "test_url_param"
195
- response = sg.client.whitelabel.ips._(id).validate.post()
192
+ id = 'test_url_param'
193
+ response = sg.client.whitelabel.ips._(id).validate.post
196
194
  puts response.status_code
197
195
  puts response.body
198
196
  puts response.headers
199
197
 
200
198
  ##################################################
201
- # Create a Link Whitelabel #
199
+ # Create a Branded Link #
202
200
  # POST /whitelabel/links #
203
201
 
204
202
  data = JSON.parse('{
205
- "default": true,
206
- "domain": "example.com",
203
+ "default": true,
204
+ "domain": "example.com",
207
205
  "subdomain": "mail"
208
206
  }')
209
207
  params = JSON.parse('{"limit": 1, "offset": 1}')
@@ -213,7 +211,7 @@ puts response.body
213
211
  puts response.headers
214
212
 
215
213
  ##################################################
216
- # Retrieve all link whitelabels #
214
+ # Retrieve all link brandings #
217
215
  # GET /whitelabel/links #
218
216
 
219
217
  params = JSON.parse('{"limit": 1}')
@@ -223,7 +221,7 @@ puts response.body
223
221
  puts response.headers
224
222
 
225
223
  ##################################################
226
- # Retrieve a Default Link Whitelabel #
224
+ # Retrieve a Default Link Branding #
227
225
  # GET /whitelabel/links/default #
228
226
 
229
227
  params = JSON.parse('{"domain": "test_string"}')
@@ -233,7 +231,7 @@ puts response.body
233
231
  puts response.headers
234
232
 
235
233
  ##################################################
236
- # Retrieve Associated Link Whitelabel #
234
+ # Retrieve Associated Link Branding #
237
235
  # GET /whitelabel/links/subuser #
238
236
 
239
237
  params = JSON.parse('{"username": "test_string"}')
@@ -243,7 +241,7 @@ puts response.body
243
241
  puts response.headers
244
242
 
245
243
  ##################################################
246
- # Disassociate a Link Whitelabel #
244
+ # Disassociate a Link Branding #
247
245
  # DELETE /whitelabel/links/subuser #
248
246
 
249
247
  params = JSON.parse('{"username": "test_string"}')
@@ -253,58 +251,57 @@ puts response.body
253
251
  puts response.headers
254
252
 
255
253
  ##################################################
256
- # Update a Link Whitelabel #
254
+ # Update a Link Branding #
257
255
  # PATCH /whitelabel/links/{id} #
258
256
 
259
257
  data = JSON.parse('{
260
258
  "default": true
261
259
  }')
262
- id = "test_url_param"
260
+ id = 'test_url_param'
263
261
  response = sg.client.whitelabel.links._(id).patch(request_body: data)
264
262
  puts response.status_code
265
263
  puts response.body
266
264
  puts response.headers
267
265
 
268
266
  ##################################################
269
- # Retrieve a Link Whitelabel #
267
+ # Retrieve a Link Branding #
270
268
  # GET /whitelabel/links/{id} #
271
269
 
272
- id = "test_url_param"
273
- response = sg.client.whitelabel.links._(id).get()
270
+ id = 'test_url_param'
271
+ response = sg.client.whitelabel.links._(id).get
274
272
  puts response.status_code
275
273
  puts response.body
276
274
  puts response.headers
277
275
 
278
276
  ##################################################
279
- # Delete a Link Whitelabel #
277
+ # Delete a Link Branding #
280
278
  # DELETE /whitelabel/links/{id} #
281
279
 
282
- id = "test_url_param"
283
- response = sg.client.whitelabel.links._(id).delete()
280
+ id = 'test_url_param'
281
+ response = sg.client.whitelabel.links._(id).delete
284
282
  puts response.status_code
285
283
  puts response.body
286
284
  puts response.headers
287
285
 
288
286
  ##################################################
289
- # Validate a Link Whitelabel #
287
+ # Validate a Link Branding #
290
288
  # POST /whitelabel/links/{id}/validate #
291
289
 
292
- id = "test_url_param"
293
- response = sg.client.whitelabel.links._(id).validate.post()
290
+ id = 'test_url_param'
291
+ response = sg.client.whitelabel.links._(id).validate.post
294
292
  puts response.status_code
295
293
  puts response.body
296
294
  puts response.headers
297
295
 
298
296
  ##################################################
299
- # Associate a Link Whitelabel #
297
+ # Associate a Link Branding #
300
298
  # POST /whitelabel/links/{link_id}/subuser #
301
299
 
302
300
  data = JSON.parse('{
303
301
  "username": "jane@example.com"
304
302
  }')
305
- link_id = "test_url_param"
303
+ link_id = 'test_url_param'
306
304
  response = sg.client.whitelabel.links._(link_id).subuser.post(request_body: data)
307
305
  puts response.status_code
308
306
  puts response.body
309
307
  puts response.headers
310
-
@@ -1,28 +1,26 @@
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 Sender Identity #
9
7
  # POST /senders #
10
8
 
11
9
  data = JSON.parse('{
12
- "address": "123 Elm St.",
13
- "address_2": "Apt. 456",
14
- "city": "Denver",
15
- "country": "United States",
10
+ "address": "123 Elm St.",
11
+ "address_2": "Apt. 456",
12
+ "city": "Denver",
13
+ "country": "United States",
16
14
  "from": {
17
- "email": "from@example.com",
15
+ "email": "from@example.com",
18
16
  "name": "Example INC"
19
- },
20
- "nickname": "My Sender ID",
17
+ },
18
+ "nickname": "My Sender ID",
21
19
  "reply_to": {
22
- "email": "replyto@example.com",
20
+ "email": "replyto@example.com",
23
21
  "name": "Example INC"
24
- },
25
- "state": "Colorado",
22
+ },
23
+ "state": "Colorado",
26
24
  "zip": "80202"
27
25
  }')
28
26
  response = sg.client.senders.post(request_body: data)
@@ -34,7 +32,7 @@ puts response.headers
34
32
  # Get all Sender Identities #
35
33
  # GET /senders #
36
34
 
37
- response = sg.client.senders.get()
35
+ response = sg.client.senders.get
38
36
  puts response.status_code
39
37
  puts response.body
40
38
  puts response.headers
@@ -44,23 +42,23 @@ puts response.headers
44
42
  # PATCH /senders/{sender_id} #
45
43
 
46
44
  data = JSON.parse('{
47
- "address": "123 Elm St.",
48
- "address_2": "Apt. 456",
49
- "city": "Denver",
50
- "country": "United States",
45
+ "address": "123 Elm St.",
46
+ "address_2": "Apt. 456",
47
+ "city": "Denver",
48
+ "country": "United States",
51
49
  "from": {
52
- "email": "from@example.com",
50
+ "email": "from@example.com",
53
51
  "name": "Example INC"
54
- },
55
- "nickname": "My Sender ID",
52
+ },
53
+ "nickname": "My Sender ID",
56
54
  "reply_to": {
57
- "email": "replyto@example.com",
55
+ "email": "replyto@example.com",
58
56
  "name": "Example INC"
59
- },
60
- "state": "Colorado",
57
+ },
58
+ "state": "Colorado",
61
59
  "zip": "80202"
62
60
  }')
63
- sender_id = "test_url_param"
61
+ sender_id = 'test_url_param'
64
62
  response = sg.client.senders._(sender_id).patch(request_body: data)
65
63
  puts response.status_code
66
64
  puts response.body
@@ -70,8 +68,8 @@ puts response.headers
70
68
  # View a Sender Identity #
71
69
  # GET /senders/{sender_id} #
72
70
 
73
- sender_id = "test_url_param"
74
- response = sg.client.senders._(sender_id).get()
71
+ sender_id = 'test_url_param'
72
+ response = sg.client.senders._(sender_id).get
75
73
  puts response.status_code
76
74
  puts response.body
77
75
  puts response.headers
@@ -80,8 +78,8 @@ puts response.headers
80
78
  # Delete a Sender Identity #
81
79
  # DELETE /senders/{sender_id} #
82
80
 
83
- sender_id = "test_url_param"
84
- response = sg.client.senders._(sender_id).delete()
81
+ sender_id = 'test_url_param'
82
+ response = sg.client.senders._(sender_id).delete
85
83
  puts response.status_code
86
84
  puts response.body
87
85
  puts response.headers
@@ -90,9 +88,8 @@ puts response.headers
90
88
  # Resend Sender Identity Verification #
91
89
  # POST /senders/{sender_id}/resend_verification #
92
90
 
93
- sender_id = "test_url_param"
94
- response = sg.client.senders._(sender_id).resend_verification.post()
91
+ sender_id = 'test_url_param'
92
+ response = sg.client.senders._(sender_id).resend_verification.post
95
93
  puts response.status_code
96
94
  puts response.body
97
95
  puts response.headers
98
-
@@ -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 global email statistics #
9
7
  # GET /stats #
@@ -13,4 +11,3 @@ response = sg.client.stats.get(query_params: params)
13
11
  puts response.status_code
14
12
  puts response.body
15
13
  puts response.headers
16
-
@@ -1,20 +1,18 @@
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 Subuser #
9
7
  # POST /subusers #
10
8
 
11
9
  data = JSON.parse('{
12
- "email": "John@example.com",
10
+ "email": "John@example.com",
13
11
  "ips": [
14
- "1.1.1.1",
12
+ "1.1.1.1",
15
13
  "2.2.2.2"
16
- ],
17
- "password": "johns_password",
14
+ ],
15
+ "password": "johns_password",
18
16
  "username": "John@example.com"
19
17
  }')
20
18
  response = sg.client.subusers.post(request_body: data)
@@ -79,7 +77,7 @@ puts response.headers
79
77
  data = JSON.parse('{
80
78
  "disabled": false
81
79
  }')
82
- subuser_name = "test_url_param"
80
+ subuser_name = 'test_url_param'
83
81
  response = sg.client.subusers._(subuser_name).patch(request_body: data)
84
82
  puts response.status_code
85
83
  puts response.body
@@ -89,8 +87,8 @@ puts response.headers
89
87
  # Delete a subuser #
90
88
  # DELETE /subusers/{subuser_name} #
91
89
 
92
- subuser_name = "test_url_param"
93
- response = sg.client.subusers._(subuser_name).delete()
90
+ subuser_name = 'test_url_param'
91
+ response = sg.client.subusers._(subuser_name).delete
94
92
  puts response.status_code
95
93
  puts response.body
96
94
  puts response.headers
@@ -102,7 +100,7 @@ puts response.headers
102
100
  data = JSON.parse('[
103
101
  "127.0.0.1"
104
102
  ]')
105
- subuser_name = "test_url_param"
103
+ subuser_name = 'test_url_param'
106
104
  response = sg.client.subusers._(subuser_name).ips.put(request_body: data)
107
105
  puts response.status_code
108
106
  puts response.body
@@ -113,10 +111,10 @@ puts response.headers
113
111
  # PUT /subusers/{subuser_name}/monitor #
114
112
 
115
113
  data = JSON.parse('{
116
- "email": "example@example.com",
114
+ "email": "example@example.com",
117
115
  "frequency": 500
118
116
  }')
119
- subuser_name = "test_url_param"
117
+ subuser_name = 'test_url_param'
120
118
  response = sg.client.subusers._(subuser_name).monitor.put(request_body: data)
121
119
  puts response.status_code
122
120
  puts response.body
@@ -127,10 +125,10 @@ puts response.headers
127
125
  # POST /subusers/{subuser_name}/monitor #
128
126
 
129
127
  data = JSON.parse('{
130
- "email": "example@example.com",
128
+ "email": "example@example.com",
131
129
  "frequency": 50000
132
130
  }')
133
- subuser_name = "test_url_param"
131
+ subuser_name = 'test_url_param'
134
132
  response = sg.client.subusers._(subuser_name).monitor.post(request_body: data)
135
133
  puts response.status_code
136
134
  puts response.body
@@ -140,8 +138,8 @@ puts response.headers
140
138
  # Retrieve monitor settings for a subuser #
141
139
  # GET /subusers/{subuser_name}/monitor #
142
140
 
143
- subuser_name = "test_url_param"
144
- response = sg.client.subusers._(subuser_name).monitor.get()
141
+ subuser_name = 'test_url_param'
142
+ response = sg.client.subusers._(subuser_name).monitor.get
145
143
  puts response.status_code
146
144
  puts response.body
147
145
  puts response.headers
@@ -150,8 +148,8 @@ puts response.headers
150
148
  # Delete monitor settings #
151
149
  # DELETE /subusers/{subuser_name}/monitor #
152
150
 
153
- subuser_name = "test_url_param"
154
- response = sg.client.subusers._(subuser_name).monitor.delete()
151
+ subuser_name = 'test_url_param'
152
+ response = sg.client.subusers._(subuser_name).monitor.delete
155
153
  puts response.status_code
156
154
  puts response.body
157
155
  puts response.headers
@@ -161,9 +159,8 @@ puts response.headers
161
159
  # GET /subusers/{subuser_name}/stats/monthly #
162
160
 
163
161
  params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
164
- subuser_name = "test_url_param"
162
+ subuser_name = 'test_url_param'
165
163
  response = sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params)
166
164
  puts response.status_code
167
165
  puts response.body
168
166
  puts response.headers
169
-