Class: MailchimpTransactional::MessagessendtemplateMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/mailchimp_transactional/models/messagessendtemplate_message.rb

Overview

the other information on the message to send - same as /messages/send, but without the html content

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MessagessendtemplateMessage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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. = attributes[:'metadata']
  end

  if attributes.has_key?(:'recipient_metadata')
    if (value = attributes[:'recipient_metadata']).is_a?(Array)
      self. = 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

Instance Attribute Details

#attachmentsObject

an array of supported attachments to add to the message



108
109
110
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 108

def attachments
  @attachments
end

#auto_htmlObject

whether or not to automatically generate an HTML part for messages that are not given HTML



52
53
54
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 52

def auto_html
  @auto_html
end

#auto_textObject

whether or not to automatically generate a text part for messages that are not given text



49
50
51
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 49

def auto_text
  @auto_text
end

#bcc_addressObject

an optional address to receive an exact copy of each recipient’s email



67
68
69
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 67

def bcc_address
  @bcc_address
end

#from_emailObject

the sender email address



28
29
30
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 28

def from_email
  @from_email
end

#from_nameObject

optional from name to be used



31
32
33
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 31

def from_name
  @from_name
end

#global_merge_varsObject

global merge variables to use for all recipients. You can override these per recipient.



85
86
87
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 85

def global_merge_vars
  @global_merge_vars
end

#google_analytics_campaignObject

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.



100
101
102
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 100

def google_analytics_campaign
  @google_analytics_campaign
end

#google_analytics_domainsObject

an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.



97
98
99
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 97

def google_analytics_domains
  @google_analytics_domains
end

#headersObject

optional extra headers to add to the message (most headers are allowed)



37
38
39
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 37

def headers
  @headers
end

#htmlObject

optional full HTML content to be sent if not in template



19
20
21
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 19

def html
  @html
end

#imagesObject

an array of embedded images to add to the message



111
112
113
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 111

def images
  @images
end

#importantObject

whether or not this message is important, and should be delivered ahead of non-important messages



40
41
42
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 40

def important
  @important
end

#inline_cssObject

whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size



55
56
57
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 55

def inline_css
  @inline_css
end

#mergeObject

whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided.



79
80
81
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 79

def merge
  @merge
end

#merge_languageObject

the merge tag language to use when evaluating merge tags, either mailchimp or handlebars



82
83
84
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 82

def merge_language
  @merge_language
end

#merge_varsObject

per-recipient merge variables, which override global merge variables with the same name.



88
89
90
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 88

def merge_vars
  @merge_vars
end

#metadataObject

Returns the value of attribute metadata.



102
103
104
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 102

def 
  @metadata
end

#preserve_recipientsObject

whether or not to expose all recipients in to "To" header for each email



61
62
63
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 61

def preserve_recipients
  @preserve_recipients
end

#recipient_metadataObject

Per-recipient metadata that will override the global values specified in the metadata parameter.



105
106
107
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 105

def 
  @recipient_metadata
end

#return_path_domainObject

a custom domain to use for the messages’s return-path



76
77
78
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 76

def return_path_domain
  @return_path_domain
end

#signing_domainObject

a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)



73
74
75
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 73

def signing_domain
  @signing_domain
end

#subaccountObject

the unique id of a subaccount for this message - must already exist or will fail with an error



94
95
96
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 94

def subaccount
  @subaccount
end

#subjectObject

the message subject



25
26
27
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 25

def subject
  @subject
end

#tagsObject

an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.



91
92
93
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 91

def tags
  @tags
end

#textObject

optional full text content to be sent



22
23
24
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 22

def text
  @text
end

#toObject

an array of recipient information.



34
35
36
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 34

def to
  @to
end

#track_clicksObject

whether or not to turn on click tracking for the message



46
47
48
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 46

def track_clicks
  @track_clicks
end

#track_opensObject

whether or not to turn on open tracking for the message



43
44
45
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 43

def track_opens
  @track_opens
end

#tracking_domainObject

a custom domain to use for tracking opens and clicks instead of mandrillapp.com



70
71
72
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 70

def tracking_domain
  @tracking_domain
end

#url_strip_qsObject

whether or not to strip the query string from URLs when aggregating tracked URL data



58
59
60
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 58

def url_strip_qs
  @url_strip_qs
end

set to false to remove content logging for sensitive emails



64
65
66
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 64

def view_content_link
  @view_content_link
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

.swagger_typesObject

Attribute type mapping.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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 &&
       == o. &&
       == o. &&
      attachments == o.attachments &&
      images == o.images
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


430
431
432
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 430

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



436
437
438
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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, , , attachments, images].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



366
367
368
369
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 366

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



510
511
512
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 510

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



516
517
518
519
520
521
522
523
524
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



504
505
506
# File 'lib/mailchimp_transactional/models/messagessendtemplate_message.rb', line 504

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



373
374
375
376
377
# File 'lib/mailchimp_transactional/models/messagessendtemplate_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