t-mailer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/t/mailer.rb +1 -1
- data/lib/t/mailer/api/aws_ses.rb +2 -2
- data/lib/t/mailer/api/spark_post.rb +2 -2
- data/lib/t/mailer/delivery_method.rb +1 -1
- data/lib/t/mailer/delivery_system/aws_ses.rb +1 -1
- data/lib/t/mailer/delivery_system/spark_post.rb +1 -1
- data/lib/t/mailer/helper.rb +7 -7
- data/lib/t/mailer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94d951afcaf5e7063342df78a3ffa4518db83868fbd030ee836d614a55e10a8c
|
4
|
+
data.tar.gz: 68c9c354b3f07563429427da04692e9adb59350976ff00582a069454a8e54525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec15a39899a7a3d6a73858e7c14eda9e9a5f6794528215b62849ed51dcab8152fc0b2719fbb3be217ce2f8371d3f2a31e6bd8efbe4b4ac7863766a6103c3d06
|
7
|
+
data.tar.gz: 0f3c6beba852aa5962d930a349ba9c8a48cab888ff5020dd4839e877e6a18e18e594300e9603905eae2ab47cff670df307089ccfae0cb2ea97664eb15d975000
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# T-mailer
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.com/100Starlings/t-mailer.svg?branch=master)](https://travis-ci.com/100Starlings/t-mailer)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/t-mailer.svg)](https://badge.fury.io/rb/t-mailer)
|
4
5
|
|
5
6
|
**T-mailer** helps you to use **ActionMailer** with different providers' **API**. It sends emails using **raw/rfc822** message type. Which means it converts the mail object to string and sends it completely. There is no any intermediate changes, so what you send is what you get. It supports more APIs (see below) and you can decide which one would like to use. It allows you to send different emails with different APIs. It can help to move between providers, load balacing or cost management.
|
6
7
|
|
data/lib/t/mailer.rb
CHANGED
@@ -66,7 +66,7 @@ module T
|
|
66
66
|
# credentials automatically (no need config/initializers/t-mailer.rb file).
|
67
67
|
# If environment variable does not exist then it will leave it blank.
|
68
68
|
#
|
69
|
-
# @param [String] credential/API key variable name
|
69
|
+
# @param [String] variable_name the credential/API key variable name
|
70
70
|
def set_credential(variable_name)
|
71
71
|
if ENV[variable_name].nil?
|
72
72
|
public_send("#{variable_name.downcase}=", "")
|
data/lib/t/mailer/api/aws_ses.rb
CHANGED
@@ -11,7 +11,7 @@ module T
|
|
11
11
|
# Set settings and check if the required credentials are exist. If the
|
12
12
|
# credentials are missing then it will raise error.
|
13
13
|
#
|
14
|
-
# @param [Hash] with the credentials
|
14
|
+
# @param [Hash] options with the credentials
|
15
15
|
def initialize(options)
|
16
16
|
@settings = options
|
17
17
|
|
@@ -89,7 +89,7 @@ module T
|
|
89
89
|
#
|
90
90
|
# @overload send_raw_email(params = {})
|
91
91
|
#
|
92
|
-
# @param [Hash] with the details of the email
|
92
|
+
# @param [Hash] params with the details of the email
|
93
93
|
#
|
94
94
|
# @return [Object]
|
95
95
|
# #<struct Aws::SES::Types::SendRawEmailResponse message_id="an_id">
|
@@ -12,7 +12,7 @@ module T
|
|
12
12
|
# Set settings and check if the required credential exists. If the
|
13
13
|
# credential is missing then it will raise error.
|
14
14
|
#
|
15
|
-
# @param [Hash] with the credentials
|
15
|
+
# @param [Hash] options with the credentials
|
16
16
|
def initialize(options)
|
17
17
|
@settings = options
|
18
18
|
|
@@ -63,7 +63,7 @@ module T
|
|
63
63
|
# }
|
64
64
|
# }
|
65
65
|
#
|
66
|
-
# @param [Hash] with the details of the email
|
66
|
+
# @param [Hash] attrs with the details of the email
|
67
67
|
#
|
68
68
|
# @return [Hash] with the server response
|
69
69
|
def create(attrs)
|
@@ -10,7 +10,7 @@ module T
|
|
10
10
|
# with the default. If credentials has been added then it will override
|
11
11
|
# the default credentials.
|
12
12
|
#
|
13
|
-
# @param [Hash] with the credentials
|
13
|
+
# @param [Hash] options with the credentials
|
14
14
|
def initialize(options = {})
|
15
15
|
@settings = {
|
16
16
|
aws_access_key_id: T::Mailer.configuration.aws_access_key_id,
|
@@ -9,7 +9,7 @@ module T
|
|
9
9
|
# Set settings with the required credentials for the API, but allow to
|
10
10
|
# call this delivery system without it.
|
11
11
|
#
|
12
|
-
# @param [Hash] with the credentials
|
12
|
+
# @param [Hash] options with the credentials
|
13
13
|
def initialize(options = {})
|
14
14
|
@settings = options
|
15
15
|
end
|
@@ -9,7 +9,7 @@ module T
|
|
9
9
|
# Set settings with the required credentials for the API, but allow to
|
10
10
|
# call this delivery system without it.
|
11
11
|
#
|
12
|
-
# @param [Hash] with the credentials
|
12
|
+
# @param [Hash] options with the credentials
|
13
13
|
def initialize(options = {})
|
14
14
|
@settings = options
|
15
15
|
end
|
data/lib/t/mailer/helper.rb
CHANGED
@@ -3,7 +3,7 @@ module T
|
|
3
3
|
module Helper
|
4
4
|
# Check gem is installed or not. If not it will raise error.
|
5
5
|
#
|
6
|
-
# @param [String]
|
6
|
+
# @param [String] klass the API's class name
|
7
7
|
def check_api_defined(klass)
|
8
8
|
unless T::Mailer.const_defined?(klass)
|
9
9
|
fail Error::DeliverySystemNotDefined,
|
@@ -14,7 +14,7 @@ module T
|
|
14
14
|
# Check API credentials were given.
|
15
15
|
# If one is missing or empty it will raise error.
|
16
16
|
#
|
17
|
-
# @param [List] comma separated values/symbols
|
17
|
+
# @param [List] required_values a comma separated values/symbols
|
18
18
|
def check_settings(*required_values)
|
19
19
|
has_all_settings =
|
20
20
|
settings.values_at(*required_values).all? do |setting|
|
@@ -29,8 +29,8 @@ module T
|
|
29
29
|
|
30
30
|
# Check the version of a gem.
|
31
31
|
#
|
32
|
-
# @param [String] the name of the gem
|
33
|
-
# @param [String] the satisfied version of the gem
|
32
|
+
# @param [String] gem_name the name of the gem
|
33
|
+
# @param [String] version the satisfied version of the gem
|
34
34
|
#
|
35
35
|
# @return [Boolean] true/false
|
36
36
|
def check_version_of(gem_name, version)
|
@@ -55,7 +55,7 @@ module T
|
|
55
55
|
|
56
56
|
# Gets uparsed value of the mail message fields.
|
57
57
|
#
|
58
|
-
# @param [Mail::Field]
|
58
|
+
# @param [Mail::Field] message_field
|
59
59
|
#
|
60
60
|
# @return [String/Hash] with the field unparsed value
|
61
61
|
def get_value_from(message_field)
|
@@ -66,9 +66,9 @@ module T
|
|
66
66
|
|
67
67
|
# Which gem using an API class.
|
68
68
|
#
|
69
|
-
# @param [String] class name
|
69
|
+
# @param [String] klass the class name
|
70
70
|
#
|
71
|
-
# @
|
71
|
+
# @return [String] the gem name which should use
|
72
72
|
def using_gem(klass)
|
73
73
|
case klass
|
74
74
|
when "Api::AwsSes"
|
data/lib/t/mailer/version.rb
CHANGED