Class: SocketLabs::InjectionApi::Message::BulkMessage
- Inherits:
-
MessageBase
- Object
- MessageBase
- SocketLabs::InjectionApi::Message::BulkMessage
- Defined in:
- lib/socketlabs/injectionapi/message/bulk_message.rb
Instance Attribute Summary collapse
-
#global_merge_data ⇒ Object
Returns the value of attribute global_merge_data.
Attributes inherited from MessageBase
#api_template, #charset, #html_body, #mailing_id, #message_id, #plain_text_body, #subject
Instance Method Summary collapse
- #add_global_merge_data(key, value) ⇒ Object
-
#add_to_recipient(email_address, friendly_name = nil, merge_data = nil) ⇒ Object
Add an BulkRecipient to the To recipient list.
-
#initialize(arguments = nil) ⇒ BulkMessage
constructor
A new instance of BulkMessage.
- #to_json ⇒ Object
-
#to_recipient ⇒ Object
Get the To BulkRecipient list.
-
#to_recipient=(value) ⇒ Object
Set the To BulkRecipient list.
- #to_s ⇒ Object
Methods inherited from MessageBase
#add_attachment, #add_custom_header, #attachments, #attachments=, #custom_headers, #custom_headers=, #from_email_address, #from_email_address=, #reply_to_email_address, #reply_to_email_address=
Constructor Details
#initialize(arguments = nil) ⇒ BulkMessage
Returns a new instance of BulkMessage.
9 10 11 12 13 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 9 def initialize(arguments = nil) super @to_recipient = Array.new @global_merge_data = Array.new end |
Instance Attribute Details
#global_merge_data ⇒ Object
Returns the value of attribute global_merge_data.
15 16 17 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 15 def global_merge_data @global_merge_data end |
Instance Method Details
#add_global_merge_data(key, value) ⇒ Object
35 36 37 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 35 def add_global_merge_data(key, value) @global_merge_data.push(MergeData.new(key, value)) end |
#add_to_recipient(email_address, friendly_name = nil, merge_data = nil) ⇒ Object
Add an BulkRecipient to the To recipient list.
31 32 33 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 31 def add_to_recipient(email_address, friendly_name = nil, merge_data = nil) convert_bulk_recipient(@to_recipient, email_address, friendly_name, merge_data) end |
#to_json ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 44 def to_json { subject: @subject, textBody: @plain_text_body, htmlBody: @html_body, apiTemplate: @api_template, mailingId: @mailing_id, messageId: , charSet: @charset, from: @from_email_address, replyTo: @reply_to_email_address, attachments: , customHeaders: @custom_headers, to: @to_recipient, global_merge_data: @global_merge_data } end |
#to_recipient ⇒ Object
Get the To BulkRecipient list
18 19 20 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 18 def to_recipient @to_recipient end |
#to_recipient=(value) ⇒ Object
Set the To BulkRecipient list
22 23 24 25 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 22 def to_recipient=(value) @to_recipient = Array.new convert_bulk_recipient(@to_email_address, value) end |
#to_s ⇒ Object
39 40 41 42 |
# File 'lib/socketlabs/injectionapi/message/bulk_message.rb', line 39 def to_s c = @to_recipient.any? ? @to_recipient.count : 0 "Recipients: #{c}, Subject: '#{@subject}'" end |