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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07fe69e5ab66cccb868e7a44fc2b837a1dd1a83e
4
- data.tar.gz: 3db90e473da62d9c62a75d795f24e267262287f6
3
+ metadata.gz: c92fe94a6b8869ebbcffb8a75ba7312effd4e294
4
+ data.tar.gz: bc1946a8076e6ec1a9ca26b6f2c844d3b1904142
5
5
  SHA512:
6
- metadata.gz: c96ce4e7bec0ba48307d773135eb8e9d3bb135eb8aef08c68ef1e0ea70a246b5e6e6390407293f8087f0de621841498dffc9bf520789371c1d89d183a047145b
7
- data.tar.gz: cc0c143320d18d91c4e90369ff533afbf4e3915879cf0c1189799946c81ac99bca5ce3fa181efb90cb1ca1611e36481d985935a44ed66284df52b99658e535e9
6
+ metadata.gz: 1568d47de5fc926606c9a61e3cf85ef86792787a3636c16fbc607e609d042312d523c77d7f0d9f65f55df37db61763c7c86668e56b170e1aa67429dce4a629cb
7
+ data.tar.gz: 9bee55b93b66412871f9454743bf40ae3bf3c2a11ce2c6351c449bcafb959ddaee893539f72bd922b3fd791c23f494bf389ad7b66a09e70884e7509f8bc05e46
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- email-delivery (0.1.2)
4
+ email-delivery (0.1.3)
5
5
  rest-client (~> 2.0.2)
6
6
 
7
7
  GEM
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 into a gem. Put your Ruby code in the file `lib/email/delivery`. To experiment with that code, run `bin/console` for an interactive prompt.
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 between two different e-mail sevice providers and quickly falls over to a working provider without affecting the users.
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':['you_1@test.com, you_2@test.com'],
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 || %w(1 2 3 4 5)
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 ["you@test.com", "you_1@test.com"]
82
- cc "you_2@test.com"
83
- bcc "you_3@test.com"
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 "BlahBlah"
99
- bcc "YoYo"
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": "to/cc/bcc email-ids are not valid. Please provide at least one valid to/cc/bcc email address.",
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'
@@ -34,7 +34,7 @@ module Email
34
34
  end
35
35
 
36
36
  unless bcc.nil?
37
- personalizations_hash.merge!({ "bcc" => recepient_list(bcc) })
37
+ personalizations_hash.merge!({ "bcc" => recepient_list(cc) })
38
38
  end
39
39
 
40
40
  [
@@ -1,5 +1,5 @@
1
1
  module Email
2
2
  module Delivery
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
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.2
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-14 00:00:00.000000000 Z
11
+ date: 2017-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client