Class: AmazonEmail
- Inherits:
-
Object
- Object
- AmazonEmail
- Includes:
- AmazonDeliver
- Defined in:
- lib/amazon_email.rb
Instance Attribute Summary collapse
-
#aws_access_key ⇒ Object
Returns the value of attribute aws_access_key.
-
#aws_secret_key ⇒ Object
Returns the value of attribute aws_secret_key.
-
#body ⇒ Object
Returns the value of attribute body.
-
#from ⇒ Object
Returns the value of attribute from.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#template ⇒ Object
Returns the value of attribute template.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #build_email_body ⇒ Object
- #get_binding ⇒ Object
-
#initialize(options) ⇒ AmazonEmail
constructor
A new instance of AmazonEmail.
- #send ⇒ Object
- #send_to_many ⇒ Object
Methods included from AmazonDeliver
Constructor Details
#initialize(options) ⇒ AmazonEmail
Returns a new instance of AmazonEmail.
6 7 8 9 10 11 12 13 14 |
# File 'lib/amazon_email.rb', line 6 def initialize() @from = [:from] @to = [:to] @subject = [:subject] @body = [:body] @template = [:template] @aws_access_key = [:aws_access_key] || ENV['AWS_ACCESS_KEY'] @aws_secret_key = [:aws_secret_key] || ENV['AWS_SECRET_KEY'] end |
Instance Attribute Details
#aws_access_key ⇒ Object
Returns the value of attribute aws_access_key.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def aws_access_key @aws_access_key end |
#aws_secret_key ⇒ Object
Returns the value of attribute aws_secret_key.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def aws_secret_key @aws_secret_key end |
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def body @body end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def from @from end |
#subject ⇒ Object
Returns the value of attribute subject.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def subject @subject end |
#template ⇒ Object
Returns the value of attribute template.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def template @template end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/amazon_email.rb', line 4 def to @to end |
Instance Method Details
#build_email_body ⇒ Object
20 21 22 23 24 |
# File 'lib/amazon_email.rb', line 20 def build_email_body if self.template self.body = ERB.new(self.template).result(self.get_binding) end end |
#get_binding ⇒ Object
16 17 18 |
# File 'lib/amazon_email.rb', line 16 def get_binding binding end |
#send ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/amazon_email.rb', line 26 def send build_email_body if self.to.class == Array self.send_to_many else AmazonDeliver.get(self) end end |
#send_to_many ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/amazon_email.rb', line 35 def send_to_many email_list = self.to email_list.each do |e| self.to = e AmazonDeliver.get(self) end end |