email-delivery 0.1.2 → 0.1.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +16 -20
- data/lib/email/delivery/client.rb +7 -1
- data/lib/email/delivery/sendgrid_client.rb +1 -1
- data/lib/email/delivery/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92fe94a6b8869ebbcffb8a75ba7312effd4e294
|
4
|
+
data.tar.gz: bc1946a8076e6ec1a9ca26b6f2c844d3b1904142
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1568d47de5fc926606c9a61e3cf85ef86792787a3636c16fbc607e609d042312d523c77d7f0d9f65f55df37db61763c7c86668e56b170e1aa67429dce4a629cb
|
7
|
+
data.tar.gz: 9bee55b93b66412871f9454743bf40ae3bf3c2a11ce2c6351c449bcafb959ddaee893539f72bd922b3fd791c23f494bf389ad7b66a09e70884e7509f8bc05e46
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Email::Delivery
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
|
4
|
+
into a gem. Put your Ruby code in the file `lib/email/delivery`. To experiment with that code, run `bin/console`
|
5
|
+
for an interactive prompt.
|
4
6
|
|
5
|
-
This gem is a service (Backend) that accepts the necessary information and sends emails. It provides an abstraction
|
7
|
+
This gem is a service (Backend) that accepts the necessary information and sends emails. It provides an abstraction
|
8
|
+
between two different e-mail service providers and quickly falls over to a working provider without affecting the users.
|
9
|
+
It expects the credentials are set in the application the gem is imported.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -25,7 +29,7 @@ Or install it yourself as:
|
|
25
29
|
Input: Hash
|
26
30
|
{
|
27
31
|
'from':'me@test.com',
|
28
|
-
'to':
|
32
|
+
'to':'you_1@test.com, you_2@test.com',
|
29
33
|
'cc':'you_3@test.com',
|
30
34
|
'bcc':['you_4@test.com', 'test_bcc2@mail.com'],
|
31
35
|
'subject':'test subject',
|
@@ -34,18 +38,10 @@ Or install it yourself as:
|
|
34
38
|
|
35
39
|
Output: Hash
|
36
40
|
{
|
37
|
-
'status': 0 ||
|
41
|
+
'status': 0 || 4
|
38
42
|
'message: 'success' || 'failure'
|
39
43
|
}
|
40
44
|
|
41
|
-
Non-zero status code means it's a failure.
|
42
|
-
|
43
|
-
1 from email-id invalid
|
44
|
-
2 to/cc/bcc email-id invalid
|
45
|
-
3 subject && text both are empty
|
46
|
-
4 email send failed (working)
|
47
|
-
5 email provider configuration not complete (working)
|
48
|
-
|
49
45
|
## Usage
|
50
46
|
|
51
47
|
mail = Email::Delivery::Client.new do
|
@@ -78,9 +74,9 @@ Or install it yourself as:
|
|
78
74
|
|
79
75
|
mail = Email::Delivery::Client.new do
|
80
76
|
from 'me@test.com'
|
81
|
-
to
|
82
|
-
cc
|
83
|
-
bcc
|
77
|
+
to 'you@test.com', 'you_1@test.com'
|
78
|
+
cc 'you_2@test.com'
|
79
|
+
bcc 'you_3@test.com'
|
84
80
|
subject 'Test subject'
|
85
81
|
body 'Hey testing now...'
|
86
82
|
end
|
@@ -94,9 +90,9 @@ Or install it yourself as:
|
|
94
90
|
### send email and receive error message
|
95
91
|
mail = Email::Delivery::Client.new do
|
96
92
|
from 'me@test.com'
|
97
|
-
to
|
98
|
-
cc
|
99
|
-
bcc
|
93
|
+
to ''
|
94
|
+
cc 'BlahBlah'
|
95
|
+
bcc 'YoYo'
|
100
96
|
subject 'Test subject'
|
101
97
|
body 'Hey testing now...'
|
102
98
|
end
|
@@ -104,7 +100,7 @@ Or install it yourself as:
|
|
104
100
|
output_hash = mail.dispatch
|
105
101
|
|
106
102
|
{
|
107
|
-
"message": "
|
103
|
+
"message": "Error message returned from service provider",
|
108
104
|
"status": 2
|
109
105
|
}
|
110
106
|
|
@@ -123,7 +119,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
123
119
|
Service handles only sending emails and won't inform about dropped messages or rejected messages.
|
124
120
|
|
125
121
|
## Improvements
|
126
|
-
Message builder for the mail clients based on the input.
|
122
|
+
Message builder and formatter for the mail clients based on the input.
|
127
123
|
API Client exceptions based on api error codes with user friendly messages.
|
128
124
|
|
129
125
|
## Contributing
|
@@ -4,7 +4,13 @@
|
|
4
4
|
- initialize default mail-client(MailGun)
|
5
5
|
- call 'do' method to send the emails.
|
6
6
|
- provide fail-over mechanism
|
7
|
-
|
7
|
+
- Uses the SendGrid API error codes
|
8
|
+
200 OK Your message is valid, but it is not queued to be delivered. †
|
9
|
+
202 ACCEPTED Your message is both valid, and queued to be delivered.
|
10
|
+
400 Bad Request
|
11
|
+
- Uses the error codes from MailGun API
|
12
|
+
200 Everything worked as expected
|
13
|
+
400 Bad Request - Often missing a required parameter
|
8
14
|
=end
|
9
15
|
require 'email/delivery/mailgrun_client'
|
10
16
|
require 'email/delivery/sendgrid_client'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email-delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pranava Swaroop
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|