sendgrid-ruby 6.3.4 → 6.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -6
  3. data/.rubocop_todo.yml +109 -0
  4. data/.travis.yml +1 -2
  5. data/CHANGELOG.md +18 -1
  6. data/CONTRIBUTING.md +2 -5
  7. data/Makefile +1 -0
  8. data/README.md +1 -7
  9. data/Rakefile +2 -3
  10. data/USAGE.md +110 -2
  11. data/examples/accesssettings/accesssettings.rb +9 -12
  12. data/examples/alerts/alerts.rb +8 -11
  13. data/examples/apikeys/apikeys.rb +12 -15
  14. data/examples/asm/asm.rb +27 -30
  15. data/examples/browsers/browsers.rb +0 -3
  16. data/examples/campaigns/campaigns.rb +29 -32
  17. data/examples/categories/categories.rb +0 -3
  18. data/examples/clients/clients.rb +1 -4
  19. data/examples/contactdb/contactdb.rb +63 -66
  20. data/examples/devices/devices.rb +0 -3
  21. data/examples/emailactivity/emailactivity.rb +52 -0
  22. data/examples/geo/geo.rb +0 -3
  23. data/examples/helpers/eventwebhook/example.rb +4 -4
  24. data/examples/helpers/mail/example.rb +9 -10
  25. data/examples/helpers/settings/example.rb +1 -1
  26. data/examples/helpers/stats/example.rb +4 -4
  27. data/examples/ips/ips.rb +19 -22
  28. data/examples/mail/mail.rb +72 -75
  29. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  30. data/examples/mailsettings/mailsettings.rb +21 -24
  31. data/examples/partnersettings/partnersettings.rb +3 -6
  32. data/examples/scopes/scopes.rb +7 -9
  33. data/examples/senderauthentication/senderauthentication.rb +41 -44
  34. data/examples/senders/senders.rb +28 -31
  35. data/examples/stats/stats.rb +0 -3
  36. data/examples/subusers/subusers.rb +17 -20
  37. data/examples/suppression/suppression.rb +15 -18
  38. data/examples/templates/templates.rb +29 -31
  39. data/examples/trackingsettings/trackingsettings.rb +14 -17
  40. data/examples/user/user.rb +41 -44
  41. data/lib/rack/sendgrid_webhook_verification.rb +3 -2
  42. data/lib/sendgrid/base_interface.rb +1 -1
  43. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +4 -6
  44. data/lib/sendgrid/helpers/inbound/app.rb +1 -1
  45. data/lib/sendgrid/helpers/inbound/send.rb +2 -2
  46. data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
  47. data/lib/sendgrid/helpers/mail/asm.rb +6 -18
  48. data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
  49. data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
  50. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
  51. data/lib/sendgrid/helpers/mail/category.rb +2 -2
  52. data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
  53. data/lib/sendgrid/helpers/mail/content.rb +4 -3
  54. data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
  55. data/lib/sendgrid/helpers/mail/email.rb +5 -4
  56. data/lib/sendgrid/helpers/mail/footer.rb +7 -27
  57. data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
  58. data/lib/sendgrid/helpers/mail/header.rb +6 -10
  59. data/lib/sendgrid/helpers/mail/mail.rb +30 -48
  60. data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
  61. data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
  62. data/lib/sendgrid/helpers/mail/personalization.rb +34 -27
  63. data/lib/sendgrid/helpers/mail/section.rb +6 -10
  64. data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
  65. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
  66. data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
  67. data/lib/sendgrid/helpers/mail/tracking_settings.rb +7 -20
  68. data/lib/sendgrid/helpers/permissions/scope.rb +1 -1
  69. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  70. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  71. data/lib/sendgrid/helpers/stats/metrics.rb +5 -5
  72. data/lib/sendgrid/sendgrid.rb +1 -1
  73. data/lib/sendgrid/twilio_email.rb +1 -1
  74. data/lib/sendgrid/version.rb +1 -1
  75. data/mail_helper_v3.md +3 -3
  76. data/sendgrid-ruby.gemspec +7 -8
  77. data/spec/fixtures/event_webhook.rb +17 -11
  78. data/spec/rack/sendgrid_webhook_verification_spec.rb +4 -4
  79. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +38 -36
  80. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
  81. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
  82. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  83. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
  84. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
  85. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  86. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  87. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  88. data/spec/spec_helper.rb +1 -1
  89. data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
  90. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  91. data/test/sendgrid/helpers/mail/test_email.rb +9 -11
  92. data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
  93. data/test/sendgrid/helpers/mail/test_personalizations.rb +106 -93
  94. data/test/sendgrid/permissions/test_scopes.rb +0 -2
  95. data/test/sendgrid/test_sendgrid-ruby.rb +1946 -1947
  96. data/use-cases/legacy-templates.md +1 -1
  97. data/use-cases/transactional-templates.md +1 -1
  98. metadata +38 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b7ceda12fd42d78b3d9be742691aa04943810f7aaaeee00ebddded73004bb0b
