Class: UniOne::Mail
- Inherits:
-
Object
- Object
- UniOne::Mail
- Defined in:
- lib/unione/helpers/mail/mail.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#body ⇒ Object
Returns the value of attribute body.
-
#from ⇒ Object
Returns the value of attribute from.
-
#global_substitutions ⇒ Object
Returns the value of attribute global_substitutions.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#inline_attachments ⇒ Object
Returns the value of attribute inline_attachments.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#options ⇒ Object
Returns the value of attribute options.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
-
#reply_to ⇒ Object
Returns the value of attribute reply_to.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#template ⇒ Object
Returns the value of attribute template.
-
#track ⇒ Object
Returns the value of attribute track.
Instance Method Summary collapse
-
#initialize ⇒ Mail
constructor
A new instance of Mail.
- #to_json ⇒ Object
Constructor Details
#initialize ⇒ Mail
Returns a new instance of Mail.
7 8 9 10 11 12 13 14 15 |
# File 'lib/unione/helpers/mail/mail.rb', line 7 def initialize @template = {} @from = {} @track = {} @global_substitutions = {} @recipients = [] = [] = [] end |
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def end |
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def body @body end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def from @from end |
#global_substitutions ⇒ Object
Returns the value of attribute global_substitutions.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def global_substitutions @global_substitutions end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def headers @headers end |
#inline_attachments ⇒ Object
Returns the value of attribute inline_attachments.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def end |
#metadata ⇒ Object
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def end |
#recipients ⇒ Object
Returns the value of attribute recipients.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def recipients @recipients end |
#reply_to ⇒ Object
Returns the value of attribute reply_to.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def reply_to @reply_to end |
#subject ⇒ Object
Returns the value of attribute subject.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def subject @subject end |
#template ⇒ Object
Returns the value of attribute template.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def template @template end |
#track ⇒ Object
Returns the value of attribute track.
3 4 5 |
# File 'lib/unione/helpers/mail/mail.rb', line 3 def track @track end |
Instance Method Details
#to_json ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/unione/helpers/mail/mail.rb', line 17 def to_json(*) { message: { global_substitutions: self.global_substitutions, body: self.body, subject: self.subject, reply_to: self.reply_to, recipients: self.recipients, metadata: self., headers: self.headers, attachments: self., inline_attachments: self., options: self. }.merge(self.template) .merge(self.from) .merge(self.track) .delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}} } end |