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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47ab0f76ba5ebb4ebd4f28a91784fee3a8d09735
4
- data.tar.gz: 9deac819a5d81f7a751565907b47d192def9059d
3
+ metadata.gz: f9e089f11c9fcefbb345b5031cb7319a423c31c5
4
+ data.tar.gz: bbdce0d5b46c388c7e31c383531a2d026e800d3a
5
5
  SHA512:
6
- metadata.gz: a01165aec370f954165d911a6611cfd5287beea63cad6fec47dc9d34f58e6a6cf3fefb98c2618ee9fe4c299ce528608a1817b6aa8921906f00ad630a5c42b80b
7
- data.tar.gz: 2646d05bcaa3191dcd3d96db634edacefb37e9efd5fecf300ea2b563d0fab00cfd939cb5ce35f70ce518eb54237c5b7e612ad1dbf5f3b67058a2452b65f7a9e8
6
+ metadata.gz: 9120ecc8f69f5b16f05ebf7a6302594063f80c13be13b44bb8fd08e7563baed25fa050af579db1b0f8a06f3c836f1ca9c631e5b3b0da998448aae2756a5bae93
7
+ data.tar.gz: 607643666e9f63e9f0d46f9e50c348da837c330d01645db804fc6cdde24b93a8580d506f2e232f9df690da5d885de5c4f18685e6d40a8c4414002bf209037787
@@ -1,6 +1,13 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [3.0.5] - 2016-07-05 ##
5
+ ### Added
6
+ - Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html
7
+
8
+ ### Updated
9
+ - Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai)
10
+
4
11
  ## [3.0.4] - 2016-06-15 ##
5
12
  ### Added
6
13
  - Updated dependency on ruby-http-client
data/README.md CHANGED
@@ -7,9 +7,9 @@
7
7
 
8
8
  **BREAKING CHANGE as of 2016.06.14**
9
9
 
10
- Version `2.0.0` is a breaking change for the entire library.
10
+ Version `3.X.X` is a breaking change for the entire library.
11
11
 
12
- Version 2.0.0 brings you full support for all Web API v3 endpoints. We
12
+ Version 3.X.X brings you full support for all Web API v3 endpoints. We
13
13
  have the following resources to get you started quickly:
14
14
 