4
- data.tar.gz: c0dfae6e4e0a91ebf5816f8d2b4ce8dfcc4857be2e5d31dd1289f71b0b4f1845
3
+ metadata.gz: e029e78d950c6d118cf0444a43ea84aaaa93a7524fb35d22e0442e9a575ae18e
4
+ data.tar.gz: 136c50aab4d0f6561acccad706b2238eee7bc3d76d723055ce43f38fd4ef747a
5
5
  SHA512:
6
- metadata.gz: 77d07eaf2f1b79970ec14246a185b97fb00b860831bad8db6570c8230d708f2621889eb10baeddf8f58deda706dc2ef88ba350a9fa0df25c135f03b28a8ba2db
7
- data.tar.gz: 86c963fea6f7def49fbec7399c46862244cc9bf551f9b77894458311f676fe46b66be1b87621efcf4cee702dd9d136808df66d8727108aaea5e7e15b2b751d3d
6
+ metadata.gz: ff63561ef8b7ea73bf7125c3cd62803e0ffe50a73914fbd3736d7d3aed8a98c23f6f8b6a1ab7c07d9eefc5b1fabed78586d8d27bafd548c87d4f79f422eb430f
7
+ data.tar.gz: 3d7eb06f425f60994db736113f45c9db3406b63f4bc1ff1a6e7eadd6761f8a67ba98eda05cf6830eef40fd9143046219ec3e7fa9d5b58da8bc270eddf0809a68
@@ -1,6 +1,4 @@
1
- AllCops:
2
- Exclude:
3
- - examples/**/*
4
- - gemfiles/**/*
5
- - spec/**/*
6
- - test/**/*
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/StringLiterals:
4
+ Enabled: false
@@ -0,0 +1,109 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-09-18 20:20:54 UTC using RuboCop version 0.91.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'sendgrid-ruby.gemspec'
15
+
16
+ # Offense count: 22
17
+ Lint/UselessAssignment:
18
+ Exclude:
19
+ - 'examples/scopes/scopes.rb'
20
+ - 'spec/rack/sendgrid_webhook_verification_spec.rb'
21
+
22
+ # Offense count: 8
23
+ # Configuration parameters: IgnoredMethods.
24
+ Metrics/AbcSize:
25
+ Max: 144
26
+
27
+ # Offense count: 9
28
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
29
+ # ExcludedMethods: refine
30
+ Metrics/BlockLength:
31
+ Max: 96
32
+
33
+ # Offense count: 3
34
+ # Configuration parameters: CountComments, CountAsOne.
35
+ Metrics/ClassLength:
36
+ Max: 2006
37
+
38
+ # Offense count: 41
39
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
40
+ Metrics/MethodLength:
41
+ Max: 141
42
+
43
+ # Offense count: 2
44
+ # Configuration parameters: CountKeywordArgs.
45
+ Metrics/ParameterLists:
46
+ Max: 7
47
+
48
+ # Offense count: 4
49
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
50
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
51
+ Naming/FileName:
52
+ Exclude:
53
+ - 'gemfiles/Sinatra_1.gemfile'
54
+ - 'gemfiles/Sinatra_2.gemfile'
55
+ - 'lib/sendgrid-ruby.rb'
56
+ - 'test/sendgrid/test_sendgrid-ruby.rb'
57
+
58
+ # Offense count: 1
59
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
60
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
61
+ Naming/MethodParameterName:
62
+ Exclude:
63
+ - 'lib/sendgrid/helpers/mail/personalization.rb'
64
+
65
+ # Offense count: 1
66
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
67
+ # NamePrefix: is_, has_, have_
68
+ # ForbiddenPrefixes: is_, has_, have_
69
+ # AllowedMethods: is_a?
70
+ # MethodDefinitionMacros: define_method, define_singleton_method
71
+ Naming/PredicateName:
72
+ Exclude:
73
+ - 'spec/**/*'
74
+ - 'examples/helpers/eventwebhook/example.rb'
75
+
76
+ # Offense count: 35
77
+ Style/Documentation:
78
+ Enabled: false
79
+
80
+ # Offense count: 4
81
+ # Configuration parameters: EnforcedStyle.
82
+ # SupportedStyles: annotated, template, unannotated
83
+ Style/FormatStringToken:
84
+ Exclude:
85
+ - 'examples/emailactivity/emailactivity.rb'
86
+
87
+ # Offense count: 97
88
+ # Cop supports --auto-correct.
89
+ # Configuration parameters: EnforcedStyle.
90
+ # SupportedStyles: always, always_true, never
91
+ Style/FrozenStringLiteralComment:
92
+ Enabled: false
93
+
94
+ # Offense count: 6
95
+ Style/MixinUsage:
96
+ Exclude:
97
+ - 'examples/helpers/eventwebhook/example.rb'
98
+ - 'examples/helpers/mail/example.rb'
99
+ - 'examples/helpers/settings/example.rb'
100
+ - 'examples/helpers/stats/example.rb'
101
+ - 'test/sendgrid/helpers/mail/test_attachment.rb'
102
+ - 'test/sendgrid/helpers/mail/test_mail.rb'
103
+
104
+ # Offense count: 55
105
+ # Cop supports --auto-correct.
106
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
107
+ # URISchemes: http, https
108
+ Layout/LineLength:
109
+ Max: 3211
@@ -14,8 +14,7 @@ script: make test-docker
14
14
 
