sendgrid-ruby 6.0.0 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +1 -1
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +111 -0
- data/.travis.yml +26 -25
- data/CHANGELOG.md +185 -10
- data/CODE_OF_CONDUCT.md +57 -25
- data/CONTRIBUTING.md +11 -23
- data/Dockerfile +14 -0
- data/FIRST_TIMERS.md +79 -0
- data/Gemfile +0 -1
- data/ISSUE_TEMPLATE.md +30 -0
- data/LICENSE +21 -0
- data/Makefile +15 -0
- data/PULL_REQUEST_TEMPLATE.md +31 -0
- data/README.md +28 -37
- data/Rakefile +2 -3
- data/TROUBLESHOOTING.md +9 -7
- 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 +19 -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-ruby.rb +5 -1
- data/lib/sendgrid/base_interface.rb +40 -0
- 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 +4 -18
- data/lib/sendgrid/helpers/mail/attachment.rb +12 -43
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
- data/lib/sendgrid/helpers/mail/category.rb +2 -4
- data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
- data/lib/sendgrid/helpers/mail/content.rb +2 -3
- data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
- data/lib/sendgrid/helpers/mail/email.rb +8 -5
- data/lib/sendgrid/helpers/mail/footer.rb +5 -27
- data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
- data/lib/sendgrid/helpers/mail/header.rb +4 -10
- data/lib/sendgrid/helpers/mail/mail.rb +30 -48
- data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
- data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
- data/lib/sendgrid/helpers/mail/personalization.rb +32 -27
- data/lib/sendgrid/helpers/mail/section.rb +4 -10
- data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
- data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -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 -7
- data/lib/sendgrid/helpers/stats/stats_response.rb +0 -2
- data/lib/sendgrid/sendgrid.rb +21 -0
- data/lib/sendgrid/twilio_email.rb +21 -0
- data/lib/sendgrid/version.rb +1 -1
- data/mail_helper_v3.md +12 -12
- data/sendgrid-ruby.gemspec +11 -10
- 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 +1 -1
- data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
- data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
- 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/sendgrid/sendgrid_spec.rb +11 -0
- data/spec/sendgrid/twilio_email_spec.rb +11 -0
- 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 +133 -93
- data/test/sendgrid/permissions/test_scopes.rb +1 -3
- data/test/sendgrid/test_sendgrid-ruby.rb +1967 -1985
- data/twilio_sendgrid_logo.png +0 -0
- data/use-cases/README.md +16 -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/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 +88 -34
- data/.github/ISSUE_TEMPLATE +0 -17
- data/.github/PULL_REQUEST_TEMPLATE +0 -26
- data/LICENSE.txt +0 -22
- data/USE_CASES.md +0 -377
- data/docker/Dockerfile +0 -12
- data/docker/README.md +0 -30
- data/lib/sendgrid/client.rb +0 -38
- data/test/prism.sh +0 -42
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,41 +1,73 @@
|
|
1
|
-
#
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
2
|
|
3
|
-
|
3
|
+
## Our Pledge
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
7
11
|
|
8
|
-
|
9
|
-
Members of the community are considerate of their peers, which include other contributors and users of Twilio SendGrid. We're thoughtful when addressing the efforts of others, keeping in mind that often the labor was completed with the intent of the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
|
12
|
+
## Our Standards
|
10
13
|
|
11
|
-
|
12
|
-
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
13
16
|
|
14
|
-
|
17
|
+
- Using welcoming and inclusive language
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
19
|
+
- Gracefully accepting constructive criticism
|
20
|
+
- Focusing on what is best for the community
|
21
|
+
- Showing empathy towards other community members
|
15
22
|
|
16
|
-
|
17
|
-
Community discussions often involve interested parties. We expect participants to be aware when they are conflicted due to employment or other projects they are involved in and disclose those interests to other project members. When in doubt, over-disclose. Perceived conflicts of interest are important to address so that the community’s decisions are credible even when unpopular, difficult or favorable to the interests of one group over another.
|
23
|
+
Examples of unacceptable behavior by participants include:
|
18
24
|
|
19
|
-
|
20
|
-
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
- Public or private harassment
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
21
33
|
|
22
|
-
|
23
|
-
Most members of the Twilio SendGrid community always comply with this Code, not because of the existence of this Code, but because they have long experience participating in open-source communities where the conduct described above is normal and expected. However, failure to observe this Code may be grounds for suspension, reporting the user for abuse or changing permissions for outside contributors.
|
34
|
+
## Our Responsibilities
|
24
35
|
|
25
|
-
|
26
|
-
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
27
39
|
|
28
|
-
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
29
45
|
|
30
|
-
|
46
|
+
## Scope
|
31
47
|
|
32
|
-
|
33
|
-
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at open-source@twilio.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
34
67
|
|
35
68
|
## Attribution
|
36
69
|
|
37
|
-
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
38
72
|
|
39
|
-
|
40
|
-
* [Open Source Initiative General Code of Conduct](https://opensource.org/codeofconduct)
|
41
|
-
* [Apache Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
CHANGED
@@ -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>
|
@@ -42,12 +39,12 @@ A software bug is a demonstrable issue in the code base. In order for us to diag
|
|
42
39
|
Before you decide to create a new issue, please try the following:
|
43
40
|
|
44
41
|
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
|
45
|
-
2. Update to the latest version of this code and check if issue has already been fixed
|
42
|
+
2. Update to the latest version of this code and check if an issue has already been fixed
|
46
43
|
3. Copy and fill in the Bug Report Template we have provided below
|
47
44
|
|
48
45
|
### Please use our Bug Report Template
|
49
46
|
|
50
|
-
In order to make the process easier, we've included a [sample bug report template](
|
47
|
+
In order to make the process easier, we've included a [sample bug report template](ISSUE_TEMPLATE.md).
|
51
48
|
|
52
49
|
<a name="improvements-to-the-codebase"></a>
|
53
50
|
## Improvements to the Codebase
|
@@ -93,7 +90,7 @@ source ./sendgrid.env
|
|
93
90
|
|
94
91
|
##### Execute: #####
|
95
92
|
|
96
|
-
See the [examples folder](
|
93
|
+
See the [examples folder](examples) to get started quickly.
|
97
94
|
|
98
95
|
To run the examples using the local version of this library from the root directory of this repo, please replace:
|
99
96
|
|
@@ -124,20 +121,13 @@ Tests for the mail send and Web API v3 endpoints.
|
|
124
121
|
|
125
122
|
The Web API v3 client is `sendgrid-ruby.rb`
|
126
123
|
|
127
|
-
<a name="testing"></a>
|
128
124
|
## Testing
|
129
125
|
|
130
|
-
All PRs require passing tests before the PR will be reviewed.
|
131
|
-
|
132
|
-
All test files are in the [`tests`](https://github.com/sendgrid/sendgrid-ruby/tree/master/test) directory.
|
126
|
+
All PRs require passing tests before the PR will be reviewed. All test files are in the [`tests`](test) directory. For the purposes of contributing to this repo, please update the [`test_sendgrid-ruby.rb`](test/sendgrid/test_sendgrid-ruby.rb) file with unit tests as you modify the code.
|
133
127
|
|
134
|
-
|
128
|
+
The integration tests require a Twilio SendGrid mock API in order to execute. We've simplified setting this up using Docker to run the tests. You will just need [Docker Desktop](https://docs.docker.com/get-docker/) and `make`.
|
135
129
|
|
136
|
-
|
137
|
-
|
138
|
-
```bash
|
139
|
-
rake
|
140
|
-
```
|
130
|
+
Once these are available, simply execute the Docker test target to run all tests: `make test-docker`. This command can also be used to open an interactive shell into the container where this library is installed. To start a *bash* shell for example, use this command: `command=bash make test-docker`.
|
141
131
|
|
142
132
|
<a name="style-guidelines-and-naming-conventions"></a>
|
143
133
|
## Style Guidelines & Naming Conventions
|
@@ -159,10 +149,10 @@ Please run your code through:
|
|
159
149
|
```bash
|
160
150
|
# Clone your fork of the repo into the current directory
|
161
151
|
git clone https://github.com/sendgrid/sendgrid-ruby
|
162
|
-
|
152
|
+
|
163
153
|
# Navigate to the newly cloned directory
|
164
154
|
cd sendgrid-ruby
|
165
|
-
|
155
|
+
|
166
156
|
# Assign the original repo to a remote called "upstream"
|
167
157
|
git remote add upstream https://github.com/sendgrid/sendgrid-ruby
|
168
158
|
```
|
@@ -183,7 +173,7 @@ Please run your code through:
|
|
183
173
|
|
184
174
|
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
185
175
|
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
186
|
-
or your code is unlikely be merged into the main project. Use Git's
|
176
|
+
or your code is unlikely to be merged into the main project. Use Git's
|
187
177
|
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
188
178
|
feature to tidy up your commits before making them public.
|
189
179
|
|
@@ -194,7 +184,7 @@ Please run your code through:
|
|
194
184
|
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
195
185
|
|
196
186
|
```bash
|
197
|
-
git pull [--rebase] upstream
|
187
|
+
git pull [--rebase] upstream main
|
198
188
|
```
|
199
189
|
|
200
190
|
6. Push your topic branch up to your fork:
|
@@ -204,9 +194,7 @@ Please run your code through:
|
|
204
194
|
```
|
205
195
|
|
206
196
|
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
207
|
-
with a clear title and description against the `
|
208
|
-
|
209
|
-
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
|
197
|
+
with a clear title and description against the `main` branch. All tests must be passing before we will review the PR.
|
210
198
|
|
211
199
|
<a name="code-reviews"></a>
|
212
200
|
## Code Reviews
|
data/Dockerfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
ARG version=ruby:latest
|
2
|
+
FROM $version
|
3
|
+
|
4
|
+
# Needed for jruby
|
5
|
+
RUN apt-get update \
|
6
|
+
&& apt-get install -y make git
|
7
|
+
|
8
|
+
COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt
|
9
|
+
RUN update-ca-certificates
|
10
|
+
|
11
|
+
WORKDIR /app
|
12
|
+
COPY . .
|
13
|
+
|
14
|
+
RUN make install
|
data/FIRST_TIMERS.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# How To Contribute to Twilio SendGrid Repositories via GitHub
|
2
|
+
Contributing to the Twilio SendGrid repositories is easy! All you need to do is find an open issue (see the bottom of this page for a list of repositories containing open issues), fix it and submit a pull request. Once you have submitted your pull request, the team can easily review it before it is merged into the repository.
|
3
|
+
|
4
|
+
To make a pull request, follow these steps:
|
5
|
+
|
6
|
+
1. Log into GitHub. If you do not already have a GitHub account, you will have to create one in order to submit a change. Click the Sign up link in the upper right-hand corner to create an account. Enter your username, password, and email address. If you are an employee of Twilio SendGrid, please use your full name with your GitHub account and enter Twilio SendGrid as your company so we can easily identify you.
|
7
|
+
|
8
|
+
<img src="/static/img/github-sign-up.png" width="800">
|
9
|
+
|
10
|
+
2. __[Fork](https://help.github.com/fork-a-repo/)__ the [sendgrid-ruby](https://github.com/sendgrid/sendgrid-ruby) repository:
|
11
|
+
|
12
|
+
<img src="/static/img/github-fork.png" width="800">
|
13
|
+
|
14
|
+
3. __Clone__ your fork via the following commands:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
# Clone your fork of the repo into the current directory
|
18
|
+
git clone https://github.com/your_username/sendgrid-ruby
|
19
|
+
# Navigate to the newly cloned directory
|
20
|
+
cd sendgrid-ruby
|
21
|
+
# Assign the original repo to a remote called "upstream"
|
22
|
+
git remote add upstream https://github.com/sendgrid/sendgrid-ruby
|
23
|
+
```
|
24
|
+
|
25
|
+
> Don't forget to replace *your_username* in the URL by your real GitHub username.
|
26
|
+
|
27
|
+
4. __Create a new topic branch__ (off the main project development branch) to contain your feature, change, or fix:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
git checkout -b <topic-branch-name>
|
31
|
+
```
|
32
|
+
|
33
|
+
5. __Commit your changes__ in logical chunks.
|
34
|
+
|
35
|
+
Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. Probably you will also have to create tests (if needed) or create or update the example code that demonstrates the functionality of this change to the code.
|
36
|
+
|
37
|
+
6. __Locally merge (or rebase)__ the upstream development branch into your topic branch:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
git pull [--rebase] upstream main
|
41
|
+
```
|
42
|
+
|
43
|
+
7. __Push__ your topic branch up to your fork:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
git push origin <topic-branch-name>
|
47
|
+
```
|
48
|
+
|
49
|
+
8. __[Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#changing-the-branch-range-and-destination-repository/)__ with a clear title and description against the `main` branch. All tests must be passing before we will review the PR.
|
50
|
+
|
51
|
+
## Important notice
|
52
|
+
|
53
|
+
Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
54
|
+
|
55
|
+
## Repositories with Open, Easy, Help Wanted, Issue Filters
|
56
|
+
|
57
|
+
* [Python SDK](https://github.com/sendgrid/sendgrid-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
58
|
+
* [PHP SDK](https://github.com/sendgrid/sendgrid-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
59
|
+
* [C# SDK](https://github.com/sendgrid/sendgrid-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
60
|
+
* [Ruby SDK](https://github.com/sendgrid/sendgrid-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
61
|
+
* [Node.js SDK](https://github.com/sendgrid/sendgrid-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
62
|
+
* [Java SDK](https://github.com/sendgrid/sendgrid-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
63
|
+
* [Go SDK](https://github.com/sendgrid/sendgrid-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
64
|
+
* [Python SMTPAPI Client](https://github.com/sendgrid/smtpapi-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
65
|
+
* [PHP SMTPAPI Client](https://github.com/sendgrid/smtpapi-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
66
|
+
* [C# SMTPAPI Client](https://github.com/sendgrid/smtpapi-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
67
|
+
* [Ruby SMTPAPI Client](https://github.com/sendgrid/smtpapi-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
68
|
+
* [Node.js SMTPAPI Client](https://github.com/sendgrid/smtpapi-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
69
|
+
* [Java SMTPAPI Client](https://github.com/sendgrid/smtpapi-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
70
|
+
* [Go SMTPAPI Client](https://github.com/sendgrid/smtpapi-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
71
|
+
* [Python HTTP Client](https://github.com/sendgrid/python-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
72
|
+
* [PHP HTTP Client](https://github.com/sendgrid/php-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
73
|
+
* [C# HTTP Client](https://github.com/sendgrid/csharp-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
74
|
+
* [Java HTTP Client](https://github.com/sendgrid/java-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
75
|
+
* [Ruby HTTP Client](https://github.com/sendgrid/ruby-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
76
|
+
* [Go HTTP Client](https://github.com/sendgrid/rest/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
77
|
+
* [Open API Definition](https://github.com/sendgrid/sendgrid-oai/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
78
|
+
* [DX Automator](https://github.com/sendgrid/dx-automator/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
79
|
+
* [Documentation](https://github.com/sendgrid/docs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
|
data/Gemfile
CHANGED
data/ISSUE_TEMPLATE.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
<!--
|
2
|
+
If this is a feature request, make sure you search Issues for an existing request before creating a new one!
|
3
|
+
|
4
|
+
Please utilize the template below to help us resolve your issue.
|
5
|
+
|
6
|
+
Note that many issues can be resolved by updating to the latest version.
|
7
|
+
-->
|
8
|
+
|
9
|
+
### Issue Summary
|
10
|
+
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples.
|
11
|
+
|
12
|
+
### Steps to Reproduce
|
13
|
+
1. This is the first step
|
14
|
+
2. This is the second step
|
15
|
+
3. Further steps, etc.
|
16
|
+
|
17
|
+
### Code Snippet
|
18
|
+
```ruby
|
19
|
+
# paste code here
|
20
|
+
```
|
21
|
+
|
22
|
+
### Exception/Log
|
23
|
+
```
|
24
|
+
# paste exception/log here
|
25
|
+
```
|
26
|
+
|
27
|
+
### Technical details:
|
28
|
+
* sendgrid-ruby version:
|
29
|
+
* ruby version:
|
30
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (C) 2021, Twilio SendGrid, Inc. <help@twilio.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
.PHONY: install test test-integ test-docker
|
2
|
+
|
3
|
+
install:
|
4
|
+
gem install bundler:2.1.2; bundle install
|
5
|
+
|
6
|
+
test:
|
7
|
+
bundle exec rake
|
8
|
+
rubocop
|
9
|
+
|
10
|
+
test-integ: test
|
11
|
+
|
12
|
+
version ?= ruby:latest
|
13
|
+
test-docker:
|
14
|
+
curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/prism/prism.sh -o prism.sh
|
15
|
+
version=$(version) bash ./prism.sh
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!--
|
2
|
+
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below.
|
3
|
+
|
4
|
+
Please format the PR title appropriately based on the type of change:
|
5
|
+
<type>[!]: <description>
|
6
|
+
Where <type> is one of: docs, chore, feat, fix, test.
|
7
|
+
Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature).
|
8
|
+
|
9
|
+
**All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.**
|
10
|
+
|
11
|
+
Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
|
12
|
+
e.g.
|
13
|
+
Fixes #1
|
14
|
+
Closes #2
|
15
|
+
-->
|
16
|
+
|
17
|
+
# Fixes #
|
18
|
+
|
19
|
+
A short description of what this PR does.
|
20
|
+
|
21
|
+
### Checklist
|
22
|
+
- [x] I acknowledge that all my contributions will be made under the project's license
|
23
|
+
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
|
24
|
+
- [ ] I have read the [Contribution Guidelines](https://github.com/sendgrid/sendgrid-ruby/blob/main/CONTRIBUTING.md) and my PR follows them
|
25
|
+
- [ ] I have titled the PR appropriately
|
26
|
+
- [ ] I have updated my branch with the main branch
|
27
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
28
|
+
- [ ] I have added the necessary documentation about the functionality in the appropriate .md file
|
29
|
+
- [ ] I have added inline documentation to the code I modified
|
30
|
+
|
31
|
+
If you have questions, please file a [support ticket](https://support.sendgrid.com), or create a GitHub Issue in this repository.
|
data/README.md
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
![Twilio SendGrid Logo](
|
1
|
+
![Twilio SendGrid Logo](twilio_sendgrid_logo.png)
|
2
2
|
|
3
|
-
[![Travis Badge](https://travis-ci.
|
3
|
+
[![Travis Badge](https://travis-ci.com/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.com/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
|
-
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](
|
6
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
|
7
7
|
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
|
8
8
|
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-ruby.svg)](https://github.com/sendgrid/sendgrid-ruby/graphs/contributors)
|
9
9
|
[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-ruby/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-ruby)
|
10
10
|
|
11
11
|
**NEW:** Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
|
12
12
|
|
13
|
+
**The default branch name for this repository has been changed to `main` as of 07/27/2020.**
|
14
|
+
|
13
15
|
**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Ruby.**
|
14
16
|
|
15
17
|
Version 3.X.X+ of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).
|
16
18
|
|
17
|
-
This library represents the beginning of a new path for Twilio SendGrid. We want this library to be community driven and Twilio SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-ruby/issues) and [pull requests](
|
19
|
+
This library represents the beginning of a new path for Twilio SendGrid. We want this library to be community driven and Twilio SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-ruby/issues) and [pull requests](CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
|
18
20
|
|
19
21
|
Please browse the rest of this README for further details.
|
20
22
|
|
@@ -29,24 +31,17 @@ We appreciate your continued support, thank you!
|
|
29
31
|
* [Usage](#usage)
|
30
32
|
* [Use Cases](#use_cases)
|
31
33
|
* [Announcements](#announcements)
|
32
|
-
* [Roadmap](#roadmap)
|
33
34
|
* [How to Contribute](#contribute)
|
34
35
|
* [Troubleshooting](#troubleshooting)
|
35
36
|
* [About](#about)
|
36
37
|
* [License](#license)
|
37
38
|
|
38
|
-
<a name="announcements"></a>
|
39
|
-
# Announcements
|
40
|
-
|
41
|
-
**NEW:** If you're a software engineer who is passionate about #DeveloperExperience and/or #OpenSource, [this is an incredible opportunity to join our #DX team](https://sendgrid.com/careers/role/1421152/?gh_jid=1421152) as a Developer Experience Engineer and work with [@thinkingserious](https://github.com/thinkingserious) and [@aroach](https://github.com/aroach)! Tell your friends :)
|
42
|
-
|
43
|
-
|
44
39
|
<a name="installation"></a>
|
45
40
|
# Installation
|
46
41
|
|
47
42
|
## Prerequisites
|
48
43
|
|
49
|
-
- Ruby version >= 2.
|
44
|
+
- Ruby version >= 2.4 (except version [2.6.0](TROUBLESHOOTING.md#ruby-versions))
|
50
45
|
- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
|
51
46
|
|
52
47
|
## Setup Environment Variables
|
@@ -87,7 +82,7 @@ gem install sendgrid-ruby
|
|
87
82
|
|
88
83
|
## Hello Email
|
89
84
|
|
90
|
-
The following is the minimum needed code to send an email with the [/mail/send Helper](
|
85
|
+
The following is the minimum needed code to send an email with the [/mail/send Helper](lib/sendgrid/helpers/mail) ([here](examples/helpers/mail/example.rb#L21) is a full example):
|
91
86
|
|
92
87
|
### With Mail Helper Class
|
93
88
|
|
@@ -109,11 +104,11 @@ puts response.parsed_body
|
|
109
104
|
puts response.headers
|
110
105
|
```
|
111
106
|
|
112
|
-
For more complex scenarios, please do not use the above constructor and instead build your own personalization object as [demonstrated here](
|
107
|
+
For more complex scenarios, please do not use the above constructor and instead build your own personalization object as [demonstrated here](examples/helpers/mail/example.rb#L21).
|
113
108
|
|
114
109
|
### Without Mail Helper Class
|
115
110
|
|
116
|
-
The following is the minimum needed code to send an email without the /mail/send Helper ([here](
|
111
|
+
The following is the minimum needed code to send an email without the /mail/send Helper ([here](examples/mail/mail.rb#L26) is a full example):
|
117
112
|
|
118
113
|
```ruby
|
119
114
|
require 'sendgrid-ruby'
|
@@ -175,58 +170,54 @@ puts response.headers
|
|
175
170
|
<a name="inbound"></a>
|
176
171
|
# Processing Inbound Email
|
177
172
|
|
178
|
-
Please see [our helper](
|
173
|
+
Please see [our helper](lib/sendgrid/helpers/inbound) for utilizing our Inbound Parse webhook.
|
179
174
|
|
180
175
|
<a name="usage"></a>
|
181
176
|
# Usage
|
182
177
|
|
183
178
|
- [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
|
184
|
-
- [Library Usage Docs](
|
185
|
-
- [Example Code](
|
179
|
+
- [Library Usage Docs](USAGE.md)
|
180
|
+
- [Example Code](examples)
|
186
181
|
- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
|
187
|
-
- [v3 Web API Mail Send Helper](
|
188
|
-
- [Settings Helper](
|
182
|
+
- [v3 Web API Mail Send Helper](lib/sendgrid/helpers/mail) - build a request object payload for a v3 /mail/send API call.
|
183
|
+
- [Settings Helper](lib/sendgrid/helpers/settings)
|
189
184
|
|
190
185
|
<a name="use_cases"></a>
|
191
186
|
# Use Cases
|
192
187
|
|
193
|
-
[Examples of common API use cases](
|
188
|
+
[Examples of common API use cases](use-cases), such as how to send an email with a transactional template.
|
194
189
|
|
195
190
|
<a name="announcements"></a>
|
196
191
|
# Announcements
|
197
192
|
|
198
193
|
Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
|
199
194
|
|
200
|
-
All updates to this library are documented in our [CHANGELOG](
|
201
|
-
|
202
|
-
<a name="roadmap"></a>
|
203
|
-
# Roadmap
|
204
|
-
|
205
|
-
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.
|
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.
|
206
196
|
|
207
197
|
<a name="contribute"></a>
|
208
198
|
# How to Contribute
|
209
199
|
|
210
|
-
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](
|
200
|
+
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](CONTRIBUTING.md) guide for details.
|
211
201
|
|
212
|
-
- [Feature Request](
|
213
|
-
- [Bug Reports](
|
214
|
-
- [
|
215
|
-
- [
|
216
|
-
- [Review Pull Requests](https://github.com/sendgrid/sendgrid-ruby/blob/master/CONTRIBUTING.md#code-reviews)
|
202
|
+
- [Feature Request](CONTRIBUTING.md#feature_request)
|
203
|
+
- [Bug Reports](CONTRIBUTING.md#submit_a_bug_report)
|
204
|
+
- [Improvements to the Codebase](CONTRIBUTING.md#improvements_to_the_codebase)
|
205
|
+
- [Review Pull Requests](CONTRIBUTING.md#code-reviews)
|
217
206
|
|
218
207
|
<a name="troubleshooting"></a>
|
219
208
|
# Troubleshooting
|
220
209
|
|
221
|
-
Please see our [troubleshooting guide](
|
210
|
+
Please see our [troubleshooting guide](TROUBLESHOOTING.md) for common library issues.
|
222
211
|
|
223
212
|
<a name="about"></a>
|
224
213
|
# About
|
225
214
|
|
226
|
-
sendgrid-ruby is
|
215
|
+
sendgrid-ruby is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of Twilio SendGrid, Inc.
|
216
|
+
|
217
|
+
If you need help installing or using the library, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
|
227
218
|
|
228
|
-
|
219
|
+
If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!
|
229
220
|
|
230
221
|
<a name="license"></a>
|
231
222
|
# License
|
232
|
-
[The MIT License (MIT)](LICENSE
|
223
|
+
[The MIT License (MIT)](LICENSE)
|