sendgrid-ruby 6.2.0 → 6.6.2
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/.github/ISSUE_TEMPLATE/config.yml +10 -0
- data/.github/workflows/test-and-deploy.yml +120 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +127 -0
- data/CHANGELOG.md +147 -9
- data/CONTRIBUTING.md +11 -21
- data/Dockerfile +14 -0
- data/FIRST_TIMERS.md +79 -0
- data/Gemfile +0 -1
- data/ISSUE_TEMPLATE.md +5 -1
- data/{LICENSE.md → LICENSE} +1 -1
- data/Makefile +9 -2
- data/PULL_REQUEST_TEMPLATE.md +5 -5
- data/README.md +23 -31
- data/Rakefile +2 -3
- data/TROUBLESHOOTING.md +17 -5
- data/USAGE.md +146 -39
- data/examples/accesssettings/accesssettings.rb +9 -12
- data/examples/alerts/alerts.rb +8 -11
- data/examples/apikeys/apikeys.rb +12 -15
- data/examples/asm/asm.rb +27 -30
- data/examples/browsers/browsers.rb +0 -3
- data/examples/campaigns/campaigns.rb +29 -32
- data/examples/categories/categories.rb +0 -3
- data/examples/clients/clients.rb +1 -4
- data/examples/contactdb/contactdb.rb +63 -66
- data/examples/devices/devices.rb +0 -3
- data/examples/emailactivity/emailactivity.rb +52 -0
- data/examples/geo/geo.rb +0 -3
- data/examples/helpers/eventwebhook/example.rb +16 -0
- data/examples/helpers/mail/example.rb +24 -13
- data/examples/helpers/settings/example.rb +1 -1
- data/examples/helpers/stats/example.rb +4 -4
- data/examples/ips/ips.rb +19 -22
- data/examples/mail/mail.rb +72 -75
- data/examples/mailboxproviders/mailboxproviders.rb +0 -3
- data/examples/mailsettings/mailsettings.rb +21 -24
- data/examples/partnersettings/partnersettings.rb +3 -6
- data/examples/scopes/scopes.rb +8 -10
- data/examples/senderauthentication/senderauthentication.rb +41 -44
- data/examples/senders/senders.rb +28 -31
- data/examples/stats/stats.rb +0 -3
- data/examples/subusers/subusers.rb +17 -20
- data/examples/suppression/suppression.rb +15 -18
- data/examples/templates/templates.rb +29 -31
- data/examples/trackingsettings/trackingsettings.rb +14 -17
- data/examples/user/user.rb +41 -44
- data/lib/rack/sendgrid_webhook_verification.rb +55 -0
- data/lib/sendgrid/base_interface.rb +8 -4
- data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
- data/lib/sendgrid/helpers/inbound/README.md +5 -5
- data/lib/sendgrid/helpers/inbound/app.rb +2 -2
- data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
- data/lib/sendgrid/helpers/inbound/send.rb +3 -3
- data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
- data/lib/sendgrid/helpers/mail/README.md +3 -3
- data/lib/sendgrid/helpers/mail/asm.rb +6 -18
- data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
- data/lib/sendgrid/helpers/mail/category.rb +2 -2
- data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/content.rb +4 -3
- data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
- data/lib/sendgrid/helpers/mail/email.rb +10 -5
- data/lib/sendgrid/helpers/mail/footer.rb +7 -27
- data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
- data/lib/sendgrid/helpers/mail/header.rb +6 -10
- data/lib/sendgrid/helpers/mail/mail.rb +32 -48
- data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
- data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/personalization.rb +40 -27
- data/lib/sendgrid/helpers/mail/section.rb +6 -10
- data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
- data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +8 -20
- data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
- data/lib/sendgrid/helpers/settings/README.md +2 -2
- data/lib/sendgrid/helpers/settings/settings.rb +1 -1
- data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
- data/lib/sendgrid/helpers/stats/metrics.rb +5 -5
- data/lib/sendgrid/sendgrid.rb +4 -3
- data/lib/sendgrid/twilio_email.rb +1 -1
- data/lib/sendgrid/version.rb +1 -1
- data/lib/sendgrid-ruby.rb +2 -0
- data/mail_helper_v3.md +12 -12
- data/sendgrid-ruby.gemspec +8 -8
- data/spec/fixtures/event_webhook.rb +22 -0
- data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
- data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
- data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +3 -3
- data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +3 -3
- data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
- data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +3 -3
- data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +3 -3
- data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
- data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
- data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
- data/spec/spec_helper.rb +3 -1
- data/static/img/github-fork.png +0 -0
- data/static/img/github-sign-up.png +0 -0
- data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
- data/test/sendgrid/helpers/mail/test_category.rb +0 -2
- data/test/sendgrid/helpers/mail/test_email.rb +17 -10
- data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
- data/test/sendgrid/helpers/mail/test_personalizations.rb +145 -92
- data/test/sendgrid/permissions/test_scopes.rb +1 -3
- data/test/sendgrid/test_sendgrid-ruby.rb +1964 -1986
- data/twilio_sendgrid_logo.png +0 -0
- data/use-cases/README.md +17 -0
- data/use-cases/domain-authentication.md +5 -0
- data/use-cases/email-statistics.md +52 -0
- data/use-cases/legacy-templates.md +98 -0
- data/use-cases/personalizations.md +34 -0
- data/use-cases/sms.md +39 -0
- data/use-cases/transactional-templates.md +111 -0
- data/use-cases/twilio-email.md +13 -0
- data/use-cases/twilio-setup.md +54 -0
- metadata +69 -34
- data/.codeclimate.yml +0 -21
- data/.travis.yml +0 -40
- data/USE_CASES.md +0 -405
- data/docker/Dockerfile +0 -12
- data/docker/README.md +0 -30
- 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
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)
|
|
@@ -39,7 +37,7 @@ puts response.headers
|
|
|
39
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
|
|
@@ -48,7 +46,7 @@ puts response.headers
|
|
|
48
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
|
|
@@ -57,7 +55,7 @@ puts response.headers
|
|
|
57
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
|
|
@@ -67,10 +65,10 @@ puts response.headers
|
|
|
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 =
|
|
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
|
|
@@ -80,8 +78,8 @@ puts response.headers
|
|
|
80
78
|
# Retrieve a domain authentication. #
|
|
81
79
|
# GET /whitelabel/domains/{domain_id} #
|
|
82
80
|
|
|
83
|
-
domain_id =
|
|
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
|
|
@@ -90,8 +88,8 @@ puts response.headers
|
|
|
90
88
|
# Delete a domain authentication. #
|
|
91
89
|
# DELETE /whitelabel/domains/{domain_id} #
|
|
92
90
|
|
|
93
|
-
domain_id =
|
|
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
|
|
@@ -103,7 +101,7 @@ puts response.headers
|
|
|
103
101
|
data = JSON.parse('{
|
|
104
102
|
"username": "jane@example.com"
|
|
105
103
|
}')
|
|
106
|
-
domain_id =
|
|
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
|
|
@@ -116,7 +114,7 @@ puts response.headers
|
|
|
116
114
|
data = JSON.parse('{
|
|
117
115
|
"ip": "192.168.0.1"
|
|
118
116
|
}')
|
|
119
|
-
id =
|
|
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
|
|
@@ -126,9 +124,9 @@ puts response.headers
|
|
|
126
124
|
# Remove an IP from a domain authentication. #
|
|
127
125
|
# DELETE /whitelabel/domains/{id}/ips/{ip} #
|
|
128
126
|
|
|
129
|
-
id =
|
|
130
|
-
ip =
|
|
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
|
|
@@ -137,8 +135,8 @@ puts response.headers
|
|
|
137
135
|
# Validate a domain authentication. #
|
|
138
136
|
# POST /whitelabel/domains/{id}/validate #
|
|
139
137
|
|
|
140
|
-
id =
|
|
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
|
|
@@ -148,8 +146,8 @@ puts response.headers
|
|
|
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)
|
|
@@ -171,8 +169,8 @@ puts response.headers
|
|
|
171
169
|
# Retrieve a reverse DNS record #
|
|
172
170
|
# GET /whitelabel/ips/{id} #
|
|
173
171
|
|
|
174
|
-
id =
|
|
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
|
|
@@ -181,8 +179,8 @@ puts response.headers
|
|
|
181
179
|
# Delete a reverse DNS record #
|
|
182
180
|
# DELETE /whitelabel/ips/{id} #
|
|
183
181
|
|
|
184
|
-
id =
|
|
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
|
|
@@ -191,8 +189,8 @@ puts response.headers
|
|
|
191
189
|
# Validate a reverse DNS record #
|
|
192
190
|
# POST /whitelabel/ips/{id}/validate #
|
|
193
191
|
|
|
194
|
-
id =
|
|
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
|
|
@@ -202,8 +200,8 @@ puts response.headers
|
|
|
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}')
|
|
@@ -259,7 +257,7 @@ puts response.headers
|
|
|
259
257
|
data = JSON.parse('{
|
|
260
258
|
"default": true
|
|
261
259
|
}')
|
|
262
|
-
id =
|
|
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
|
|
@@ -269,8 +267,8 @@ puts response.headers
|
|
|
269
267
|
# Retrieve a Link Branding #
|
|
270
268
|
# GET /whitelabel/links/{id} #
|
|
271
269
|
|
|
272
|
-
id =
|
|
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
|
|
@@ -279,8 +277,8 @@ puts response.headers
|
|
|
279
277
|
# Delete a Link Branding #
|
|
280
278
|
# DELETE /whitelabel/links/{id} #
|
|
281
279
|
|
|
282
|
-
id =
|
|
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
|
|
@@ -289,8 +287,8 @@ puts response.headers
|
|
|
289
287
|
# Validate a Link Branding #
|
|
290
288
|
# POST /whitelabel/links/{id}/validate #
|
|
291
289
|
|
|
292
|
-
id =
|
|
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
|
|
@@ -302,9 +300,8 @@ puts response.headers
|
|
|
302
300
|
data = JSON.parse('{
|
|
303
301
|
"username": "jane@example.com"
|
|
304
302
|
}')
|
|
305
|
-
link_id =
|
|
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
|
-
|
data/examples/senders/senders.rb
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
data/examples/stats/stats.rb
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
@@ -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 blocks #
|
|
9
7
|
# GET /suppression/blocks #
|
|
@@ -34,8 +32,8 @@ puts response.headers
|
|
|
34
32
|
# Retrieve a specific block #
|
|
35
33
|
# GET /suppression/blocks/{email} #
|
|
36
34
|
|
|
37
|
-
email =
|
|
38
|
-
response = sg.client.suppression.blocks._(email).get
|
|
35
|
+
email = 'test_url_param'
|
|
36
|
+
response = sg.client.suppression.blocks._(email).get
|
|
39
37
|
puts response.status_code
|
|
40
38
|
puts response.body
|
|
41
39
|
puts response.headers
|
|
@@ -44,8 +42,8 @@ puts response.headers
|
|
|
44
42
|
# Delete a specific block #
|
|
45
43
|
# DELETE /suppression/blocks/{email} #
|
|
46
44
|
|
|
47
|
-
email =
|
|
48
|
-
response = sg.client.suppression.blocks._(email).delete
|
|
45
|
+
email = 'test_url_param'
|
|
46
|
+
response = sg.client.suppression.blocks._(email).delete
|
|
49
47
|
puts response.status_code
|
|
50
48
|
puts response.body
|
|
51
49
|
puts response.headers
|
|
@@ -80,8 +78,8 @@ puts response.headers
|
|
|
80
78
|
# Retrieve a Bounce #
|
|
81
79
|
# GET /suppression/bounces/{email} #
|
|
82
80
|
|
|
83
|
-
email =
|
|
84
|
-
response = sg.client.suppression.bounces._(email).get
|
|
81
|
+
email = 'test_url_param'
|
|
82
|
+
response = sg.client.suppression.bounces._(email).get
|
|
85
83
|
puts response.status_code
|
|
86
84
|
puts response.body
|
|
87
85
|
puts response.headers
|
|
@@ -91,7 +89,7 @@ puts response.headers
|
|
|
91
89
|
# DELETE /suppression/bounces/{email} #
|
|
92
90
|
|
|
93
91
|
params = JSON.parse('{"email_address": "example@example.com"}')
|
|
94
|
-
email =
|
|
92
|
+
email = 'test_url_param'
|
|
95
93
|
response = sg.client.suppression.bounces._(email).delete(query_params: params)
|
|
96
94
|
puts response.status_code
|
|
97
95
|
puts response.body
|
|
@@ -127,8 +125,8 @@ puts response.headers
|
|
|
127
125
|
# Retrieve a specific invalid email #
|
|
128
126
|
# GET /suppression/invalid_emails/{email} #
|
|
129
127
|
|
|
130
|
-
email =
|
|
131
|
-
response = sg.client.suppression.invalid_emails._(email).get
|
|
128
|
+
email = 'test_url_param'
|
|
129
|
+
response = sg.client.suppression.invalid_emails._(email).get
|
|
132
130
|
puts response.status_code
|
|
133
131
|
puts response.body
|
|
134
132
|
puts response.headers
|
|
@@ -137,8 +135,8 @@ puts response.headers
|
|
|
137
135
|
# Delete a specific invalid email #
|
|
138
136
|
# DELETE /suppression/invalid_emails/{email} #
|
|
139
137
|
|
|
140
|
-
email =
|
|
141
|
-
response = sg.client.suppression.invalid_emails._(email).delete
|
|
138
|
+
email = 'test_url_param'
|
|
139
|
+
response = sg.client.suppression.invalid_emails._(email).delete
|
|
142
140
|
puts response.status_code
|
|
143
141
|
puts response.body
|
|
144
142
|
puts response.headers
|
|
@@ -147,8 +145,8 @@ puts response.headers
|
|
|
147
145
|
# Retrieve a specific spam report #
|
|
148
146
|
# GET /suppression/spam_report/{email} #
|
|
149
147
|
|
|
150
|
-
email =
|
|
151
|
-
response = sg.client.suppression.
|
|
148
|
+
email = 'test_url_param'
|
|
149
|
+
response = sg.client.suppression.spam_report._(email).get
|
|
152
150
|
puts response.status_code
|
|
153
151
|
puts response.body
|
|
154
152
|
puts response.headers
|
|
@@ -157,8 +155,8 @@ puts response.headers
|
|
|
157
155
|
# Delete a specific spam report #
|
|
158
156
|
# DELETE /suppression/spam_report/{email} #
|
|
159
157
|
|
|
160
|
-
email =
|
|
161
|
-
response = sg.client.suppression.spam_reports._(email).delete
|
|
158
|
+
email = 'test_url_param'
|
|
159
|
+
response = sg.client.suppression.spam_reports._(email).delete
|
|
162
160
|
puts response.status_code
|
|
163
161
|
puts response.body
|
|
164
162
|
puts response.headers
|
|
@@ -198,4 +196,3 @@ response = sg.client.suppression.unsubscribes.get(query_params: params)
|
|
|
198
196
|
puts response.status_code
|
|
199
197
|
puts response.body
|
|
200
198
|
puts response.headers
|
|
201
|
-
|