15
15
  deploy:
16
16
  provider: rubygems
17
- api_key:
18
- secure: CWlfN170i/fHPrIufHHLWQ0utjuhxf4ELSxKeypIuO2CNTqNMzocDAa2vxMt4XfO6d2wFPV/LC+IHR7i+sp7PKvjRoa4BLUUxjfBNDboc0gGESeUYlAxwsJo0tOVCNmpxgjQKqtPLz/19A/v/xpxLv2Im/9Idqa5ATd06sMDdM8=
17
+ api_key: $RUBYGEMS_API_KEY
19
18
  gem: sendgrid-ruby
20
19
  on:
21
20
  tags: true
@@ -1,6 +1,23 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ [2020-09-28] Version 6.3.5
5
+ --------------------------
6
+ **Library - Fix**
7
+ - [PR #437](https://github.com/sendgrid/sendgrid-ruby/pull/437): Raise error when adding duplicate email address in Personalizations. Thanks to [@Pranc1ngPegasus](https://github.com/Pranc1ngPegasus)!
8
+
9
+ **Library - Docs**
10
+ - [PR #322](https://github.com/sendgrid/sendgrid-ruby/pull/322): Update documentation for retrieving a list of all templates. Thanks to [@renshuki](https://github.com/renshuki)!
11
+ - [PR #332](https://github.com/sendgrid/sendgrid-ruby/pull/332): Add Email activity API Documentation. Thanks to [@dhoeric](https://github.com/dhoeric)!
12
+
13
+ **Library - Test**
14
+ - [PR #315](https://github.com/sendgrid/sendgrid-ruby/pull/315): Add rubocop check to CI. Thanks to [@dipil-saud](https://github.com/dipil-saud)!
15
+
16
+ **Library - Chore**
17
+ - [PR #339](https://github.com/sendgrid/sendgrid-ruby/pull/339): Added rubocop configs and changed source files with rubocop "offenses". Thanks to [@douglaslise](https://github.com/douglaslise)!
18
+ - [PR #338](https://github.com/sendgrid/sendgrid-ruby/pull/338): Refactor getters and setters to use ruby accessors. Thanks to [@douglaslise](https://github.com/douglaslise)!
19
+
20
+
4
21
  [2020-08-19] Version 6.3.4
5
22
  --------------------------
6
23
  **Library - Docs**
@@ -171,7 +188,7 @@ All notable changes to this project will be documented in this file.
171
188
 
172
189
  ## [5.2.0] - 2017-10-30 ##
173
190
  ### Added
174
- - PR #234: Helpers for email statistics - global, category, subuser
191
+ - PR #234: Helpers for email statistics - global, category, subuser
175
192
  - Thanks to [Awin Abi](https://github.com/awinabi) for the pull request!
176
193
 
177
194
  ## [5.1.0] - 2017-9-1 ##
@@ -17,9 +17,6 @@ Hello! Thank you for choosing to help contribute to one of the Twilio SendGrid o
17
17
  - [Creating a Pull Request](#creating-a-pull-request)
18
18
  - [Code Reviews](#code-reviews)
19
19
 
20
- <a name="roadmap"></a>
21
- We use [Milestones](https://github.com/sendgrid/sendgrid-ruby/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions, and additional PRs are welcomed and encouraged.
22
-
23
20
  There are a few ways to contribute, which we'll enumerate below:
24
21
 
25
22
  <a name="feature-request"></a>
@@ -152,10 +149,10 @@ Please run your code through:
152
149
  ```bash
153
150
  # Clone your fork of the repo into the current directory
154
151
  git clone https://github.com/sendgrid/sendgrid-ruby
155
-
152
+
156
153
  # Navigate to the newly cloned directory
157
154
  cd sendgrid-ruby
158
-
155
+
159
156
  # Assign the original repo to a remote called "upstream"
160
157
  git remote add upstream https://github.com/sendgrid/sendgrid-ruby
161
158
  ```
data/Makefile CHANGED
@@ -5,6 +5,7 @@ install:
5
5
 
6
6
  test:
7
7
  bundle exec rake
8
+ rubocop
8
9
 
9
10
  test-integ: test
10
11
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Twilio SendGrid Logo](twilio_sendgrid_logo.png)
2
2
 
3
- [![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.org/sendgrid/sendgrid-ruby)
3
+ [![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.org/sendgrid/sendgrid-ruby)
4
4
  [![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
5
5
  [![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
6
6
  [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)
@@ -31,7 +31,6 @@ We appreciate your continued support, thank you!
31
31
  * [Usage](#usage)
32
32
  * [Use Cases](#use_cases)
33
33
  * [Announcements](#announcements)
34
- * [Roadmap](#roadmap)
35
34
  * [How to Contribute](#contribute)
36
35
  * [Troubleshooting](#troubleshooting)
37
36
  * [About](#about)
@@ -195,11 +194,6 @@ Please see our announcement regarding [breaking changes](https://github.com/send
195
194
 
196
195
  All updates to this library are documented in our [CHANGELOG](CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
197
196
 
198
- <a name="roadmap"></a>
199
- # Roadmap
200
-
201
- If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/sendgrid/sendgrid-ruby/issues) and [pull requests](https://github.com/sendgrid/sendgrid-ruby/pulls). We would love to hear your feedback.
202
-
203
197
  <a name="contribute"></a>
204
198
  # How to Contribute
205
199
 
data/Rakefile CHANGED
@@ -10,6 +10,5 @@ end
10
10
 
11
11
  RSpec::Core::RakeTask.new(:spec)
12
12
 
13
- desc "Run tests"
14
- task default: [:spec, :test]
15
-
13
+ desc 'Run tests'
14
+ task default: %i[spec test]
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)
@@ -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
 
@@ -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.**
@@ -4144,9 +4252,9 @@ Transactional templates are templates created specifically for transactional ema
4144
4252
 
4145
4253
  ### GET /templates
4146
4254
 
4147
-
4148
4255
  ```ruby
4149
- response = sg.client.templates.get()
4256
+ params = JSON.parse('{"generations": "legacy,dynamic"}')
4257
+ response = sg.client.templates.get(query_params: params)
4150
4258
  puts response.status_code
4151
4259
  puts response.body
4152
4260
  puts response.headers
@@ -1,9 +1,7 @@
1
1
  require 'sendgrid-ruby'
2
2
 
3
-
4
3
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
4
 
6
-
7
5
  ##################################################
8
6
  # Retrieve 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 = "test_url_param"
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 = "test_url_param"
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
-