sendgrid-ruby 6.2.0 → 6.6.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/USAGE.md
CHANGED
@@ -21,6 +21,7 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
|
21
21
|
* [CLIENTS](#clients)
|
22
22
|
* [CONTACTDB](#contactdb)
|
23
23
|
* [DEVICES](#devices)
|
24
|
+
* [EMAIL ACTIVITY](#email-activity)
|
24
25
|
* [GEO](#geo)
|
25
26
|
* [IPS](#ips)
|
26
27
|
* [MAIL](#mail)
|
@@ -290,7 +291,7 @@ puts response.headers
|
|
290
291
|
|
291
292
|
**This endpoint allows you to create a new random API Key for the user.**
|
292
293
|
|
293
|
-
A JSON request body containing a "name" property is required. If number of maximum keys is reached, HTTP 403 will be returned.
|
294
|
+
A JSON request body containing a "name" property is required. If the number of maximum keys is reached, HTTP 403 will be returned.
|
294
295
|
|
295
296
|
There is a limit of 100 API Keys on your account.
|
296
297
|
|
@@ -406,7 +407,7 @@ puts response.headers
|
|
406
407
|
|
407
408
|
**This endpoint allows you to revoke an existing API Key**
|
408
409
|
|
409
|
-
Authentications using this API Key will fail after this request is made, with some small propagation delay.If the API Key ID does not exist an HTTP 404 will be returned.
|
410
|
+
Authentications using this API Key will fail after this request is made, with some small propagation delay. If the API Key ID does not exist an HTTP 404 will be returned.
|
410
411
|
|
411
412
|
The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the Twilio SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
|
412
413
|
|
@@ -967,7 +968,7 @@ puts response.headers
|
|
967
968
|
|
968
969
|
**This endpoint allows you to send a test campaign.**
|
969
970
|
|
970
|
-
To send to multiple addresses, use an array for the JSON "to" value ["one@address","two@address"]
|
971
|
+
To send to multiple addresses, use an array for the JSON "to" value ["one@address", "two@address"]
|
971
972
|
|
972
973
|
For more information:
|
973
974
|
|
@@ -1417,7 +1418,7 @@ puts response.headers
|
|
1417
1418
|
```
|
1418
1419
|
## Delete Recipient
|
1419
1420
|
|
1420
|
-
**This endpoint allows you to
|
1421
|
+
**This endpoint allows you to delete one or more recipients.**
|
1421
1422
|
|
1422
1423
|
The body of an API call to this endpoint must include an array of recipient IDs of the recipients you want to delete.
|
1423
1424
|
|
@@ -1529,7 +1530,7 @@ puts response.headers
|
|
1529
1530
|
|
1530
1531
|
**This endpoint allows you to retrieve the lists that a given recipient belongs to.**
|
1531
1532
|
|
1532
|
-
Each recipient can be on many lists. This endpoint gives you all of the lists that
|
1533
|
+
Each recipient can be on many lists. This endpoint gives you all of the lists that anyone recipient has been added to.
|
1533
1534
|
|
1534
1535
|
The Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.
|
1535
1536
|
|
@@ -1686,7 +1687,7 @@ puts response.headers
|
|
1686
1687
|
```
|
1687
1688
|
## Delete a segment
|
1688
1689
|
|
1689
|
-
**This endpoint allows you to delete a segment from your
|
1690
|
+
**This endpoint allows you to delete a segment from your recipient's database.**
|
1690
1691
|
|
1691
1692
|
You also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment.
|
1692
1693
|
|
@@ -1736,10 +1737,10 @@ puts response.headers
|
|
1736
1737
|
## Available Device Types
|
1737
1738
|
| **Device** | **Description** | **Example** |
|
1738
1739
|
|---|---|---|
|
1739
|
-
| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |
|
1740
|
-
| Webmail |
|
1741
|
-
| Phone | A
|
1742
|
-
| Tablet | A tablet computer. | iPad,
|
1740
|
+
| Desktop | Email software on a desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |
|
1741
|
+
| Webmail | A web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. |
|
1742
|
+
| Phone | A smartphone. | iPhone, Android, Blackberry, etc.
|
1743
|
+
| Tablet | A tablet computer. | iPad, Android-based tablet, etc. |
|
1743
1744
|
| Other | An unrecognized device. |
|
1744
1745
|
|
1745
1746
|
Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).
|
@@ -1754,6 +1755,112 @@ puts response.status_code
|
|
1754
1755
|
puts response.body
|
1755
1756
|
puts response.headers
|
1756
1757
|
```
|
1758
|
+
|
1759
|
+
<a name="email-activity"></a>
|
1760
|
+
# EMAIL ACTIVITY
|
1761
|
+
|
1762
|
+
## Filter all messages
|
1763
|
+
> In order to gain access to the Email Activity Feed API, you must purchase [additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity).
|
1764
|
+
|
1765
|
+
Filter all messages to search your Email Activity.
|
1766
|
+
|
1767
|
+
Queries may need to be [URL encoded](https://meyerweb.com/eric/tools/dencoder/). URL encoding depends on how you're using the API - if you are trying it out here, or using one of the Libraries, we handle the encoding for you. If you are using cURL, or your own implementation, you probably need to encode it.
|
1768
|
+
|
1769
|
+
Queries have this format:
|
1770
|
+
|
1771
|
+
`query={query_type}="{query_content}"`
|
1772
|
+
|
1773
|
+
encoded, this would look like this:
|
1774
|
+
|
1775
|
+
`query=type%3D%22query_content%22`
|
1776
|
+
|
1777
|
+
for example:
|
1778
|
+
|
1779
|
+
Filter by a specific email - `query=to_email%3D%22example%40example.com%22`
|
1780
|
+
|
1781
|
+
Filter by subject line - `query=subject%3d%22A%20Great%20Subject%22`
|
1782
|
+
|
1783
|
+
You can filter by other operators besides `=`. We also accept `!=`, `<`, and `>`.
|
1784
|
+
|
1785
|
+
For a tutorial on how to get started, check out [Getting Started with the Email Activity API](https://sendgrid.com/docs/API_Reference/Web_API_v3/Tutorials/getting_started_email_activity_api.html).
|
1786
|
+
|
1787
|
+
For information about building combined queries, see [Building compound Email Activity queries](https://sendgrid.com/docs/API_Reference/Web_API_v3/Tutorials/getting_started_email_activity_api.html#-Creating-compound-queries).
|
1788
|
+
|
1789
|
+
### GET /messages
|
1790
|
+
```ruby
|
1791
|
+
require 'erb'
|
1792
|
+
|
1793
|
+
filter_key = 'to_email'
|
1794
|
+
filter_operator = ERB::Util.url_encode('=')
|
1795
|
+
filter_value = 'testing@sendgrid.net'
|
1796
|
+
filter_value = ERB::Util.url_encode(format('"%s"', filter_value))
|
1797
|
+
query_params = {}
|
1798
|
+
query_params['query'] = format("%s%s%s", filter_key, filter_operator, filter_value)
|
1799
|
+
query_params['limit'] = '1'
|
1800
|
+
|
1801
|
+
params = query_params
|
1802
|
+
response = sg.client.messages.get(query_params: params)
|
1803
|
+
puts response.status_code
|
1804
|
+
puts response.body
|
1805
|
+
puts response.headers
|
1806
|
+
```
|
1807
|
+
|
1808
|
+
## Filter messages by message ID
|
1809
|
+
|
1810
|
+
> In order to gain access to the Email Activity Feed API, you must purchase [additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity).
|
1811
|
+
|
1812
|
+
Get all of the details about the specified message.
|
1813
|
+
|
1814
|
+
### GET /messages/{msg_id}
|
1815
|
+
|
1816
|
+
```ruby
|
1817
|
+
msg_id = "test_url_param"
|
1818
|
+
response = sg.client.messages._(msg_id).get()
|
1819
|
+
puts response.status_code
|
1820
|
+
puts response.body
|
1821
|
+
puts response.headers
|
1822
|
+
```
|
1823
|
+
|
1824
|
+
|
1825
|
+
## Request a CSV
|
1826
|
+
|
1827
|
+
### POST /messages/download
|
1828
|
+
|
1829
|
+
> In order to gain access to the Email Activity Feed API, you must purchase [additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity).
|
1830
|
+
|
1831
|
+
This request kicks of a process to generate a CSV file. When the file is generated, the email that is listed as the account owner gets an email that links out to the file that is ready for download. The link expires in 3 days.
|
1832
|
+
|
1833
|
+
The CSV fill contain the last 1 million messages. This endpoint will be rate limited to 1 request every 12 hours.
|
1834
|
+
|
1835
|
+
```ruby
|
1836
|
+
response = sg.client.messages.download.post()
|
1837
|
+
puts response.status_code
|
1838
|
+
puts response.body
|
1839
|
+
puts response.headers
|
1840
|
+
```
|
1841
|
+
|
1842
|
+
## Download CSV
|
1843
|
+
|
1844
|
+
### GET /messages/download/{download_uuid}
|
1845
|
+
|
1846
|
+
> In order to gain access to the Email Activity Feed API, you must purchase [additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity).
|
1847
|
+
|
1848
|
+
Download the CSV that you requested with the POST Request a CSV.
|
1849
|
+
|
1850
|
+
When the file is generated, the email that is listed as the account owner gets an email that links out to the file that is ready for download. The link expires in 3 days.
|
1851
|
+
|
1852
|
+
The CSV fill contain the last 1 million messages. This endpoint will be rate limited to 1 request every 12 hours.
|
1853
|
+
|
1854
|
+
```ruby
|
1855
|
+
download_uuid = "test_url_param"
|
1856
|
+
response = sg.client.messages.download._(download_uuid).get
|
1857
|
+
puts response.status_code
|
1858
|
+
puts response.body
|
1859
|
+
puts response.headers
|
1860
|
+
```
|
1861
|
+
|
1862
|
+
|
1863
|
+
|
1757
1864
|
<a name="geo"></a>
|
1758
1865
|
# GEO
|
1759
1866
|
|
@@ -1782,7 +1889,7 @@ puts response.headers
|
|
1782
1889
|
|
1783
1890
|
**This endpoint allows you to retrieve a list of all assigned and unassigned IPs.**
|
1784
1891
|
|
1785
|
-
|
1892
|
+
The response includes warm up status, pools, assigned sub users, and authentication info. The start_date field corresponds to when warmup started for that IP.
|
1786
1893
|
|
1787
1894
|
A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.
|
1788
1895
|
|
@@ -2055,7 +2162,7 @@ puts response.headers
|
|
2055
2162
|
|
2056
2163
|
**This endpoint allows you to generate a new batch ID. This batch ID can be associated with scheduled sends via the mail/send endpoint.**
|
2057
2164
|
|
2058
|
-
If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at
|
2165
|
+
If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at any time up to 10 minutes before the scheduled date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint.
|
2059
2166
|
|
2060
2167
|
More Information:
|
2061
2168
|
|
@@ -2074,7 +2181,7 @@ puts response.headers
|
|
2074
2181
|
|
2075
2182
|
**This endpoint allows you to validate a batch ID.**
|
2076
2183
|
|
2077
|
-
If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at
|
2184
|
+
If you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at any time up to 10 minutes before the scheduled date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint.
|
2078
2185
|
|
2079
2186
|
More Information:
|
2080
2187
|
|
@@ -2092,7 +2199,7 @@ puts response.headers
|
|
2092
2199
|
```
|
2093
2200
|
## v3 Mail Send
|
2094
2201
|
|
2095
|
-
This endpoint allows you to send email over Twilio SendGrid's v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
|
2202
|
+
This endpoint allows you to send an email over Twilio SendGrid's v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
|
2096
2203
|
|
2097
2204
|
* Top level parameters are referred to as "global".
|
2098
2205
|
* Individual fields within the personalizations array will override any other global, or message level, parameters that are defined outside of personalizations.
|
@@ -2103,7 +2210,7 @@ For more detailed information about how to use the v3 Mail Send endpoint, please
|
|
2103
2210
|
|
2104
2211
|
### POST /mail/send
|
2105
2212
|
|
2106
|
-
This endpoint has a helper, check it out [here](
|
2213
|
+
This endpoint has a helper, check it out [here](lib/sendgrid/helpers/mail/README.md).
|
2107
2214
|
|
2108
2215
|
```ruby
|
2109
2216
|
data = JSON.parse('{
|
@@ -2313,7 +2420,7 @@ puts response.headers
|
|
2313
2420
|
|
2314
2421
|
**This endpoint allows you to update your current BCC mail settings.**
|
2315
2422
|
|
2316
|
-
When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field
|
2423
|
+
When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.
|
2317
2424
|
|
2318
2425
|
Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
|
2319
2426
|
|
@@ -2334,7 +2441,7 @@ puts response.headers
|
|
2334
2441
|
|
2335
2442
|
**This endpoint allows you to retrieve your current BCC mail settings.**
|
2336
2443
|
|
2337
|
-
When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field
|
2444
|
+
When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.
|
2338
2445
|
|
2339
2446
|
Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).
|
2340
2447
|
|
@@ -2725,7 +2832,7 @@ puts response.headers
|
|
2725
2832
|
|
2726
2833
|
*You may create up to 100 unique sender identities.*
|
2727
2834
|
|
2728
|
-
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2835
|
+
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2729
2836
|
|
2730
2837
|
### POST /senders
|
2731
2838
|
|
@@ -2757,7 +2864,7 @@ puts response.headers
|
|
2757
2864
|
|
2758
2865
|
**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.**
|
2759
2866
|
|
2760
|
-
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2867
|
+
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2761
2868
|
|
2762
2869
|
### GET /senders
|
2763
2870
|
|
@@ -2772,7 +2879,7 @@ puts response.headers
|
|
2772
2879
|
|
2773
2880
|
**This endpoint allows you to update a sender identity.**
|
2774
2881
|
|
2775
|
-
Updates to `from.email` require re-verification. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2882
|
+
Updates to `from.email` require re-verification. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2776
2883
|
|
2777
2884
|
Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request.
|
2778
2885
|
|
@@ -2807,7 +2914,7 @@ puts response.headers
|
|
2807
2914
|
|
2808
2915
|
**This endpoint allows you to retrieve a specific sender identity.**
|
2809
2916
|
|
2810
|
-
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2917
|
+
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2811
2918
|
|
2812
2919
|
### GET /senders/{sender_id}
|
2813
2920
|
|
@@ -2823,7 +2930,7 @@ puts response.headers
|
|
2823
2930
|
|
2824
2931
|
**This endpoint allows you to delete one of your sender identities.**
|
2825
2932
|
|
2826
|
-
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2933
|
+
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2827
2934
|
|
2828
2935
|
### DELETE /senders/{sender_id}
|
2829
2936
|
|
@@ -2839,7 +2946,7 @@ puts response.headers
|
|
2839
2946
|
|
2840
2947
|
**This endpoint allows you to resend a sender identity verification email.**
|
2841
2948
|
|
2842
|
-
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
|
2949
|
+
Sender Identities are required to be verified before use. If your domain has been authenticated, it will auto verify on creation. Otherwise, an email will be sent to the `from.email`.
|
2843
2950
|
|
2844
2951
|
### POST /senders/{sender_id}/resend_verification
|
2845
2952
|
|
@@ -3090,7 +3197,7 @@ puts response.status_code
|
|
3090
3197
|
puts response.body
|
3091
3198
|
puts response.headers
|
3092
3199
|
```
|
3093
|
-
## Remove an IP from a domain
|
3200
|
+
## Remove an IP from a domain authentication.
|
3094
3201
|
|
3095
3202
|
**This endpoint allows you to remove a domain's IP address from that domain's authentication.**
|
3096
3203
|
|
@@ -3517,7 +3624,7 @@ puts response.headers
|
|
3517
3624
|
```
|
3518
3625
|
## Retrieve Subuser Reputations
|
3519
3626
|
|
3520
|
-
Subuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will
|
3627
|
+
Subuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will affect your sender rating.
|
3521
3628
|
|
3522
3629
|
This endpoint allows you to request the reputations for your subusers.
|
3523
3630
|
|
@@ -3531,6 +3638,7 @@ puts response.status_code
|
|
3531
3638
|
puts response.body
|
3532
3639
|
puts response.headers
|
3533
3640
|
```
|
3641
|
+
|
3534
3642
|
## Retrieve email statistics for your subusers.
|
3535
3643
|
|
3536
3644
|
**This endpoint allows you to retrieve the email statistics for the given subusers.**
|
@@ -3594,7 +3702,6 @@ puts response.headers
|
|
3594
3702
|
## Enable/disable a subuser
|
3595
3703
|
|
3596
3704
|
This endpoint allows you to enable or disable a subuser.
|
3597
|
-
|
3598
3705
|
For more information about Subusers:
|
3599
3706
|
|
3600
3707
|
* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)
|
@@ -3903,7 +4010,7 @@ puts response.headers
|
|
3903
4010
|
|
3904
4011
|
**This endpoint allows you to remove an email address from your bounce list.**
|
3905
4012
|
|
3906
|
-
Bounces are messages that are returned to the server that sent it. This endpoint allows you to delete a single email
|
4013
|
+
Bounces are messages that are returned to the server that sent it. This endpoint allows you to delete a single email address from your bounce list.
|
3907
4014
|
|
3908
4015
|
For more information see:
|
3909
4016
|
|
@@ -3926,7 +4033,7 @@ puts response.headers
|
|
3926
4033
|
|
3927
4034
|
**This endpoint allows you to retrieve a list of all invalid email addresses.**
|
3928
4035
|
|
3929
|
-
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the
|
4036
|
+
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient's mail server.
|
3930
4037
|
|
3931
4038
|
Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
|
3932
4039
|
|
@@ -3951,7 +4058,7 @@ There are two options for deleting invalid email addresses:
|
|
3951
4058
|
1) You can delete all invalid email addresses by setting `delete_all` to true in the request body.
|
3952
4059
|
2) You can delete some invalid email addresses by specifying certain addresses in an array in the request body.
|
3953
4060
|
|
3954
|
-
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the
|
4061
|
+
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient's mail server.
|
3955
4062
|
|
3956
4063
|
Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
|
3957
4064
|
|
@@ -3975,9 +4082,9 @@ puts response.headers
|
|
3975
4082
|
```
|
3976
4083
|
## Retrieve a specific invalid email
|
3977
4084
|
|
3978
|
-
**This endpoint allows you to retrieve a specific invalid email
|
4085
|
+
**This endpoint allows you to retrieve a specific invalid email address.**
|
3979
4086
|
|
3980
|
-
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the
|
4087
|
+
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient's mail server.
|
3981
4088
|
|
3982
4089
|
Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
|
3983
4090
|
|
@@ -3997,7 +4104,7 @@ puts response.headers
|
|
3997
4104
|
|
3998
4105
|
**This endpoint allows you to remove a specific email address from the invalid email address list.**
|
3999
4106
|
|
4000
|
-
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the
|
4107
|
+
An invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient's mail server.
|
4001
4108
|
|
4002
4109
|
Examples include addresses without the @ sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.
|
4003
4110
|
|
@@ -4145,9 +4252,9 @@ Transactional templates are templates created specifically for transactional ema
|
|
4145
4252
|
|
4146
4253
|
### GET /templates
|
4147
4254
|
|
4148
|
-
|
4149
4255
|
```ruby
|
4150
|
-
|
4256
|
+
params = JSON.parse('{"generations": "legacy,dynamic"}')
|
4257
|
+
response = sg.client.templates.get(query_params: params)
|
4151
4258
|
puts response.status_code
|
4152
4259
|
puts response.body
|
4153
4260
|
puts response.headers
|
@@ -4695,7 +4802,7 @@ puts response.headers
|
|
4695
4802
|
If the maximum number of cancellations/pauses are added, HTTP 400 will
|
4696
4803
|
be returned.
|
4697
4804
|
|
4698
|
-
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends
|
4805
|
+
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends canceled less than 10 minutes before the scheduled time are not guaranteed to be canceled.
|
4699
4806
|
|
4700
4807
|
### POST /user/scheduled_sends
|
4701
4808
|
|
@@ -4714,7 +4821,7 @@ puts response.headers
|
|
4714
4821
|
|
4715
4822
|
**This endpoint allows you to retrieve all cancel/paused scheduled send information.**
|
4716
4823
|
|
4717
|
-
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends
|
4824
|
+
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends canceled less than 10 minutes before the scheduled time are not guaranteed to be canceled.
|
4718
4825
|
|
4719
4826
|
### GET /user/scheduled_sends
|
4720
4827
|
|
@@ -4729,7 +4836,7 @@ puts response.headers
|
|
4729
4836
|
|
4730
4837
|
**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.**
|
4731
4838
|
|
4732
|
-
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends
|
4839
|
+
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends canceled less than 10 minutes before the scheduled time are not guaranteed to be canceled.
|
4733
4840
|
|
4734
4841
|
### PATCH /user/scheduled_sends/{batch_id}
|
4735
4842
|
|
@@ -4748,7 +4855,7 @@ puts response.headers
|
|
4748
4855
|
|
4749
4856
|
**This endpoint allows you to retrieve the cancel/paused scheduled send information for a specific `batch_id`.**
|
4750
4857
|
|
4751
|
-
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends
|
4858
|
+
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends canceled less than 10 minutes before the scheduled time are not guaranteed to be canceled.
|
4752
4859
|
|
4753
4860
|
### GET /user/scheduled_sends/{batch_id}
|
4754
4861
|
|
@@ -4764,7 +4871,7 @@ puts response.headers
|
|
4764
4871
|
|
4765
4872
|
**This endpoint allows you to delete the cancellation/pause of a scheduled send.**
|
4766
4873
|
|
4767
|
-
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header.Scheduled sends
|
4874
|
+
The Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends canceled less than 10 minutes before the scheduled time are not guaranteed to be canceled.
|
4768
4875
|
|
4769
4876
|
### DELETE /user/scheduled_sends/{batch_id}
|
4770
4877
|
|
@@ -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 recent access attempts #
|
9
7
|
# GET /access_settings/activity #
|
@@ -22,10 +20,10 @@ data = JSON.parse('{
|
|
22
20
|
"ips": [
|
23
21
|
{
|
24
22
|
"ip": "192.168.1.1"
|
25
|
-
},
|
23
|
+
},
|
26
24
|
{
|
27
25
|
"ip": "192.*.*.*"
|
28
|
-
},
|
26
|
+
},
|
29
27
|
{
|
30
28
|
"ip": "192.168.1.3/32"
|
31
29
|
}
|
@@ -40,7 +38,7 @@ puts response.headers
|
|
40
38
|
# Retrieve a list of currently whitelisted IPs #
|
41
39
|
# GET /access_settings/whitelist #
|
42
40
|
|
43
|
-
response = sg.client.access_settings.whitelist.get
|
41
|
+
response = sg.client.access_settings.whitelist.get
|
44
42
|
puts response.status_code
|
45
43
|
puts response.body
|
46
44
|
puts response.headers
|
@@ -51,8 +49,8 @@ puts response.headers
|
|
51
49
|
|
52
50
|
data = JSON.parse('{
|
53
51
|
"ids": [
|
54
|
-
1,
|
55
|
-
2,
|
52
|
+
1,
|
53
|
+
2,
|
56
54
|
3
|
57
55
|
]
|
58
56
|
}')
|
@@ -65,8 +63,8 @@ puts response.headers
|
|
65
63
|
# Retrieve a specific whitelisted IP #
|
66
64
|
# GET /access_settings/whitelist/{rule_id} #
|
67
65
|
|
68
|
-
rule_id =
|
69
|
-
response = sg.client.access_settings.whitelist._(rule_id).get
|
66
|
+
rule_id = 'test_url_param'
|
67
|
+
response = sg.client.access_settings.whitelist._(rule_id).get
|
70
68
|
puts response.status_code
|
71
69
|
puts response.body
|
72
70
|
puts response.headers
|
@@ -75,9 +73,8 @@ puts response.headers
|
|
75
73
|
# Remove a specific IP from the whitelist #
|
76
74
|
# DELETE /access_settings/whitelist/{rule_id} #
|
77
75
|
|
78
|
-
rule_id =
|
79
|
-
response = sg.client.access_settings.whitelist._(rule_id).delete
|
76
|
+
rule_id = 'test_url_param'
|
77
|
+
response = sg.client.access_settings.whitelist._(rule_id).delete
|
80
78
|
puts response.status_code
|
81
79
|
puts response.body
|
82
80
|
puts response.headers
|
83
|
-
|
data/examples/alerts/alerts.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
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 new Alert #
|
9
7
|
# POST /alerts #
|
10
8
|
|
11
9
|
data = JSON.parse('{
|
12
|
-
"email_to": "example@example.com",
|
13
|
-
"frequency": "daily",
|
10
|
+
"email_to": "example@example.com",
|
11
|
+
"frequency": "daily",
|
14
12
|
"type": "stats_notification"
|
15
13
|
}')
|
16
14
|
response = sg.client.alerts.post(request_body: data)
|
@@ -22,7 +20,7 @@ puts response.headers
|
|
22
20
|
# Retrieve all alerts #
|
23
21
|
# GET /alerts #
|
24
22
|
|
25
|
-
response = sg.client.alerts.get
|
23
|
+
response = sg.client.alerts.get
|
26
24
|
puts response.status_code
|
27
25
|
puts response.body
|
28
26
|
puts response.headers
|
@@ -34,7 +32,7 @@ puts response.headers
|
|
34
32
|
data = JSON.parse('{
|
35
33
|
"email_to": "example@example.com"
|
36
34
|
}')
|
37
|
-
alert_id =
|
35
|
+
alert_id = 'test_url_param'
|
38
36
|
response = sg.client.alerts._(alert_id).patch(request_body: data)
|
39
37
|
puts response.status_code
|
40
38
|
puts response.body
|
@@ -44,8 +42,8 @@ puts response.headers
|
|
44
42
|
# Retrieve a specific alert #
|
45
43
|
# GET /alerts/{alert_id} #
|
46
44
|
|
47
|
-
alert_id =
|
48
|
-
response = sg.client.alerts._(alert_id).get
|
45
|
+
alert_id = 'test_url_param'
|
46
|
+
response = sg.client.alerts._(alert_id).get
|
49
47
|
puts response.status_code
|
50
48
|
puts response.body
|
51
49
|
puts response.headers
|
@@ -54,9 +52,8 @@ puts response.headers
|
|
54
52
|
# Delete an alert #
|
55
53
|
# DELETE /alerts/{alert_id} #
|
56
54
|
|
57
|
-
alert_id =
|
58
|
-
response = sg.client.alerts._(alert_id).delete
|
55
|
+
alert_id = 'test_url_param'
|
56
|
+
response = sg.client.alerts._(alert_id).delete
|
59
57
|
puts response.status_code
|
60
58
|
puts response.body
|
61
59
|
puts response.headers
|
62
|
-
|
data/examples/apikeys/apikeys.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
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 API keys #
|
9
7
|
# POST /api_keys #
|
10
8
|
|
11
9
|
data = JSON.parse('{
|
12
|
-
"name": "My API Key",
|
13
|
-
"sample": "data",
|
10
|
+
"name": "My API Key",
|
11
|
+
"sample": "data",
|
14
12
|
"scopes": [
|
15
|
-
"mail.send",
|
16
|
-
"alerts.create",
|
13
|
+
"mail.send",
|
14
|
+
"alerts.create",
|
17
15
|
"alerts.read"
|
18
16
|
]
|
19
17
|
}')
|
@@ -37,13 +35,13 @@ puts response.headers
|
|
37
35
|
# PUT /api_keys/{api_key_id} #
|
38
36
|
|
39
37
|
data = JSON.parse('{
|
40
|
-
"name": "A New Hope",
|
38
|
+
"name": "A New Hope",
|
41
39
|
"scopes": [
|
42
|
-
"user.profile.read",
|
40
|
+
"user.profile.read",
|
43
41
|
"user.profile.update"
|
44
42
|
]
|
45
43
|
}')
|
46
|
-
api_key_id =
|
44
|
+
api_key_id = 'test_url_param'
|
47
45
|
response = sg.client.api_keys._(api_key_id).put(request_body: data)
|
48
46
|
puts response.status_code
|
49
47
|
puts response.body
|
@@ -56,7 +54,7 @@ puts response.headers
|
|
56
54
|
data = JSON.parse('{
|
57
55
|
"name": "A New Hope"
|
58
56
|
}')
|
59
|
-
api_key_id =
|
57
|
+
api_key_id = 'test_url_param'
|
60
58
|
response = sg.client.api_keys._(api_key_id).patch(request_body: data)
|
61
59
|
puts response.status_code
|
62
60
|
puts response.body
|
@@ -66,8 +64,8 @@ puts response.headers
|
|
66
64
|
# Retrieve an existing API Key #
|
67
65
|
# GET /api_keys/{api_key_id} #
|
68
66
|
|
69
|
-
api_key_id =
|
70
|
-
response = sg.client.api_keys._(api_key_id).get
|
67
|
+
api_key_id = 'test_url_param'
|
68
|
+
response = sg.client.api_keys._(api_key_id).get
|
71
69
|
puts response.status_code
|
72
70
|
puts response.body
|
73
71
|
puts response.headers
|
@@ -76,9 +74,8 @@ puts response.headers
|
|
76
74
|
# Delete API keys #
|
77
75
|
# DELETE /api_keys/{api_key_id} #
|
78
76
|
|
79
|
-
api_key_id =
|
80
|
-
response = sg.client.api_keys._(api_key_id).delete
|
77
|
+
api_key_id = 'test_url_param'
|
78
|
+
response = sg.client.api_keys._(api_key_id).delete
|
81
79
|
puts response.status_code
|
82
80
|
puts response.body
|
83
81
|
puts response.headers
|
84
|
-
|