Class: Paubox::MailToMessage
- Inherits:
-
Object
- Object
- Paubox::MailToMessage
- Includes:
- FormatHelper
- Defined in:
- lib/paubox/mail_to_message.rb
Overview
The MailToMessage class takes a Ruby Mail object and attempts to parse it into a Hash formatted for the JSON payload of HTTP api request.
Constant Summary
Constants included from FormatHelper
Instance Attribute Summary collapse
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
Instance Method Summary collapse
-
#initialize(mail, args = {}) ⇒ MailToMessage
constructor
A new instance of MailToMessage.
- #send_message_payload ⇒ Object
Methods included from FormatHelper
#base64_encode_if_needed, #base64_encoded?, #convert_keys_to_json_version, #ruby_to_json_key, #squish, #string_or_array_to_array
Constructor Details
#initialize(mail, args = {}) ⇒ MailToMessage
Returns a new instance of MailToMessage.
11 12 13 14 15 |
# File 'lib/paubox/mail_to_message.rb', line 11 def initialize(mail, args = {}) @mail = mail @allow_non_tls = args.fetch(:allow_non_tls, false) @force_secure_notification = args.fetch(:force_secure_notification, nil) end |
Instance Attribute Details
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
8 9 10 |
# File 'lib/paubox/mail_to_message.rb', line 8 def mail @mail end |
Instance Method Details
#send_message_payload ⇒ Object
17 18 19 |
# File 'lib/paubox/mail_to_message.rb', line 17 def { data: { message: convert_keys_to_json_version(build_parts) } }.to_json end |