15
15
  - [SendGrid
@@ -18,6 +18,7 @@ have the following resources to get you started quickly:
18
18
  Documentation](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
19
19
  - [Example
20
20
  Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)
21
+ - [Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
21
22
 
22
23
  Thank you for your continued support!
23
24
 
@@ -58,7 +59,7 @@ gem install sendgrid-ruby
58
59
 
59
60
  ## Dependencies
60
61
 
61
- - The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby))
62
+ - The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
62
63
  - [Ruby-HTTP-Client](https://github.com/sendgrid/ruby-http-client)
63
64
 
64
65
  # Quick Start
data/USAGE.md CHANGED
@@ -12,6 +12,7 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
12
12
  # Table of Contents
13
13
 
14
14
  * [ACCESS SETTINGS](#access_settings)
15
+ * [ALERTS](#alerts)
15
16
  * [API KEYS](#api_keys)
16
17
  * [ASM](#asm)
17
18
  * [BROWSERS](#browsers)
@@ -165,6 +166,115 @@ puts response.status_code
165
166
  puts response.body
166
167
  puts response.headers
167
168
  ```
169
+ <a name="alerts"></a>
170
+ # ALERTS
171
+
172
+ ## Create a new Alert
173
+
174
+ **This endpoint allows you to create a new alert.**
175
+
176
+ Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
177
+ * Usage alerts allow you to set the threshold at which an alert will be sent.
178
+ * Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
179
+
180
+ For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
181
+
182
+ ### POST /alerts
183
+
184
+
185
+ ```ruby
186
+ data = JSON.parse('{
187
+ "email_to": "example@example.com",
188
+ "frequency": "daily",
189
+ "type": "stats_notification"
190
+ }')
191
+ response = sg.client.alerts.post(request_body: data)
192
+ puts response.status_code
193
+ puts response.body
194
+ puts response.headers
195
+ ```
196
+ ## Retrieve all alerts
197
+
198
+ **This endpoint allows you to retieve all of your alerts.**
199
+
200
+ Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
201
+ * Usage alerts allow you to set the threshold at which an alert will be sent.
202
+ * Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
203
+
204
+ For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
205
+
206
+ ### GET /alerts
207
+
208
+
209
+ ```ruby
210
+ response = sg.client.alerts.get()
211
+ puts response.status_code
212
+ puts response.body
213
+ puts response.headers
214
+ ```
215
+ ## Update an alert
216
+
217
+ **This endpoint allows you to update an alert.**
218
+
219
+ Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
220
+ * Usage alerts allow you to set the threshold at which an alert will be sent.
221
+ * Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
222
+
223
+ For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
224
+
225
+ ### PATCH /alerts/{alert_id}
226
+
227
+
228
+ ```ruby
229
+ data = JSON.parse('{
230
+ "email_to": "example@example.com"
231
+ }')
232
+ alert_id = "test_url_param"
233
+ response = sg.client.alerts._(alert_id).patch(request_body: data)
234
+ puts response.status_code
235
+ puts response.body
236
+ puts response.headers
237
+ ```
238
+ ## Retrieve a specific alert
239
+
240
+ **This endpoint allows you to retrieve a specific alert.**
241
+
242
+ Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
243
+ * Usage alerts allow you to set the threshold at which an alert will be sent.
244
+ * Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
245
+
246
+ For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
247
+
248
+ ### GET /alerts/{alert_id}
249
+
250
+
251
+ ```ruby
252
+ alert_id = "test_url_param"
253
+ response = sg.client.alerts._(alert_id).get()
254
+ puts response.status_code
255
+ puts response.body
256
+ puts response.headers
257
+ ```
258
+ ## Delete an alert
259
+
260
+ **This endpoint allows you to delete an alert.**
261
+
262
+ Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
263
+ * Usage alerts allow you to set the threshold at which an alert will be sent.
264
+ * Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
265
+
266
+ For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
267
+
268
+ ### DELETE /alerts/{alert_id}
269
+
270
+
271
+ ```ruby
272
+ alert_id = "test_url_param"
273
+ response = sg.client.alerts._(alert_id).delete()
274
+ puts response.status_code
275
+ puts response.body
276
+ puts response.headers
277
+ ```
168
278
  <a name="api_keys"></a>
169
279
  # API KEYS
170
280
 
@@ -186,6 +296,7 @@ See the [API Key Permissions List](https://sendgrid.com/docs/API_Reference/Web_A
186
296
  ```ruby
187
297
  data = JSON.parse('{
188
298
  "name": "My API Key",
299
+ "sample": "data",
189
300
  "scopes": [
190
301
  "mail.send",
191
302
  "alerts.create",
@@ -207,7 +318,8 @@ The API Keys feature allows customers to be able to generate an API Key credenti
207
318
 
208
319
 
209
320
  ```ruby
210
- response = sg.client.api_keys.get()
321
+ params = JSON.parse('{"limit": 1}')
322
+ response = sg.client.api_keys.get(query_params: params)
211
323
  puts response.status_code
212
324
  puts response.body
213
325
  puts response.headers
@@ -339,6 +451,10 @@ puts response.headers
339
451
 
340
452
  This endpoint will return information for each group ID that you include in your request. To add a group ID to your request, simply append `&id=` followed by the group ID.
341
453
 
454
+ Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).
455
+
456
+ Suppression groups, or [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html), allow you to label a category of content that you regularly send. This gives your recipients the ability to opt out of a specific set of your email. For example, you might define a group for your transactional email, and one for your marketing email so that your users can continue recieving your transactional email witout having to receive your marketing content.
457
+
342
458
  ### GET /asm/groups
343
459
 
344
460
 
@@ -456,6 +572,31 @@ puts response.status_code
456
572
  puts response.body
457
573
  puts response.headers
458
574
  ```
575
+ ## Search for suppressions within a group
576
+
577
+ **This endpoint allows you to search a suppression group for multiple suppressions.**
578
+
579
+ When given a list of email addresses and a group ID, this endpoint will return only the email addresses that have been unsubscribed from the given group.
580
+
581
+ Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).
582
+
583
+ ### POST /asm/groups/{group_id}/suppressions/search
584
+
585
+
586
+ ```ruby
587
+ data = JSON.parse('{
588
+ "recipient_emails": [
589
+ "exists1@example.com",
590
+ "exists2@example.com",
591
+ "doesnotexists@example.com"
592
+ ]
593
+ }')
594
+ group_id = "test_url_param"
595
+ response = sg.client.asm.groups._(group_id).suppressions.search.post(request_body: data)
596
+ puts response.status_code
597
+ puts response.body
598
+ puts response.headers
599
+ ```
459
600
  ## Delete a suppression from a suppression group
460
601
 
461
602
  **This endpoint allows you to remove a suppressed email address from the given suppression group.**
@@ -477,7 +618,7 @@ puts response.headers
477
618
 
478
619
  **This endpoint allows you to retrieve a list of all suppressions.**
479
620
 
480
- Suppressions are email addresses that can be added to [groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) to prevent certain types of emails from being delivered to those addresses.
621
+ Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).
481
622
 
482
623
  ### GET /asm/suppressions
483
624
 
@@ -545,9 +686,9 @@ puts response.headers
545
686
  ```
546
687
  ## Retrieve all suppression groups for an email address
547
688
 
548
- **This endpoint will return a list of all suppression groups, indicating if the given email address is suppressed for each group.**
689
+ **This endpoint returns the list of all groups that the given email address has been unsubscribed from.**
549
690
 
550
- Suppressions are email addresses that can be added to [groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) to prevent certain types of emails from being delivered to those addresses.
691
+ Suppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).
551
692
 
552
693
  ### GET /asm/suppressions/{email}
553
694
 
@@ -640,7 +781,7 @@ For more information:
640
781
 
641
782
 
642
783
  ```ruby
643
- params = JSON.parse('{"limit": 0, "offset": 0}')
784
+ params = JSON.parse('{"limit": 1, "offset": 1}')
644
785
  response = sg.client.campaigns.get(query_params: params)
645
786
  puts response.status_code
646
787
  puts response.body
@@ -1069,7 +1210,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
1069
1210
  data = JSON.parse('{
1070
1211
  "name": "newlistname"
1071
1212
  }')
1072
- params = JSON.parse('{"list_id": 0}')
1213
+ params = JSON.parse('{"list_id": 1}')
1073
1214
  list_id = "test_url_param"
1074
1215
  response = sg.client.contactdb.lists._(list_id).patch(request_body: data, query_params: params)
1075
1216
  puts response.status_code
@@ -1086,7 +1227,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
1086
1227
 
1087
1228
 
1088
1229
  ```ruby
1089
- params = JSON.parse('{"list_id": 0}')
1230
+ params = JSON.parse('{"list_id": 1}')
1090
1231
  list_id = "test_url_param"
1091
1232
  response = sg.client.contactdb.lists._(list_id).get(query_params: params)
1092
1233
  puts response.status_code
@@ -1142,7 +1283,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
1142
1283
 
1143
1284
 
1144
1285
  ```ruby
1145
- params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 0}')
1286
+ params = JSON.parse('{"page": 1, "page_size": 1, "list_id": 1}')
1146
1287
  list_id = "test_url_param"
1147
1288
  response = sg.client.contactdb.lists._(list_id).recipients.get(query_params: params)
1148
1289
  puts response.status_code
@@ -1176,7 +1317,7 @@ The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.co
1176
1317
 
1177
1318
 
1178
1319
  ```ruby
1179
- params = JSON.parse('{"recipient_id": 0, "list_id": 0}')
1320
+ params = JSON.parse('{"recipient_id": 1, "list_id": 1}')
1180
1321
  list_id = "test_url_param"
1181
1322
  recipient_id = "test_url_param"
1182
1323
  response = sg.client.contactdb.lists._(list_id).recipients._(recipient_id).delete(query_params: params)
@@ -1328,7 +1469,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](
1328
1469
 
1329
1470
 
1330
1471
  ```ruby
1331
- params = JSON.parse('{"{field_name}": "test_string"}')
1472
+ params = JSON.parse('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}')
1332
1473
  response = sg.client.contactdb.recipients.search.get(query_params: params)
1333
1474
  puts response.status_code
1334
1475
  puts response.body
@@ -1518,7 +1659,7 @@ For more information about segments in Marketing Campaigns, please see our [User
1518
1659
 
1519
1660
 
1520
1661
  ```ruby
1521
- params = JSON.parse('{"segment_id": 0}')
1662
+ params = JSON.parse('{"segment_id": 1}')
1522
1663
  segment_id = "test_url_param"
1523
1664
  response = sg.client.contactdb.segments._(segment_id).get(query_params: params)
1524
1665
  puts response.status_code
@@ -2036,13 +2177,8 @@ data = JSON.parse('{
2036
2177
  "send_at": 1409348513,
2037
2178
  "subject": "Hello, World!",
2038
2179
  "substitutions": {
2039
- "sub": {
2040
- "%name%": [
2041
- "John",
2042
- "Jane",
2043
- "Sam"
2044
- ]
2045
- }
2180
+ "id": "substitutions",
2181
+ "type": "object"
2046
2182
  },
2047
2183
  "to": [
2048
2184
  {
@@ -2624,7 +2760,7 @@ For more information about Subusers:
2624
2760
 
2625
2761
 
2626
2762
  ```ruby
2627
- params = JSON.parse('{"username": "test_string", "limit": 0, "offset": 0}')
2763
+ params = JSON.parse('{"username": "test_string", "limit": 1, "offset": 1}')
2628
2764
  response = sg.client.subusers.get(query_params: params)
2629
2765
  puts response.status_code
2630
2766
  puts response.body
@@ -2848,7 +2984,7 @@ For more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/
2848
2984
 
2849
2985
 
2850
2986
  ```ruby
2851
- params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 0, "sort_by_metric": "test_string", "offset": 1}')
2987
+ params = JSON.parse('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}')
2852
2988
  subuser_name = "test_url_param"
2853
2989
  response = sg.client.subusers._(subuser_name).stats.monthly.get(query_params: params)
2854
2990
  puts response.status_code
@@ -2949,7 +3085,7 @@ For more information see:
2949
3085
 
2950
3086
 
2951
3087
  ```ruby
2952
- params = JSON.parse('{"start_time": 0, "end_time": 0}')
3088
+ params = JSON.parse('{"start_time": 1, "end_time": 1}')
2953
3089
  response = sg.client.suppression.bounces.get(query_params: params)
2954
3090
  puts response.status_code
2955
3091
  puts response.body
@@ -4015,11 +4151,32 @@ puts response.status_code
4015
4151
  puts response.body
4016
4152
  puts response.headers
4017
4153
  ```
4018
- ## Retrieve Parse Webhook settings
4154
+ ## Create a parse setting
4155
+
4156
+ **This endpoint allows you to create a new inbound parse setting.**
4157
+
4158
+ The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the content, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4019
4159
 
4020
- **This endpoint allows you to retrieve your current inbound parse webhook settings.**
4160
+ ### POST /user/webhooks/parse/settings
4021
4161
 
4022
- SendGrid can parse the attachments and contents of incoming emails. The Parse API will POST the parsed email to a URL that you specify. For more information, see our Inbound [Parse Webhook documentation](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4162
+
4163
+ ```ruby
4164
+ data = JSON.parse('{
4165
+ "hostname": "myhostname.com",
4166
+ "send_raw": false,
4167
+ "spam_check": true,
4168
+ "url": "http://email.myhosthame.com"
4169
+ }')
4170
+ response = sg.client.user.webhooks.parse.settings.post(request_body: data)
4171
+ puts response.status_code
4172
+ puts response.body
4173
+ puts response.headers
4174
+ ```
4175
+ ## Retrieve all parse settings
4176
+
4177
+ **This endpoint allows you to retrieve all of your current inbound parse settings.**
4178
+
4179
+ The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4023
4180
 
4024
4181
  ### GET /user/webhooks/parse/settings
4025
4182
 
@@ -4030,6 +4187,59 @@ puts response.status_code
4030
4187
  puts response.body
4031
4188
  puts response.headers
4032
4189
  ```
4190
+ ## Update a parse setting
4191
+
4192
+ **This endpoint allows you to update a specific inbound parse setting.**
4193
+
4194
+ The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4195
+
4196
+ ### PATCH /user/webhooks/parse/settings/{hostname}
4197
+
4198
+
4199
+ ```ruby
4200
+ data = JSON.parse('{
4201
+ "send_raw": true,
4202
+ "spam_check": false,
4203
+ "url": "http://newdomain.com/parse"
4204
+ }')
4205
+ hostname = "test_url_param"
4206
+ response = sg.client.user.webhooks.parse.settings._(hostname).patch(request_body: data)
4207
+ puts response.status_code
4208
+ puts response.body
4209
+ puts response.headers
4210
+ ```
4211
+ ## Retrieve a specific parse setting
4212
+
4213
+ **This endpoint allows you to retrieve a specific inbound parse setting.**
4214
+
4215
+ The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4216
+
4217
+ ### GET /user/webhooks/parse/settings/{hostname}
4218
+
4219
+
4220
+ ```ruby
4221
+ hostname = "test_url_param"
4222
+ response = sg.client.user.webhooks.parse.settings._(hostname).get()
4223
+ puts response.status_code
4224
+ puts response.body
4225
+ puts response.headers
4226
+ ```
4227
+ ## Delete a parse setting
4228
+
4229
+ **This endpoint allows you to delete a specific inbound parse setting.**
4230
+
4231
+ The inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).
4232
+
4233
+ ### DELETE /user/webhooks/parse/settings/{hostname}
4234
+
4235
+
4236
+ ```ruby
4237
+ hostname = "test_url_param"
4238
+ response = sg.client.user.webhooks.parse.settings._(hostname).delete()
4239
+ puts response.status_code
4240
+ puts response.body
4241
+ puts response.headers
4242
+ ```
4033
4243
  ## Retrieves Inbound Parse Webhook statistics.
4034
4244
 
4035
4245
  **This endpoint allows you to retrieve the statistics for your Parse Webhook useage.**