email_api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +148 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +154 -0
- data/LICENSE.txt +21 -0
- data/README.md +195 -0
- data/Rakefile +7 -0
- data/bin/setup +6 -0
- data/config.ru +4 -0
- data/email_api.gemspec +44 -0
- data/lib/email_api.rb +47 -0
- data/lib/email_api/api/api_parser.rb +100 -0
- data/lib/email_api/email/client/email_client.rb +69 -0
- data/lib/email_api/email/client/mailgun_client.rb +123 -0
- data/lib/email_api/email/client/sendgrid_client.rb +115 -0
- data/lib/email_api/email/data/client_response.rb +40 -0
- data/lib/email_api/email/data/email_address.rb +21 -0
- data/lib/email_api/email/data/email_object.rb +43 -0
- metadata +274 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 02c4d9d041900d7366dd821238fc996e60c533c0
|
4
|
+
data.tar.gz: '05851a091314a32d77f323b6129539872522bda8'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d5fff2b1cbf27d1f923701468dcc1176d560362befd5d889e120e15992d2a8e20ceafafb65a508574b8ccd34c54e957a1be3c0cbb52f8ab6a10dbaefa688ece5
|
7
|
+
data.tar.gz: 589fc56e84bc733eec479fb483944bc56328bf4a271d4a2c45fac262069736990675ec1acedcc1e49d345dad85921c61a9c73d93ca9ca5394ef3b29cb368a824
|
data/.gitignore
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
## Coverage Testing ##
|
2
|
+
coverage
|
3
|
+
|
4
|
+
|
5
|
+
## Covers Ruby ##
|
6
|
+
# https://github.com/github/gitignore/blob/master/Ruby.gitignore
|
7
|
+
|
8
|
+
*.gem
|
9
|
+
*.rbc
|
10
|
+
/.config
|
11
|
+
/coverage/
|
12
|
+
/InstalledFiles
|
13
|
+
/pkg/
|
14
|
+
/spec/reports/
|
15
|
+
/spec/examples.txt
|
16
|
+
/tests/tmp/
|
17
|
+
/tests/version_tmp/
|
18
|
+
/tmp/
|
19
|
+
|
20
|
+
# Used by dotenv library to load environment variables.
|
21
|
+
.env
|
22
|
+
|
23
|
+
## Specific to RubyMotion:
|
24
|
+
.dat*
|
25
|
+
.repl_history
|
26
|
+
build/
|
27
|
+
*.bridgesupport
|
28
|
+
build-iPhoneOS/
|
29
|
+
build-iPhoneSimulator/
|
30
|
+
|
31
|
+
## Specific to RubyMotion (use of CocoaPods):
|
32
|
+
#
|
33
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
34
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
35
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
36
|
+
#
|
37
|
+
# vendor/Pods/
|
38
|
+
|
39
|
+
## Documentation cache and generated files:
|
40
|
+
/.yardoc/
|
41
|
+
/_yardoc/
|
42
|
+
/doc/
|
43
|
+
/rdoc/
|
44
|
+
|
45
|
+
## Environment normalization:
|
46
|
+
/.bundle/
|
47
|
+
/vendor/bundle
|
48
|
+
/lib/bundler/man/
|
49
|
+
|
50
|
+
# for a library or gem, you might want to ignore these files since the code is
|
51
|
+
# intended to run in multiple environments; otherwise, check them in:
|
52
|
+
# Gemfile.lock
|
53
|
+
# .ruby-version
|
54
|
+
# .ruby-gemset
|
55
|
+
|
56
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
57
|
+
.rvmrc
|
58
|
+
|
59
|
+
# rspec failure tracking
|
60
|
+
.rspec_status
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
## Covers MacOS ##
|
65
|
+
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
66
|
+
|
67
|
+
# General
|
68
|
+
.DS_Store
|
69
|
+
.AppleDouble
|
70
|
+
.LSOverride
|
71
|
+
|
72
|
+
# Icon must end with two \r
|
73
|
+
Icon
|
74
|
+
|
75
|
+
# Thumbnails
|
76
|
+
._*
|
77
|
+
|
78
|
+
# Files that might appear in the root of a volume
|
79
|
+
.DocumentRevisions-V100
|
80
|
+
.fseventsd
|
81
|
+
.Spotlight-V100
|
82
|
+
.TemporaryItems
|
83
|
+
.Trashes
|
84
|
+
.VolumeIcon.icns
|
85
|
+
.com.apple.timemachine.donotpresent
|
86
|
+
|
87
|
+
# Directories potentially created on remote AFP share
|
88
|
+
.AppleDB
|
89
|
+
.AppleDesktop
|
90
|
+
Network Trash Folder
|
91
|
+
Temporary Items
|
92
|
+
.apdisk
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
## Covers JetBrains IDEs ##
|
97
|
+
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
|
98
|
+
|
99
|
+
*.iml
|
100
|
+
.idea/
|
101
|
+
|
102
|
+
# User-specific stuff:
|
103
|
+
.idea/**/workspace.xml
|
104
|
+
.idea/**/tasks.xml
|
105
|
+
.idea/dictionaries
|
106
|
+
|
107
|
+
# Sensitive or high-churn files:
|
108
|
+
.idea/**/dataSources/
|
109
|
+
.idea/**/dataSources.ids
|
110
|
+
.idea/**/dataSources.xml
|
111
|
+
.idea/**/dataSources.local.xml
|
112
|
+
.idea/**/sqlDataSources.xml
|
113
|
+
.idea/**/dynamic.xml
|
114
|
+
.idea/**/uiDesigner.xml
|
115
|
+
|
116
|
+
# Gradle:
|
117
|
+
.idea/**/gradle.xml
|
118
|
+
.idea/**/libraries
|
119
|
+
|
120
|
+
# CMake
|
121
|
+
cmake-build-debug/
|
122
|
+
|
123
|
+
# Mongo Explorer plugin:
|
124
|
+
.idea/**/mongoSettings.xml
|
125
|
+
|
126
|
+
## File-based project format:
|
127
|
+
*.iws
|
128
|
+
|
129
|
+
## Plugin-specific files:
|
130
|
+
|
131
|
+
# IntelliJ
|
132
|
+
out/
|
133
|
+
|
134
|
+
# mpeltonen/sbt-idea plugin
|
135
|
+
.idea_modules/
|
136
|
+
|
137
|
+
# JIRA plugin
|
138
|
+
atlassian-ide-plugin.xml
|
139
|
+
|
140
|
+
# Cursive Clojure plugin
|
141
|
+
.idea/replstate.xml
|
142
|
+
|
143
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
144
|
+
com_crashlytics_export_strings.xml
|
145
|
+
crashlytics.properties
|
146
|
+
crashlytics-build.properties
|
147
|
+
fabric.properties
|
148
|
+
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
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, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
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
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
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
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
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.
|
39
|
+
|
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.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
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 vasili@moisiadis.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.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
email_api (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionpack (5.1.5)
|
10
|
+
actionview (= 5.1.5)
|
11
|
+
activesupport (= 5.1.5)
|
12
|
+
rack (~> 2.0)
|
13
|
+
rack-test (>= 0.6.3)
|
14
|
+
rails-dom-testing (~> 2.0)
|
15
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
+
actionview (5.1.5)
|
17
|
+
activesupport (= 5.1.5)
|
18
|
+
builder (~> 3.1)
|
19
|
+
erubi (~> 1.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
+
activesupport (5.1.5)
|
23
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
+
i18n (~> 0.7)
|
25
|
+
minitest (~> 5.1)
|
26
|
+
tzinfo (~> 1.1)
|
27
|
+
ansi (1.5.0)
|
28
|
+
builder (3.2.3)
|
29
|
+
concurrent-ruby (1.0.5)
|
30
|
+
crass (1.0.3)
|
31
|
+
daemons (1.2.6)
|
32
|
+
diff-lcs (1.3)
|
33
|
+
docile (1.3.0)
|
34
|
+
domain_name (0.5.20170404)
|
35
|
+
unf (>= 0.0.5, < 1.0.0)
|
36
|
+
dotenv (2.2.1)
|
37
|
+
erubi (1.7.1)
|
38
|
+
eventmachine (1.2.5)
|
39
|
+
http-cookie (1.0.3)
|
40
|
+
domain_name (~> 0.5)
|
41
|
+
i18n (0.9.5)
|
42
|
+
concurrent-ruby (~> 1.0)
|
43
|
+
json (2.1.0)
|
44
|
+
loofah (2.2.1)
|
45
|
+
crass (~> 1.0.2)
|
46
|
+
nokogiri (>= 1.5.9)
|
47
|
+
metaclass (0.0.4)
|
48
|
+
method_source (0.9.0)
|
49
|
+
mime-types (3.1)
|
50
|
+
mime-types-data (~> 3.2015)
|
51
|
+
mime-types-data (3.2016.0521)
|
52
|
+
mini_portile2 (2.3.0)
|
53
|
+
minitest (5.11.3)
|
54
|
+
minitest-reporters (1.1.19)
|
55
|
+
ansi
|
56
|
+
builder
|
57
|
+
minitest (>= 5.0)
|
58
|
+
ruby-progressbar
|
59
|
+
mocha (1.4.0)
|
60
|
+
metaclass (~> 0.0.1)
|
61
|
+
mustermann (1.0.2)
|
62
|
+
netrc (0.11.0)
|
63
|
+
nokogiri (1.8.2)
|
64
|
+
mini_portile2 (~> 2.3.0)
|
65
|
+
puma (3.11.3)
|
66
|
+
rack (2.0.4)
|
67
|
+
rack-protection (2.0.1)
|
68
|
+
rack
|
69
|
+
rack-test (0.8.3)
|
70
|
+
rack (>= 1.0, < 3)
|
71
|
+
rails-dom-testing (2.0.3)
|
72
|
+
activesupport (>= 4.2.0)
|
73
|
+
nokogiri (>= 1.6)
|
74
|
+
rails-html-sanitizer (1.0.3)
|
75
|
+
loofah (~> 2.0)
|
76
|
+
railties (5.1.5)
|
77
|
+
actionpack (= 5.1.5)
|
78
|
+
activesupport (= 5.1.5)
|
79
|
+
method_source
|
80
|
+
rake (>= 0.8.7)
|
81
|
+
thor (>= 0.18.1, < 2.0)
|
82
|
+
rake (10.5.0)
|
83
|
+
rest-client (2.0.2)
|
84
|
+
http-cookie (>= 1.0.2, < 2.0)
|
85
|
+
mime-types (>= 1.16, < 4.0)
|
86
|
+
netrc (~> 0.8)
|
87
|
+
rspec (3.7.0)
|
88
|
+
rspec-core (~> 3.7.0)
|
89
|
+
rspec-expectations (~> 3.7.0)
|
90
|
+
rspec-mocks (~> 3.7.0)
|
91
|
+
rspec-core (3.7.1)
|
92
|
+
rspec-support (~> 3.7.0)
|
93
|
+
rspec-expectations (3.7.0)
|
94
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
95
|
+
rspec-support (~> 3.7.0)
|
96
|
+
rspec-mocks (3.7.0)
|
97
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
98
|
+
rspec-support (~> 3.7.0)
|
99
|
+
rspec-rails (3.7.2)
|
100
|
+
actionpack (>= 3.0)
|
101
|
+
activesupport (>= 3.0)
|
102
|
+
railties (>= 3.0)
|
103
|
+
rspec-core (~> 3.7.0)
|
104
|
+
rspec-expectations (~> 3.7.0)
|
105
|
+
rspec-mocks (~> 3.7.0)
|
106
|
+
rspec-support (~> 3.7.0)
|
107
|
+
rspec-support (3.7.1)
|
108
|
+
ruby-progressbar (1.9.0)
|
109
|
+
simplecov (0.16.1)
|
110
|
+
docile (~> 1.1)
|
111
|
+
json (>= 1.8, < 3)
|
112
|
+
simplecov-html (~> 0.10.0)
|
113
|
+
simplecov-html (0.10.2)
|
114
|
+
sinatra (2.0.1)
|
115
|
+
mustermann (~> 1.0)
|
116
|
+
rack (~> 2.0)
|
117
|
+
rack-protection (= 2.0.1)
|
118
|
+
tilt (~> 2.0)
|
119
|
+
thin (1.2.11)
|
120
|
+
daemons (>= 1.0.9)
|
121
|
+
eventmachine (>= 0.12.6)
|
122
|
+
rack (>= 1.0.0)
|
123
|
+
thor (0.20.0)
|
124
|
+
thread_safe (0.3.6)
|
125
|
+
tilt (2.0.8)
|
126
|
+
tzinfo (1.2.5)
|
127
|
+
thread_safe (~> 0.1)
|
128
|
+
unf (0.1.4)
|
129
|
+
unf_ext
|
130
|
+
unf_ext (0.0.7.5)
|
131
|
+
|
132
|
+
PLATFORMS
|
133
|
+
ruby
|
134
|
+
|
135
|
+
DEPENDENCIES
|
136
|
+
bundler (~> 1.16)
|
137
|
+
dotenv (~> 2.2.1)
|
138
|
+
email_api!
|
139
|
+
json (~> 2.1.0)
|
140
|
+
minitest (~> 5.11.3)
|
141
|
+
minitest-reporters (~> 1.1.19)
|
142
|
+
mocha (~> 1.4.0)
|
143
|
+
puma (~> 3.11.3)
|
144
|
+
rack-test (~> 0.8.3)
|
145
|
+
rake (~> 10.0)
|
146
|
+
rest-client (~> 2.0.2)
|
147
|
+
rspec (~> 3.0)
|
148
|
+
rspec-rails (~> 3.7.2)
|
149
|
+
simplecov (~> 0.16.1)
|
150
|
+
sinatra (~> 2.0.1)
|
151
|
+
thin (~> 1.2.5)
|
152
|
+
|
153
|
+
BUNDLED WITH
|
154
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Vasili Moisiadis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
# Email API
|
2
|
+
|
3
|
+
This Email API allows you to send plain-text only emails to clients through supported email service providers.
|
4
|
+
|
5
|
+
Supports sending to multiple email recipients, CCs, BCCs.
|
6
|
+
|
7
|
+
**Supported Providers:**
|
8
|
+
* [Mailgun](https://www.mailgun.com/)
|
9
|
+
* [Sendgrid](https://sendgrid.com/)
|
10
|
+
|
11
|
+
|
12
|
+
## Requirements
|
13
|
+
* Ruby > 1.9
|
14
|
+
* API Credentials with supported providers
|
15
|
+
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
### Ruby Gem Installation
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'email_api'
|
24
|
+
```
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
```
|
29
|
+
$ bundle
|
30
|
+
```
|
31
|
+
|
32
|
+
Or install it yourself as:
|
33
|
+
|
34
|
+
```
|
35
|
+
$ gem install email_api
|
36
|
+
```
|
37
|
+
|
38
|
+
### Environment Variables
|
39
|
+
|
40
|
+
The gem uses environment variables to hold sensitive information. Create a `.env` file on the same directory level as where you are running the program.
|
41
|
+
|
42
|
+
Inside the `.env` files, the following need to be defined:
|
43
|
+
|
44
|
+
```
|
45
|
+
export SENDGRID_API_USER='<Sendgrid account username>'
|
46
|
+
export SENDGRID_API_KEY='<Sendgrid account password'
|
47
|
+
export MAILGUN_PRIVATE_KEY='<API given by Mailgun when creating an account>'
|
48
|
+
export MAILGUN_DOMAIN='<Domain given by Mailgun when creating an account>'
|
49
|
+
export TEST_NAME='<The identity name used to perform tests with>'
|
50
|
+
export TEST_EMAIL='<The email address to perform tests with>'
|
51
|
+
```
|
52
|
+
|
53
|
+
|
54
|
+
## API Usage
|
55
|
+
|
56
|
+
All usages below denote `<hosting_server>`. This is the URL path to get to the API on whichever service you host it on.
|
57
|
+
|
58
|
+
For demonstration purposes, see this example hosting server: [Demonstration Email API](http://email-api.moisiadis.com)
|
59
|
+
|
60
|
+
### Ping
|
61
|
+
|
62
|
+
#### Accepts
|
63
|
+
* No parameters supported
|
64
|
+
|
65
|
+
#### Returns
|
66
|
+
* A hash containing the current time
|
67
|
+
|
68
|
+
#### Example Usage
|
69
|
+
```
|
70
|
+
<hosting_server>/ping
|
71
|
+
```
|
72
|
+
|
73
|
+
#### Example Response
|
74
|
+
```
|
75
|
+
{
|
76
|
+
"time": "2000-01-01T00:00:00+00:00"
|
77
|
+
}
|
78
|
+
```
|
79
|
+
|
80
|
+
|
81
|
+
### Send
|
82
|
+
|
83
|
+
#### Accepts
|
84
|
+
Note: All **Email Addresses** below are expected in the format of `YOUR NAME <your email>`
|
85
|
+
|
86
|
+
* `from`
|
87
|
+
* Usage: `YOUR NAME <your email>`
|
88
|
+
* Only one allowed email address allowed
|
89
|
+
* `to`
|
90
|
+
* Usage: `YOUR NAME <your email>[, YOUR NAME <your email>]`
|
91
|
+
* Any number of email addresses allowed
|
92
|
+
* `cc` [optional]
|
93
|
+
* Same usage and rules as `to`
|
94
|
+
* `bcc` [optional]
|
95
|
+
* Same usage and rules as `to`
|
96
|
+
* `subject`
|
97
|
+
* Plain text. Cannot be empty.
|
98
|
+
* `content`
|
99
|
+
* Plain text. Cannot be empty.
|
100
|
+
|
101
|
+
#### Returns
|
102
|
+
* A hash response containing the email as parsed and the status of the request.
|
103
|
+
|
104
|
+
#### Example Usage
|
105
|
+
```
|
106
|
+
<hosting_server>/send?from=My Name <my@email.com>&to=Your Name <your@email.com>&cc=Friend 1 <friend_1@email.com>,Friend 2 <friend_2@email.com>&subject=Hello World&content=How are you today?
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Example Response
|
110
|
+
```
|
111
|
+
{
|
112
|
+
"email":
|
113
|
+
{
|
114
|
+
"from":
|
115
|
+
{
|
116
|
+
"name": "My Name",
|
117
|
+
"email": "my@email.com"
|
118
|
+
},
|
119
|
+
"to":
|
120
|
+
[{
|
121
|
+
"name": "Your Name",
|
122
|
+
"email": "your@email.com"
|
123
|
+
}],
|
124
|
+
"cc":
|
125
|
+
[{
|
126
|
+
"name": "Friend 1",
|
127
|
+
"email": "friend_1@email.com"
|
128
|
+
},
|
129
|
+
{
|
130
|
+
"name": "Friend 2",
|
131
|
+
"email": "friend_2@email.com"
|
132
|
+
}],
|
133
|
+
"bcc": null,
|
134
|
+
"subject": "Hello World",
|
135
|
+
"content": "How are you today?"
|
136
|
+
},
|
137
|
+
"status":"200: OK"
|
138
|
+
}
|
139
|
+
```
|
140
|
+
|
141
|
+
|
142
|
+
## Development
|
143
|
+
|
144
|
+
After checking out the repo at https://github.com/VasiliMoisiadis/email-api:
|
145
|
+
|
146
|
+
### Development Installation
|
147
|
+
|
148
|
+
There are two ways to install:
|
149
|
+
|
150
|
+
For complete scripted installation:
|
151
|
+
```
|
152
|
+
$ bash bin/setup
|
153
|
+
```
|
154
|
+
|
155
|
+
For more manual installation:
|
156
|
+
```
|
157
|
+
$ bundle install
|
158
|
+
```
|
159
|
+
|
160
|
+
### Starting environment
|
161
|
+
|
162
|
+
The provided web service at [Moisiadis.com](http://email-api.moisiadis.com) uses Puma, and it is the primary supported web server.
|
163
|
+
|
164
|
+
Start using:
|
165
|
+
```
|
166
|
+
$ puma config.ru
|
167
|
+
```
|
168
|
+
|
169
|
+
By default it will start on port 9292. See instructions on Puma [Configuration](https://github.com/puma/puma#configuration) to alter this.
|
170
|
+
|
171
|
+
### Tests
|
172
|
+
|
173
|
+
Tests are performed using the [Minitest testing suite](http://docs.seattlerb.org/minitest/)
|
174
|
+
|
175
|
+
Run using:
|
176
|
+
```
|
177
|
+
$ rake test
|
178
|
+
```
|
179
|
+
|
180
|
+
Note: Can only be tested after complete installation - this includes environment variables.
|
181
|
+
|
182
|
+
|
183
|
+
## Contributing
|
184
|
+
|
185
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/VasiliMoisiadis/email-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
186
|
+
|
187
|
+
|
188
|
+
## License
|
189
|
+
|
190
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
191
|
+
|
192
|
+
|
193
|
+
## Code of Conduct
|
194
|
+
|
195
|
+
Everyone interacting in the Email API project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/VasiliMoisiadis/email-api/blob/master/CODE_OF_CONDUCT.md).
|