smtpapi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +17 -0
- data/.env_sample +1 -0
- data/.github/ISSUE_TEMPLATE +17 -0
- data/.github/PULL_REQUEST_TEMPLATE +24 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +20 -7
- data/CHANGELOG.md +41 -1
- data/CODE_OF_CONDUCT.md +41 -0
- data/CONTRIBUTING.md +181 -0
- data/LICENSE.txt +1 -1
- data/Makefile +7 -0
- data/README.md +70 -145
- data/TROUBLESHOOTING.md +17 -0
- data/examples/example.rb +81 -0
- data/lib/smtpapi.rb +12 -10
- data/lib/smtpapi/version.rb +1 -1
- data/smtpapi.gemspec +1 -3
- data/test/test.rb +90 -10
- data/use_cases/README.md +3 -0
- metadata +13 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fd52e5509ec31d99e879b341ecb97c903c755cd549a2062b5c82c9b2f840316d
|
4
|
+
data.tar.gz: 6304f16a9d0336b988bd98b0cab323408ef8089d3608aad6c99d6996c70f3d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106eb5d455c551673148034db89c6585e0fe7242938c9227d4aae53a3934a1d69c432920b5766cde6bfd62afd0fb84c961847f752f4a6ee70500d832640a0ee4
|
7
|
+
data.tar.gz: cee21370e420f428d29029b1c62f6ec045577eb5a7572a22c1f238912647454ec744a54d0b190f7e6f39428d69ad45da37619005e3f5270c601dc324aac0a8b2
|
data/.codeclimate.yml
ADDED
data/.env_sample
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SENDGRID_API_KEY=
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#### Issue Summary
|
2
|
+
|
3
|
+
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, code examples.
|
4
|
+
|
5
|
+
|
6
|
+
#### Steps to Reproduce
|
7
|
+
|
8
|
+
1. This is the first step
|
9
|
+
2. This is the second step
|
10
|
+
3. Further steps, etc.
|
11
|
+
|
12
|
+
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
|
13
|
+
|
14
|
+
#### Technical details:
|
15
|
+
|
16
|
+
* smtpapi-ruby Version: master (latest commit: [commit number])
|
17
|
+
* Ruby Version: 2.2
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!--
|
2
|
+
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.
|
3
|
+
|
4
|
+
|
5
|
+
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!
|
6
|
+
e.g.
|
7
|
+
Fixes #1
|
8
|
+
Closes #2
|
9
|
+
-->
|
10
|
+
# Fixes #
|
11
|
+
|
12
|
+
### Checklist
|
13
|
+
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
|
14
|
+
- [ ] I have read the [Contribution Guide] and my PR follows them.
|
15
|
+
- [ ] I updated my branch with the master branch.
|
16
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
17
|
+
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
|
18
|
+
- [ ] I have added in line documentation to the code I modified
|
19
|
+
|
20
|
+
### Short description of what this PR does:
|
21
|
+
-
|
22
|
+
-
|
23
|
+
|
24
|
+
If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
- ruby-head
|
4
|
+
- 2.6
|
5
|
+
- 2.5
|
6
|
+
- 2.4
|
7
|
+
- jruby
|
7
8
|
before_script:
|
8
|
-
|
9
|
+
- bundle install
|
9
10
|
script:
|
10
|
-
|
11
|
-
|
11
|
+
- rubocop --fail-level=W
|
12
|
+
- rake test
|
13
|
+
matrix:
|
14
|
+
allow_failures:
|
15
|
+
- rvm: ruby-head
|
16
|
+
fast_finish: true
|
17
|
+
deploy:
|
18
|
+
provider: rubygems
|
19
|
+
api_key:
|
20
|
+
secure: PRNz0pPyO99KdYcQ1WKkunc3TOz1N5ZmdT997KlzRYa5uos+IFqr5UsztJzOrus5iWoQdKKtLGSRYe1SFnXDkSOwK61Q5YvYdSqF3OE/QD63qHub+is4CxmfMmXg+eBGreSH+kIWlSD8N3ic2CDZR8JoQmhPcit6zCZSN3WVRfY=
|
21
|
+
gem: smtpapi-ruby
|
22
|
+
on:
|
23
|
+
tags: true
|
24
|
+
rvm: '2.4'
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,48 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
|
+
|
3
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
5
|
|
5
|
-
|
6
|
+
[2020-01-09] Version 0.1.1
|
7
|
+
--------------------------
|
8
|
+
**Library - Chore**
|
9
|
+
- [PR #92](https://github.com/sendgrid/smtpapi-ruby/pull/92): Auto-deploy upon successful tagged commit. Thanks to [@thinkingserious](https://github.com/thinkingserious)!
|
10
|
+
- [PR #50](https://github.com/sendgrid/smtpapi-ruby/pull/50): Update License date range. Thanks to [@shucon](https://github.com/shucon)!
|
11
|
+
- [PR #85](https://github.com/sendgrid/smtpapi-ruby/pull/85): updated Readme.md. Thanks to [@rahulpuroht](https://github.com/rahulpuroht)!
|
12
|
+
- [PR #67](https://github.com/sendgrid/smtpapi-ruby/pull/67): Add Use Cases directory. Thanks to [@eyewritecode](https://github.com/eyewritecode)!
|
13
|
+
- [PR #65](https://github.com/sendgrid/smtpapi-ruby/pull/65): Update LICENSE.txt. Thanks to [@nocategory](https://github.com/nocategory)!
|
14
|
+
- [PR #64](https://github.com/sendgrid/smtpapi-ruby/pull/64): Resolve linting issues. Thanks to [@mrala](https://github.com/mrala)!
|
15
|
+
- [PR #46](https://github.com/sendgrid/smtpapi-ruby/pull/46): Replaced .length > 0 with .!empty?. Thanks to [@nvzard](https://github.com/nvzard)!
|
16
|
+
- [PR #35](https://github.com/sendgrid/smtpapi-ruby/pull/35): Replaced .length > 0 with !empty #32. Thanks to [@181514912](https://github.com/181514912)!
|
17
|
+
- [PR #42](https://github.com/sendgrid/smtpapi-ruby/pull/42): Added unittest to check for specific repo files. Thanks to [@mptap](https://github.com/mptap)!
|
18
|
+
- [PR #40](https://github.com/sendgrid/smtpapi-ruby/pull/40): Update LICENSE.txt. Thanks to [@GaryLeutheuser](https://github.com/GaryLeutheuser)!
|
19
|
+
- [PR #41](https://github.com/sendgrid/smtpapi-ruby/pull/41): Add License end year test. Thanks to [@diegous](https://github.com/diegous)!
|
20
|
+
- [PR #43](https://github.com/sendgrid/smtpapi-ruby/pull/43): Update LICENSE.txt. Thanks to [@astromoose](https://github.com/astromoose)!
|
21
|
+
- [PR #26](https://github.com/sendgrid/smtpapi-ruby/pull/26): add a .env_sample file. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
22
|
+
- [PR #24](https://github.com/sendgrid/smtpapi-ruby/pull/24): add Gem badge to README file. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
23
|
+
- [PR #28](https://github.com/sendgrid/smtpapi-ruby/pull/28): Added the gem badge. Thanks to [@roooodcastro](https://github.com/roooodcastro)!
|
24
|
+
- [PR #44](https://github.com/sendgrid/smtpapi-ruby/pull/44): Rename PULL_REQUEST_TEMPLATE.md. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
25
|
+
- [PR #25](https://github.com/sendgrid/smtpapi-ruby/pull/25): add pull request template. Thanks to [@rohitdaryanani](https://github.com/rohitdaryanani)!
|
26
|
+
- [PR #31](https://github.com/sendgrid/smtpapi-ruby/pull/31): Added .codeclimate.yml. Thanks to [@veruz](https://github.com/veruz)!
|
27
|
+
- [PR #18](https://github.com/sendgrid/smtpapi-ruby/pull/18): add .github/ISSUE_TEMPLATE. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
28
|
+
- [PR #13](https://github.com/sendgrid/smtpapi-ruby/pull/13): Add/update badges on README. Thanks to [@jessecalton](https://github.com/jessecalton)!
|
29
|
+
- [PR #12](https://github.com/sendgrid/smtpapi-ruby/pull/12): more SEO friendly url. Thanks to [@ladhadha](https://github.com/ladhadha)!
|
30
|
+
|
31
|
+
**Library - Fix**
|
32
|
+
- [PR #69](https://github.com/sendgrid/smtpapi-ruby/pull/69): Remove duplicate text in CONTRIBUTING.md. Thanks to [@eyewritecode](https://github.com/eyewritecode)!
|
33
|
+
- [PR #17](https://github.com/sendgrid/smtpapi-ruby/pull/17): Fixed some Grammatical errors in CONTRIBUTING.md. Thanks to [@mohsincl](https://github.com/mohsincl)!
|
34
|
+
- [PR #16](https://github.com/sendgrid/smtpapi-ruby/pull/16): update contributing and readme - fix typo and ToC. Thanks to [@pushkyn](https://github.com/pushkyn)!
|
35
|
+
|
36
|
+
**Library - Docs**
|
37
|
+
- [PR #15](https://github.com/sendgrid/smtpapi-ruby/pull/15): update README.md. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
38
|
+
- [PR #14](https://github.com/sendgrid/smtpapi-ruby/pull/14): add table of contents in README.md. Thanks to [@thepriefy](https://github.com/thepriefy)!
|
39
|
+
- [PR #9](https://github.com/sendgrid/smtpapi-ruby/pull/9): Add TROUBLESHOOTING.md. Thanks to [@colto](https://github.com/colto)!
|
40
|
+
- [PR #7](https://github.com/sendgrid/smtpapi-ruby/pull/7): Added Code of Conduct. Thanks to [@gr8shivam](https://github.com/gr8shivam)!
|
41
|
+
- [PR #5](https://github.com/sendgrid/smtpapi-ruby/pull/5): Update README.md. Thanks to [@ciceropablo](https://github.com/ciceropablo)!
|
42
|
+
|
43
|
+
|
44
|
+
[2015-04-06] Version 0.1.0
|
45
|
+
--------------------------
|
6
46
|
### Changed
|
7
47
|
- Change home to SendGrid
|
8
48
|
- Add unit test dev dep
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# SendGrid Community Code of Conduct
|
2
|
+
|
3
|
+
The SendGrid open source community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences successes and continued growth. When you're working with members of the community, we encourage you to follow these guidelines, which help steer our interactions and strive to maintain a positive, successful and growing community.
|
4
|
+
|
5
|
+
### Be Open
|
6
|
+
Members of the community are open to collaboration, whether it's on pull requests, code reviews, approvals, issues or otherwise. We're receptive to constructive comments and criticism, as the experiences and skill sets of all members contribute to the whole of our efforts. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate, and everyone can make a difference.
|
7
|
+
|
8
|
+
### Be Considerate
|
9
|
+
Members of the community are considerate of their peers, which include other contributors and users of 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.
|
10
|
+
|
11
|
+
### Be Respectful
|
12
|
+
Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments and their efforts. We're respectful of the volunteer efforts that permeate the SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
|
13
|
+
|
14
|
+
## Additional Guidance
|
15
|
+
|
16
|
+
### Disclose Potential Conflicts of Interest
|
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.
|
18
|
+
|
19
|
+
### Interpretation
|
20
|
+
This Code is not exhaustive or complete. It is not a rulebook; it serves to distill our common understanding of a collaborative, shared environment and goals. We expect it to be followed in spirit as much as in the letter. When in doubt, try to abide by [SendGrid’s cultural values](https://sendgrid.com/blog/employee-engagement-the-4h-way) defined by our “4H’s”: Happy, Hungry, Humble and Honest.
|
21
|
+
|
22
|
+
### Enforcement
|
23
|
+
Most members of the 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.
|
24
|
+
|
25
|
+
## If you have concerns about someone’s conduct
|
26
|
+
**Initiate Direct Contact** - It is always appropriate to email a community member (if contact information is available), mention that you think their behavior was out of line, and (if necessary) point them to this Code.
|
27
|
+
|
28
|
+
**Discuss Publicly** - Discussing publicly is always acceptable. Note, though, that approaching the person directly may be better, as it tends to make them less defensive, and it respects the time of other community members, so you probably want to try direct contact first.
|
29
|
+
|
30
|
+
**Contact the Moderators** - You can reach the SendGrid moderators by emailing dx@sendgrid.com.
|
31
|
+
|
32
|
+
## Submission to SendGrid Repositories
|
33
|
+
Finally, just a reminder, changes to the SendGrid repositories will only be accepted upon completion of the [SendGrid Contributor Agreement](https://cla.sendgrid.com).
|
34
|
+
|
35
|
+
## Attribution
|
36
|
+
|
37
|
+
SendGrid thanks the following, on which it draws for content and inspiration:
|
38
|
+
|
39
|
+
* [Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/)
|
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)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
|
2
|
+
|
3
|
+
- [CLAs and CCLAs](#cla)
|
4
|
+
- [Roadmap & Milestones](#roadmap)
|
5
|
+
- [Feature Request](#feature-request)
|
6
|
+
- [Submit a Bug Report](#submit-a-bug-report)
|
7
|
+
- [Improvements to the Codebase](#improvements-to-the-codebase)
|
8
|
+
- [Understanding the Code Base](#understanding-the-codebase)
|
9
|
+
- [Testing](#testing)
|
10
|
+
- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions)
|
11
|
+
- [Creating a Pull Request](#creating-a-pull-request)
|
12
|
+
|
13
|
+
<a name="roadmap"></a>
|
14
|
+
We use [Milestones](https://github.com/sendgrid/smtpapi-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.
|
15
|
+
|
16
|
+
<a name="cla"></a>
|
17
|
+
## CLAs and CCLAs
|
18
|
+
|
19
|
+
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project.
|
20
|
+
|
21
|
+
Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
|
22
|
+
|
23
|
+
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla).
|
24
|
+
|
25
|
+
When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change.
|
26
|
+
|
27
|
+
There are a few ways to contribute, which we'll enumerate below:
|
28
|
+
|
29
|
+
<a name="feature-request"></a>
|
30
|
+
## Feature Request
|
31
|
+
|
32
|
+
If you'd like to make a feature request, please read this section.
|
33
|
+
|
34
|
+
The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
|
35
|
+
|
36
|
+
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
|
37
|
+
- Please be respectful and considerate of others when commenting on issues.
|
38
|
+
|
39
|
+
<a name="submit-a-bug-report"></a>
|
40
|
+
## Submit a Bug Report
|
41
|
+
|
42
|
+
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
|
43
|
+
|
44
|
+
A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
|
45
|
+
|
46
|
+
Before you decide to create a new issue, please try the following:
|
47
|
+
|
48
|
+
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
|
49
|
+
2. Update to the latest version of this code and check if the issue has already been fixed.
|
50
|
+
3. Copy and fill in the Bug Report Template we have provided below.
|
51
|
+
|
52
|
+
### Please use our Bug Report Template
|
53
|
+
|
54
|
+
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/smtpapi-ruby/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
|
55
|
+
|
56
|
+
<a name="improvements-to-the-codebase"></a>
|
57
|
+
## Improvements to the Codebase
|
58
|
+
|
59
|
+
We welcome direct contributions to the smtpapi-ruby code base. Thank you!
|
60
|
+
|
61
|
+
### Development Environment ###
|
62
|
+
|
63
|
+
#### Install and Run Locally ####
|
64
|
+
|
65
|
+
##### Prerequisites #####
|
66
|
+
|
67
|
+
- Ruby version 2.2
|
68
|
+
- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=smtpapi-ruby))
|
69
|
+
|
70
|
+
##### Initial setup: #####
|
71
|
+
|
72
|
+
```bash
|
73
|
+
git clone https://github.com/sendgrid/smtpapi-ruby.git
|
74
|
+
cd smtpapi-ruby
|
75
|
+
```
|
76
|
+
|
77
|
+
##### Execute: #####
|
78
|
+
|
79
|
+
See the [examples folder](https://github.com/sendgrid/smtpapi-ruby/tree/master/examples) to get started quickly.
|
80
|
+
|
81
|
+
To run the example:
|
82
|
+
|
83
|
+
```bash
|
84
|
+
ruby examples/example.rb
|
85
|
+
```
|
86
|
+
|
87
|
+
<a name="understanding-the-codebase"></a>
|
88
|
+
## Understanding the Code Base
|
89
|
+
|
90
|
+
**/examples**
|
91
|
+
|
92
|
+
Working examples that demonstrate usage.
|
93
|
+
|
94
|
+
**/tess**
|
95
|
+
|
96
|
+
Unit tests
|
97
|
+
|
98
|
+
**/lib/smtpapi**
|
99
|
+
|
100
|
+
Source code.
|
101
|
+
|
102
|
+
<a name="testing"></a>
|
103
|
+
## Testing
|
104
|
+
|
105
|
+
All PRs require passing tests before the PR will be reviewed.
|
106
|
+
|
107
|
+
All test files are in the [`test`](https://github.com/sendgrid/smtpapi-ruby/tree/master/test) directory.
|
108
|
+
|
109
|
+
For the purposes of contributing to this repo, please update the [`test.rb`](https://github.com/sendgrid/smtpapi-ruby/blob/master/test/test.rb) file with unit tests as you modify the code.
|
110
|
+
|
111
|
+
To run the tests:
|
112
|
+
|
113
|
+
```bash
|
114
|
+
rake test
|
115
|
+
```
|
116
|
+
|
117
|
+
<a name="style-guidelines-and-naming-conventions"></a>
|
118
|
+
## Style Guidelines & Naming Conventions
|
119
|
+
|
120
|
+
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
|
121
|
+
|
122
|
+
- [Community Driven Style Guide](https://github.com/bbatsov/ruby-style-guide)
|
123
|
+
|
124
|
+
Please run your code through:
|
125
|
+
|
126
|
+
- [rubocop](https://github.com/bbatsov/rubocop).
|
127
|
+
|
128
|
+
## Creating a Pull Request<a name="creating-a-pull-request"></a>
|
129
|
+
|
130
|
+
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
|
131
|
+
and configure the remotes:
|
132
|
+
|
133
|
+
```bash
|
134
|
+
# Clone your fork of the repo into the current directory
|
135
|
+
git clone https://github.com/sendgrid/smtpapi-ruby
|
136
|
+
# Navigate to the newly cloned directory
|
137
|
+
cd smtpapi-ruby
|
138
|
+
# Assign the original repo to a remote called "upstream"
|
139
|
+
git remote add upstream https://github.com/sendgrid/smtpapi-ruby
|
140
|
+
```
|
141
|
+
|
142
|
+
2. If you cloned a while ago, get the latest changes from upstream:
|
143
|
+
|
144
|
+
```bash
|
145
|
+
git checkout <dev-branch>
|
146
|
+
git pull upstream <dev-branch>
|
147
|
+
```
|
148
|
+
|
149
|
+
3. Create a new topic branch (off the main project development branch) to
|
150
|
+
contain your feature, change, or fix:
|
151
|
+
|
152
|
+
```bash
|
153
|
+
git checkout -b <topic-branch-name>
|
154
|
+
```
|
155
|
+
|
156
|
+
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
157
|
+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
158
|
+
or your code is unlikely be merged into the main project. Use Git's
|
159
|
+
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
160
|
+
feature to tidy up your commits before making them public.
|
161
|
+
|
162
|
+
4a. Create tests.
|
163
|
+
|
164
|
+
4b. Create or update the example code that demonstrates the functionality of this change to the code.
|
165
|
+
|
166
|
+
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
167
|
+
|
168
|
+
```bash
|
169
|
+
git pull [--rebase] upstream master
|
170
|
+
```
|
171
|
+
|
172
|
+
6. Push your topic branch up to your fork:
|
173
|
+
|
174
|
+
```bash
|
175
|
+
git push origin <topic-branch-name>
|
176
|
+
```
|
177
|
+
|
178
|
+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
179
|
+
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
|
180
|
+
|
181
|
+
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
|
data/LICENSE.txt
CHANGED
data/Makefile
ADDED
data/README.md
CHANGED
@@ -1,190 +1,115 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
This ruby gem allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.
|
1
|
+
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
|
4
2
|
|
5
3
|
[![Build Status](https://travis-ci.org/sendgrid/smtpapi-ruby.svg?branch=master)](https://travis-ci.org/SendGrid/smtpapi-ruby)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/smtpapi.svg)](https://badge.fury.io/rb/smtpapi)
|
5
|
+
[![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
|
7
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
|
8
|
+
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
|
9
|
+
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/smtpapi-ruby.svg)](https://github.com/sendgrid/smtpapi-ruby/graphs/contributors)
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
gem 'smtpapi'
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install smtpapi
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
### Initializing
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
header = Smtpapi::Header.new
|
27
|
-
```
|
28
|
-
|
29
|
-
### to_json
|
11
|
+
**This ruby gem allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.**
|
30
12
|
|
31
|
-
This gives you back the stringified json formatted X-SMTPAPI header.
|
32
13
|
|
33
|
-
|
34
|
-
header = Smtpapi::Header.new
|
35
|
-
header.to_json
|
36
|
-
```
|
14
|
+
# Announcements
|
37
15
|
|
38
|
-
|
16
|
+
**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 :)
|
39
17
|
|
40
|
-
|
41
|
-
header = Smtpapi::Header.new
|
42
|
-
header.add_to('you@youremail.com') # to => ['you@youremail.com']
|
43
|
-
header.add_to('other@otheremail.com', 'other') # to => ['you@youremail.com', 'other <other@otheremail.com>']
|
44
|
-
header.add_to(['you@youremail.com', 'other@otheremail.com']) # to => ['you@youremail.com', 'other <other@otheremail.com>', 'you@youremail.com', 'other@otheremail.com']
|
45
|
-
```
|
18
|
+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/smtpapi-ruby/blob/master/CHANGELOG.md).
|
46
19
|
|
47
|
-
|
20
|
+
# Table of Contents
|
21
|
+
- [Installation](#installation)
|
22
|
+
- [Quick Start](#quick-start)
|
23
|
+
- [Usage](#usage)
|
24
|
+
- [Roadmap](#roadmap)
|
25
|
+
- [How to Contribute](#contribute)
|
26
|
+
- [About](#about)
|
27
|
+
- [License](#license)
|
48
28
|
|
49
|
-
|
50
|
-
|
51
|
-
header.set_tos(['you@youremail.com', 'other@otheremail.com']) # to => ['you@youremail.com', 'other@otheremail.com']
|
52
|
-
```
|
29
|
+
<a name="installation"></a>
|
30
|
+
# Installation
|
53
31
|
|
54
|
-
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
header = Smtpapi::Header.new
|
58
|
-
header.add_substitution('keep', ['secret']) # sub = {keep: ['secret']}
|
59
|
-
header.add_substitution('other', ['one', 'two']) # sub = {keep: ['secret'], other: ['one', 'two']}
|
60
|
-
```
|
61
|
-
|
62
|
-
### set_substitutions
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
header = Smtpapi::Header.new
|
66
|
-
header.set_substitutions({'keep' => 'secret'}) # sub = {keep: ['secret']}
|
67
|
-
```
|
68
|
-
|
69
|
-
### add_unique_arg
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
header = Smtpapi::Header.new
|
73
|
-
header.add_unique_arg('cat', 'dogs')
|
74
|
-
```
|
32
|
+
## Prerequisites
|
75
33
|
|
76
|
-
|
34
|
+
- Ruby version 2.2
|
35
|
+
- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=smtpapi-ruby)
|
77
36
|
|
78
|
-
|
79
|
-
header = Smtpapi::Header.new
|
80
|
-
header.set_unique_args({'cow' => 'chicken'})
|
81
|
-
header.set_unique_args({'dad' => 'proud'})
|
82
|
-
```
|
37
|
+
## Install Package
|
83
38
|
|
84
|
-
|
39
|
+
Add this line to your application's Gemfile:
|
85
40
|
|
86
|
-
```
|
87
|
-
|
88
|
-
header.add_category('tactics') # category = ['tactics']
|
89
|
-
header.add_category('advanced') # category = ['tactics', 'advanced']
|
41
|
+
```bash
|
42
|
+
gem 'smtpapi'
|
90
43
|
```
|
91
44
|
|
92
|
-
|
45
|
+
And then execute:
|
93
46
|
|
94
|
-
```
|
95
|
-
|
96
|
-
header.set_categories(['tactics', 'advanced']) # category = ['tactics', 'advanced']
|
47
|
+
```bash
|
48
|
+
bundle
|
97
49
|
```
|
98
50
|
|
99
|
-
|
51
|
+
Or install it yourself as:
|
100
52
|
|
101
|
-
```
|
102
|
-
|
103
|
-
header.add_section('-charge-', 'This ship is useless.')
|
104
|
-
header.add_section('-bomber-', 'Only for sad vikings.')
|
53
|
+
```bash
|
54
|
+
gem install smtpapi
|
105
55
|
```
|
106
56
|
|
107
|
-
|
57
|
+
## Setup Environment Variables
|
108
58
|
|
109
|
-
|
110
|
-
header = Smtpapi::Header.new
|
111
|
-
header.set_sections({'-charge-' => 'This ship is useless.'})
|
112
|
-
```
|
59
|
+
### Environment Variable
|
113
60
|
|
114
|
-
|
61
|
+
Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
|
115
62
|
|
116
|
-
```
|
117
|
-
|
118
|
-
|
119
|
-
|
63
|
+
```bash
|
64
|
+
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
|
65
|
+
echo "sendgrid.env" >> .gitignore
|
66
|
+
source ./sendgrid.env
|
120
67
|
```
|
121
68
|
|
122
|
-
|
69
|
+
<a name="quick-start"></a>
|
70
|
+
# Quick Start
|
123
71
|
|
124
72
|
```ruby
|
125
|
-
header
|
126
|
-
|
127
|
-
|
128
|
-
'setting' => {
|
129
|
-
'enable' => 1,
|
130
|
-
"text/plain" => 'You can haz footers!'
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
header.set_filters(filter)
|
73
|
+
header = Smtpapi::Header.new
|
74
|
+
header.add_to('test@example.com')
|
75
|
+
print header.to_json
|
135
76
|
```
|
136
77
|
|
137
|
-
|
78
|
+
<a name="usage"></a>
|
79
|
+
# Usage
|
138
80
|
|
139
|
-
|
140
|
-
|
141
|
-
lt = Time.local(2014, 8, 29, 17, 56, 35)
|
142
|
-
header.set_send_at(lt)
|
143
|
-
```
|
81
|
+
- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html)
|
82
|
+
- [Example Code](https://github.com/sendgrid/smtpapi-ruby/blob/master/examples)
|
144
83
|
|
145
|
-
|
84
|
+
<a name="roadmap"></a>
|
85
|
+
# Roadmap
|
146
86
|
|
147
|
-
|
148
|
-
header = Smtpapi::Header.new
|
149
|
-
lt1 = Time.local(2014, 8, 29, 17, 56, 35)
|
150
|
-
lt2 = Time.local(2013, 12, 31, 0, 0, 0)
|
151
|
-
lt3 = Time.local(2015, 9, 1, 4, 5, 6)
|
152
|
-
header.set_send_each_at([lt1, lt2, lt3])
|
153
|
-
```
|
87
|
+
If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/smtpapi-ruby/milestones). We would love to hear your feedback.
|
154
88
|
|
155
|
-
|
89
|
+
<a name="contribute"></a>
|
90
|
+
# How to Contribute
|
156
91
|
|
157
|
-
|
92
|
+
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/smtpapi-ruby/blob/master/CONTRIBUTING.md) guide for details.
|
158
93
|
|
159
|
-
|
160
|
-
header = Smtpapi::Header.new
|
161
|
-
header.set_asm_group(2)
|
162
|
-
```
|
94
|
+
Quick links:
|
163
95
|
|
164
|
-
|
96
|
+
- [Feature Request](https://github.com/sendgrid/smtpapi-ruby/blob/master/CONTRIBUTING.md#feature_request)
|
97
|
+
- [Bug Reports](https://github.com/sendgrid/smtpapi-ruby/blob/master/CONTRIBUTING.md#submit_a_bug_report)
|
98
|
+
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/smtpapi-ruby/blob/master/CONTRIBUTING.md#cla)
|
99
|
+
- [Improvements to the Codebase](https://github.com/sendgrid/smtpapi-ruby/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
|
165
100
|
|
166
|
-
|
167
|
-
```ruby
|
168
|
-
header = Smtpapi::Header.new
|
169
|
-
header.set_ip_pool("test_pool")
|
170
|
-
```
|
171
|
-
|
172
|
-
## Contributing
|
101
|
+
## Credits
|
173
102
|
|
174
|
-
|
175
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
176
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
177
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
178
|
-
5. Create new Pull Request
|
103
|
+
This library was created by [Wataru Sato](https://github.com/awwa) and is now maintained by SendGrid.
|
179
104
|
|
180
|
-
|
105
|
+
<a name="about"></a>
|
106
|
+
# About
|
181
107
|
|
182
|
-
|
108
|
+
smtpapi-ruby is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
|
183
109
|
|
184
|
-
|
185
|
-
rake test
|
186
|
-
```
|
110
|
+
smtpapi-ruby is maintained and funded by SendGrid, Inc. The names and logos for smtpapi-ruby are trademarks of SendGrid, Inc.
|
187
111
|
|
188
|
-
|
112
|
+
<a name="license"></a>
|
113
|
+
# License
|
189
114
|
|
190
|
-
|
115
|
+
[The MIT License (MIT)](LICENSE.txt)
|
data/TROUBLESHOOTING.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com).
|
2
|
+
|
3
|
+
If you can't find a solution below, please open an [issue](https://github.com/sendgrid/smtpapi-ruby/issues).
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
* [Viewing the Request Header](#request-header)
|
7
|
+
|
8
|
+
<a name="request-header"></a>
|
9
|
+
## Viewing the Request Header
|
10
|
+
|
11
|
+
When debugging or testing, it may be useful to exampine the raw request header to compare against the [documented format](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
12
|
+
|
13
|
+
You can do this like so:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
puts header
|
17
|
+
```
|
data/examples/example.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require_relative '../lib/smtpapi'
|
2
|
+
header = Smtpapi::Header.new
|
3
|
+
|
4
|
+
## add_to
|
5
|
+
header.add_to('test1@example.com')
|
6
|
+
header.add_to('test2@example.com', 'other')
|
7
|
+
# header.add_to(['test1@example.com', 'test2@example.com'])
|
8
|
+
|
9
|
+
## set_tos
|
10
|
+
# header.set_tos(['you@youremail.com', 'other@otheremail.com'])
|
11
|
+
# to => ['you@youremail.com', 'other@otheremail.com']
|
12
|
+
|
13
|
+
## add_substitution
|
14
|
+
# sub = {keep: ['secret']}
|
15
|
+
header.add_substitution('keep', ['secret'])
|
16
|
+
# sub = {keep: ['secret'], other: ['one', 'two']}
|
17
|
+
header.add_substitution('other', %w(one two))
|
18
|
+
|
19
|
+
## set_substitutions
|
20
|
+
# header.set_substitutions({'keep' => 'secret'}) # sub = {keep: ['secret']}
|
21
|
+
|
22
|
+
## add_unique_arg
|
23
|
+
header.add_unique_arg('cat', 'dogs')
|
24
|
+
|
25
|
+
## set_unique_args
|
26
|
+
# header.set_unique_args({'cow' => 'chicken'})
|
27
|
+
# header.set_unique_args({'dad' => 'proud'})
|
28
|
+
|
29
|
+
## add_category
|
30
|
+
# category = ['tactics']
|
31
|
+
header.add_category('tactics')
|
32
|
+
# category = ['tactics', 'advanced']
|
33
|
+
header.add_category('advanced')
|
34
|
+
|
35
|
+
## set_categories
|
36
|
+
# category = ['tactics', 'advanced']
|
37
|
+
# header.set_categories(['tactics', 'advanced'])
|
38
|
+
|
39
|
+
## add_section
|
40
|
+
header.add_section('-charge-', 'This ship is useless.')
|
41
|
+
header.add_section('-bomber-', 'Only for sad vikings.')
|
42
|
+
|
43
|
+
## set_sections
|
44
|
+
# header.set_sections({'-charge-' => 'This ship is useless.'})
|
45
|
+
|
46
|
+
## add_filter
|
47
|
+
header.add_filter('footer', 'enable', 1)
|
48
|
+
header.add_filter('footer', 'text/html', '<strong>boo</strong>')
|
49
|
+
|
50
|
+
## set_filters
|
51
|
+
# filter = {
|
52
|
+
# 'footer' => {
|
53
|
+
# 'setting' => {
|
54
|
+
# 'enable' => 1,
|
55
|
+
# "text/plain" => 'You can haz footers!'
|
56
|
+
# }
|
57
|
+
# }
|
58
|
+
# }
|
59
|
+
# header.set_filters(filter)
|
60
|
+
|
61
|
+
## set_send_at
|
62
|
+
lt = Time.local(2014, 8, 29, 17, 56, 35)
|
63
|
+
header.set_send_at(lt)
|
64
|
+
|
65
|
+
## set_send_each_at
|
66
|
+
# lt1 = Time.local(2014, 8, 29, 17, 56, 35)
|
67
|
+
# lt2 = Time.local(2013, 12, 31, 0, 0, 0)
|
68
|
+
# lt3 = Time.local(2015, 9, 1, 4, 5, 6)
|
69
|
+
# header.set_send_each_at([lt1, lt2, lt3])
|
70
|
+
|
71
|
+
## asm_group_id
|
72
|
+
# This is to specify an ASM Group for the message.
|
73
|
+
# See: https://sendgrid.com/docs/User_Guide/advanced_suppression_manager.html
|
74
|
+
header.set_asm_group(2)
|
75
|
+
|
76
|
+
## set_ip_pool
|
77
|
+
# Using IP Pools with the SMTP API Header
|
78
|
+
# See: https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_pools.html)
|
79
|
+
header.set_ip_pool('test_pool')
|
80
|
+
|
81
|
+
print header.to_json
|
data/lib/smtpapi.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
2
|
require 'smtpapi/version'
|
4
3
|
require 'json'
|
@@ -116,20 +115,23 @@ module Smtpapi
|
|
116
115
|
|
117
116
|
def to_array
|
118
117
|
data = {}
|
119
|
-
data['to'] = @to
|
120
|
-
data['sub'] = @sub
|
121
|
-
data['section'] = @section
|
122
|
-
data['unique_args'] = @unique_args
|
123
|
-
data['category'] = @category
|
124
|
-
data['filters'] = @filters
|
118
|
+
data['to'] = @to unless @to.empty?
|
119
|
+
data['sub'] = @sub unless @sub.empty?
|
120
|
+
data['section'] = @section unless @section.empty?
|
121
|
+
data['unique_args'] = @unique_args unless @unique_args.empty?
|
122
|
+
data['category'] = @category unless @category.empty?
|
123
|
+
data['filters'] = @filters unless @filters.empty?
|
125
124
|
data['send_at'] = @send_at.to_i unless @send_at.nil?
|
126
125
|
data['asm_group_id'] = @asm_group_id.to_i unless @asm_group_id.nil?
|
127
126
|
data['ip_pool'] = @ip_pool unless @ip_pool.nil?
|
128
127
|
str_each_at = []
|
128
|
+
|
129
129
|
@send_each_at.each do |val|
|
130
130
|
str_each_at.push(val.to_i)
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
|
+
data['send_each_at'] = str_each_at unless str_each_at.empty?
|
134
|
+
|
133
135
|
data
|
134
136
|
end
|
135
137
|
|
@@ -143,8 +145,8 @@ module Smtpapi
|
|
143
145
|
def escape_unicode(str)
|
144
146
|
str.unpack('U*').map do |i|
|
145
147
|
if i > 65_535
|
146
|
-
"\\u#{format('%04x', ((i - 0x10000) / 0x400 + 0xD800))}"\
|
147
|
-
"\\u#{format('%04x', ((i - 0x10000) % 0x400 + 0xDC00))}"
|
148
|
+
"\\u#{format('%04x', ((i - 0x10000) / 0x400 + 0xD800))}" \
|
149
|
+
"\\u#{format('%04x', ((i - 0x10000) % 0x400 + 0xDC00))}"
|
148
150
|
elsif i > 127
|
149
151
|
"\\u#{format('%04x', i)}"
|
150
152
|
else
|
data/lib/smtpapi/version.rb
CHANGED
data/smtpapi.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'smtpapi/version'
|
5
4
|
|
@@ -18,7 +17,6 @@ Gem::Specification.new do |spec|
|
|
18
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ['lib']
|
20
19
|
|
21
|
-
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
20
|
spec.add_development_dependency 'rake'
|
23
21
|
spec.add_development_dependency('rubocop', '>=0.29.0', '<0.30.0')
|
24
22
|
spec.add_development_dependency('test-unit', '~> 3.0')
|
data/test/test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'test/unit'
|
3
2
|
require './lib/smtpapi'
|
4
3
|
|
@@ -7,7 +6,7 @@ require './lib/smtpapi'
|
|
7
6
|
#
|
8
7
|
class SmtpapiTest < Test::Unit::TestCase
|
9
8
|
def test_version
|
10
|
-
assert_equal('0.1.
|
9
|
+
assert_equal('0.1.1', Smtpapi::VERSION)
|
11
10
|
end
|
12
11
|
|
13
12
|
def test_empty
|
@@ -21,7 +20,8 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
21
20
|
header.add_to('other@otheremail.com', 'Other Name')
|
22
21
|
assert_equal(
|
23
22
|
'{"to":["you@youremail.com","Other Name <other@otheremail.com>"]}',
|
24
|
-
header.json_string
|
23
|
+
header.json_string
|
24
|
+
)
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_add_to_array
|
@@ -29,7 +29,8 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
29
29
|
header.add_to(['you@youremail.com', 'my@myemail.com'])
|
30
30
|
assert_equal(
|
31
31
|
'{"to":["you@youremail.com","my@myemail.com"]}',
|
32
|
-
header.json_string
|
32
|
+
header.json_string
|
33
|
+
)
|
33
34
|
end
|
34
35
|
|
35
36
|
def test_set_tos
|
@@ -37,7 +38,8 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
37
38
|
header.set_tos(['you@youremail.com', 'other@otheremail.com'])
|
38
39
|
assert_equal(
|
39
40
|
'{"to":["you@youremail.com","other@otheremail.com"]}',
|
40
|
-
header.json_string
|
41
|
+
header.json_string
|
42
|
+
)
|
41
43
|
end
|
42
44
|
|
43
45
|
def test_add_substitution
|
@@ -46,7 +48,8 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
46
48
|
header.add_substitution('other', %w(one two))
|
47
49
|
assert_equal(
|
48
50
|
'{"sub":{"keep":["secret"],"other":["one","two"]}}',
|
49
|
-
header.json_string
|
51
|
+
header.json_string
|
52
|
+
)
|
50
53
|
end
|
51
54
|
|
52
55
|
def test_set_substitutions
|
@@ -63,7 +66,8 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
63
66
|
'{"section":'\
|
64
67
|
'{"-charge-":"This ship is useless.",'\
|
65
68
|
'"-bomber-":"Only for sad vikings."}}',
|
66
|
-
header.json_string
|
69
|
+
header.json_string
|
70
|
+
)
|
67
71
|
end
|
68
72
|
|
69
73
|
def test_set_sections
|
@@ -175,9 +179,9 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
175
179
|
|
176
180
|
def test_send_each_at
|
177
181
|
header = Smtpapi::Header.new
|
178
|
-
localtime1 = Time.local(2014,
|
179
|
-
localtime2 = Time.local(2013, 12, 31,
|
180
|
-
localtime3 = Time.local(2015,
|
182
|
+
localtime1 = Time.local(2014, 8, 29, 17, 56, 35)
|
183
|
+
localtime2 = Time.local(2013, 12, 31, 0, 0, 0)
|
184
|
+
localtime3 = Time.local(2015, 9, 1, 4, 5, 6)
|
181
185
|
header.set_send_each_at([localtime1, localtime2, localtime3])
|
182
186
|
|
183
187
|
assert_equal(
|
@@ -201,4 +205,80 @@ class SmtpapiTest < Test::Unit::TestCase
|
|
201
205
|
|
202
206
|
assert_equal('{"ip_pool":"test_pool"}', header.json_string)
|
203
207
|
end
|
208
|
+
|
209
|
+
# def test_docker_exists
|
210
|
+
# assert(File.file?('./Dockerfile') || File.file?('./docker/Dockerfile'))
|
211
|
+
# end
|
212
|
+
|
213
|
+
# def test_docker_compose_exists
|
214
|
+
# assert(
|
215
|
+
# File.file?('./docker-compose.yml') ||
|
216
|
+
# File.file?('./docker/docker-compose.yml')
|
217
|
+
# )
|
218
|
+
# end
|
219
|
+
|
220
|
+
def test_env_sample_exists
|
221
|
+
assert(File.file?('./.env_sample'))
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_gitignore_exists
|
225
|
+
assert(File.file?('./.gitignore'))
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_travis_exists
|
229
|
+
assert(File.file?('./.travis.yml'))
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_codeclimate_exists
|
233
|
+
assert(File.file?('./.codeclimate.yml'))
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_changelog_exists
|
237
|
+
assert(File.file?('./CHANGELOG.md'))
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_code_of_conduct_exists
|
241
|
+
assert(File.file?('./CODE_OF_CONDUCT.md'))
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_contributing_exists
|
245
|
+
assert(File.file?('./CONTRIBUTING.md'))
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_issue_template_exists
|
249
|
+
assert(File.file?('./.github/ISSUE_TEMPLATE'))
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_license_exists
|
253
|
+
assert(File.file?('./LICENSE.md') || File.file?('./LICENSE.txt'))
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_pull_request_template_exists
|
257
|
+
assert(File.file?('./.github/PULL_REQUEST_TEMPLATE'))
|
258
|
+
end
|
259
|
+
|
260
|
+
def test_readme_exists
|
261
|
+
assert(File.file?('./README.md'))
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_troubleshooting_exists
|
265
|
+
assert(File.file?('./TROUBLESHOOTING.md'))
|
266
|
+
end
|
267
|
+
|
268
|
+
# def test_usage_exists
|
269
|
+
# assert(File.file?('./USAGE.md'))
|
270
|
+
# end
|
271
|
+
|
272
|
+
# def test_use_cases_exists
|
273
|
+
# assert(File.file?('./USE_CASES.md'))
|
274
|
+
# end
|
275
|
+
|
276
|
+
def test_license_date_is_updated
|
277
|
+
license_end_year = IO.read('LICENSE.txt').match(
|
278
|
+
/Copyright \(c\) \d{4}-(\d{4}) Twilio SendGrid/
|
279
|
+
)[1]
|
280
|
+
current_year = Time.new.year
|
281
|
+
|
282
|
+
assert_equal(current_year, license_end_year.to_i)
|
283
|
+
end
|
204
284
|
end
|
data/use_cases/README.md
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smtpapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wataru Sato
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.5'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1.5'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: rake
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,18 +67,28 @@ executables: []
|
|
81
67
|
extensions: []
|
82
68
|
extra_rdoc_files: []
|
83
69
|
files:
|
70
|
+
- ".codeclimate.yml"
|
71
|
+
- ".env_sample"
|
72
|
+
- ".github/ISSUE_TEMPLATE"
|
73
|
+
- ".github/PULL_REQUEST_TEMPLATE"
|
84
74
|
- ".gitignore"
|
85
75
|
- ".rubocop.yml"
|
86
76
|
- ".travis.yml"
|
87
77
|
- CHANGELOG.md
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- CONTRIBUTING.md
|
88
80
|
- Gemfile
|
89
81
|
- LICENSE.txt
|
82
|
+
- Makefile
|
90
83
|
- README.md
|
91
84
|
- Rakefile
|
85
|
+
- TROUBLESHOOTING.md
|
86
|
+
- examples/example.rb
|
92
87
|
- lib/smtpapi.rb
|
93
88
|
- lib/smtpapi/version.rb
|
94
89
|
- smtpapi.gemspec
|
95
90
|
- test/test.rb
|
91
|
+
- use_cases/README.md
|
96
92
|
homepage: https://github.com/sendgrid/smtpapi-ruby
|
97
93
|
licenses:
|
98
94
|
- MIT
|
@@ -112,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
108
|
- !ruby/object:Gem::Version
|
113
109
|
version: '0'
|
114
110
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.4.5
|
111
|
+
rubygems_version: 3.0.6
|
117
112
|
signing_key:
|
118
113
|
specification_version: 4
|
119
114
|
summary: Smtpapi library for SendGrid.
|