class MailchimpTransactional::MessagessendMessage
the information on the message to send
Attributes
an array of supported attachments to add to the message
whether or not to automatically generate an HTML part for messages that are not given HTML
whether or not to automatically generate a text part for messages that are not given text
an optional address to receive an exact copy of each recipient's email
the sender email address
optional from name to be used
global merge variables to use for all recipients. You can override these per recipient.
optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
optional extra headers to add to the message (most headers are allowed)
the full HTML content to be sent
an array of embedded images to add to the message
whether or not this message is important, and should be delivered ahead of non-important messages
whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size
whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars
or global_merge_vars
are provided.
the merge tag language to use when evaluating merge tags, either mailchimp or handlebars
per-recipient merge variables, which override global merge variables with the same name.
whether or not to expose all recipients in to "To" header for each email
Per-recipient metadata that will override the global values specified in the metadata parameter.
a custom domain to use for the messages's return-path
a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)
the unique id of a subaccount for this message - must already exist or will fail with an error
the message subject
optional full text content to be sent
an array of recipient information.
whether or not to turn on click tracking for the message
whether or not to turn on open tracking for the message
a custom domain to use for tracking opens and clicks instead of mandrillapp.com
whether or not to strip the query string from URLs when aggregating tracked URL data
set to false to remove content logging for sensitive emails
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 136 def self.attribute_map { :'html' => :'html', :'text' => :'text', :'subject' => :'subject', :'from_email' => :'from_email', :'from_name' => :'from_name', :'to' => :'to', :'headers' => :'headers', :'important' => :'important', :'track_opens' => :'track_opens', :'track_clicks' => :'track_clicks', :'auto_text' => :'auto_text', :'auto_html' => :'auto_html', :'inline_css' => :'inline_css', :'url_strip_qs' => :'url_strip_qs', :'preserve_recipients' => :'preserve_recipients', :'view_content_link' => :'view_content_link', :'bcc_address' => :'bcc_address', :'tracking_domain' => :'tracking_domain', :'signing_domain' => :'signing_domain', :'return_path_domain' => :'return_path_domain', :'merge' => :'merge', :'merge_language' => :'merge_language', :'global_merge_vars' => :'global_merge_vars', :'merge_vars' => :'merge_vars', :'tags' => :'tags', :'subaccount' => :'subaccount', :'google_analytics_domains' => :'google_analytics_domains', :'google_analytics_campaign' => :'google_analytics_campaign', :'metadata' => :'metadata', :'recipient_metadata' => :'recipient_metadata', :'attachments' => :'attachments', :'images' => :'images' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 213 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'html') self.html = attributes[:'html'] end if attributes.has_key?(:'text') self.text = attributes[:'text'] end if attributes.has_key?(:'subject') self.subject = attributes[:'subject'] end if attributes.has_key?(:'from_email') self.from_email = attributes[:'from_email'] end if attributes.has_key?(:'from_name') self.from_name = attributes[:'from_name'] end if attributes.has_key?(:'to') if (value = attributes[:'to']).is_a?(Array) self.to = value end end if attributes.has_key?(:'headers') self.headers = attributes[:'headers'] end if attributes.has_key?(:'important') self.important = attributes[:'important'] end if attributes.has_key?(:'track_opens') self.track_opens = attributes[:'track_opens'] end if attributes.has_key?(:'track_clicks') self.track_clicks = attributes[:'track_clicks'] end if attributes.has_key?(:'auto_text') self.auto_text = attributes[:'auto_text'] end if attributes.has_key?(:'auto_html') self.auto_html = attributes[:'auto_html'] end if attributes.has_key?(:'inline_css') self.inline_css = attributes[:'inline_css'] end if attributes.has_key?(:'url_strip_qs') self.url_strip_qs = attributes[:'url_strip_qs'] end if attributes.has_key?(:'preserve_recipients') self.preserve_recipients = attributes[:'preserve_recipients'] end if attributes.has_key?(:'view_content_link') self.view_content_link = attributes[:'view_content_link'] end if attributes.has_key?(:'bcc_address') self.bcc_address = attributes[:'bcc_address'] end if attributes.has_key?(:'tracking_domain') self.tracking_domain = attributes[:'tracking_domain'] end if attributes.has_key?(:'signing_domain') self.signing_domain = attributes[:'signing_domain'] end if attributes.has_key?(:'return_path_domain') self.return_path_domain = attributes[:'return_path_domain'] end if attributes.has_key?(:'merge') self.merge = attributes[:'merge'] end if attributes.has_key?(:'merge_language') self.merge_language = attributes[:'merge_language'] end if attributes.has_key?(:'global_merge_vars') if (value = attributes[:'global_merge_vars']).is_a?(Array) self.global_merge_vars = value end end if attributes.has_key?(:'merge_vars') if (value = attributes[:'merge_vars']).is_a?(Array) self.merge_vars = value end end if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.has_key?(:'subaccount') self.subaccount = attributes[:'subaccount'] end if attributes.has_key?(:'google_analytics_domains') if (value = attributes[:'google_analytics_domains']).is_a?(Array) self.google_analytics_domains = value end end if attributes.has_key?(:'google_analytics_campaign') self.google_analytics_campaign = attributes[:'google_analytics_campaign'] end if attributes.has_key?(:'metadata') self.metadata = attributes[:'metadata'] end if attributes.has_key?(:'recipient_metadata') if (value = attributes[:'recipient_metadata']).is_a?(Array) self.recipient_metadata = value end end if attributes.has_key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self.attachments = value end end if attributes.has_key?(:'images') if (value = attributes[:'images']).is_a?(Array) self.images = value end end end
Attribute type mapping.
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 174 def self.swagger_types { :'html' => :'String', :'text' => :'String', :'subject' => :'String', :'from_email' => :'String', :'from_name' => :'String', :'to' => :'Array<MessagessendMessageTo>', :'headers' => :'Object', :'important' => :'BOOLEAN', :'track_opens' => :'BOOLEAN', :'track_clicks' => :'BOOLEAN', :'auto_text' => :'BOOLEAN', :'auto_html' => :'BOOLEAN', :'inline_css' => :'BOOLEAN', :'url_strip_qs' => :'BOOLEAN', :'preserve_recipients' => :'BOOLEAN', :'view_content_link' => :'BOOLEAN', :'bcc_address' => :'String', :'tracking_domain' => :'String', :'signing_domain' => :'String', :'return_path_domain' => :'String', :'merge' => :'BOOLEAN', :'merge_language' => :'String', :'global_merge_vars' => :'Array<MessagessendMessageGlobalMergeVars>', :'merge_vars' => :'Array<MessagessendMessageMergeVars>', :'tags' => :'Array<String>', :'subaccount' => :'String', :'google_analytics_domains' => :'Array<String>', :'google_analytics_campaign' => :'String', :'metadata' => :'MessagessendMessageMetadata', :'recipient_metadata' => :'Array<MessagessendMessageRecipientMetadata>', :'attachments' => :'Array<MessagessendMessageAttachments>', :'images' => :'Array<MessagessendMessageImages>' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 391 def ==(o) return true if self.equal?(o) self.class == o.class && html == o.html && text == o.text && subject == o.subject && from_email == o.from_email && from_name == o.from_name && to == o.to && headers == o.headers && important == o.important && track_opens == o.track_opens && track_clicks == o.track_clicks && auto_text == o.auto_text && auto_html == o.auto_html && inline_css == o.inline_css && url_strip_qs == o.url_strip_qs && preserve_recipients == o.preserve_recipients && view_content_link == o.view_content_link && bcc_address == o.bcc_address && tracking_domain == o.tracking_domain && signing_domain == o.signing_domain && return_path_domain == o.return_path_domain && merge == o.merge && merge_language == o.merge_language && global_merge_vars == o.global_merge_vars && merge_vars == o.merge_vars && tags == o.tags && subaccount == o.subaccount && google_analytics_domains == o.google_analytics_domains && google_analytics_campaign == o.google_analytics_campaign && metadata == o.metadata && recipient_metadata == o.recipient_metadata && attachments == o.attachments && images == o.images end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 464 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = MailchimpTransactional.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 530 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 443 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 430 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 436 def hash [html, text, subject, from_email, from_name, to, headers, important, track_opens, track_clicks, auto_text, auto_html, inline_css, url_strip_qs, preserve_recipients, view_content_link, bcc_address, tracking_domain, signing_domain, return_path_domain, merge, merge_language, global_merge_vars, merge_vars, tags, subaccount, google_analytics_domains, google_analytics_campaign, metadata, recipient_metadata, attachments, images].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 366 def list_invalid_properties invalid_properties = Array.new invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] merge_language
Object to be assigned
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 381 def merge_language=(merge_language) validator = EnumAttributeValidator.new('String', ['mailchimp', 'handlebars']) unless validator.valid?(merge_language) fail ArgumentError, 'invalid value for "merge_language", must be one of #{validator.allowable_values}.' end @merge_language = merge_language end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 516 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 504 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/mailchimp_transactional/models/messagessend_message.rb, line 373 def valid? merge_language_validator = EnumAttributeValidator.new('String', ['mailchimp', 'handlebars']) return false unless merge_language_validator.valid?(@merge_language) true end