Class: Brevo::GetEmailCampaign

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo/models/get_email_campaign.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetEmailCampaign

Initializes the object

Parameters:

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

    Model attributes in the form of hash



210
211
212
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
# File 'lib/brevo/models/get_email_campaign.rb', line 210

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?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'subject')
    self.subject = attributes[:'subject']
  end

  if attributes.has_key?(:'previewText')
    self.preview_text = attributes[:'previewText']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'scheduledAt')
    self.scheduled_at = attributes[:'scheduledAt']
  end

  if attributes.has_key?(:'abTesting')
    self.ab_testing = attributes[:'abTesting']
  end

  if attributes.has_key?(:'subjectA')
    self.subject_a = attributes[:'subjectA']
  end

  if attributes.has_key?(:'subjectB')
    self.subject_b = attributes[:'subjectB']
  end

  if attributes.has_key?(:'splitRule')
    self.split_rule = attributes[:'splitRule']
  end

  if attributes.has_key?(:'winnerCriteria')
    self.winner_criteria = attributes[:'winnerCriteria']
  end

  if attributes.has_key?(:'winnerDelay')
    self.winner_delay = attributes[:'winnerDelay']
  end

  if attributes.has_key?(:'sendAtBestTime')
    self.send_at_best_time = attributes[:'sendAtBestTime']
  end

  if attributes.has_key?(:'testSent')
    self.test_sent = attributes[:'testSent']
  end

  if attributes.has_key?(:'header')
    self.header = attributes[:'header']
  end

  if attributes.has_key?(:'footer')
    self.footer = attributes[:'footer']
  end

  if attributes.has_key?(:'sender')
    self.sender = attributes[:'sender']
  end

  if attributes.has_key?(:'replyTo')
    self.reply_to = attributes[:'replyTo']
  end

  if attributes.has_key?(:'toField')
    self.to_field = attributes[:'toField']
  end

  if attributes.has_key?(:'htmlContent')
    self.html_content = attributes[:'htmlContent']
  end

  if attributes.has_key?(:'shareLink')
    self.share_link = attributes[:'shareLink']
  end

  if attributes.has_key?(:'tag')
    self.tag = attributes[:'tag']
  end

  if attributes.has_key?(:'createdAt')
    self.created_at = attributes[:'createdAt']
  end

  if attributes.has_key?(:'modifiedAt')
    self.modified_at = attributes[:'modifiedAt']
  end

  if attributes.has_key?(:'inlineImageActivation')
    self.inline_image_activation = attributes[:'inlineImageActivation']
  end

  if attributes.has_key?(:'mirrorActive')
    self.mirror_active = attributes[:'mirrorActive']
  end

  if attributes.has_key?(:'recurring')
    self.recurring = attributes[:'recurring']
  end

  if attributes.has_key?(:'sentDate')
    self.sent_date = attributes[:'sentDate']
  end

  if attributes.has_key?(:'returnBounce')
    self.return_bounce = attributes[:'returnBounce']
  end

  if attributes.has_key?(:'recipients')
    self.recipients = attributes[:'recipients']
  end

  if attributes.has_key?(:'statistics')
    self.statistics = attributes[:'statistics']
  end
end

Instance Attribute Details

#ab_testingObject

Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled.



39
40
41
# File 'lib/brevo/models/get_email_campaign.rb', line 39

def ab_testing
  @ab_testing
end

#created_atObject

Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ)



86
87
88
# File 'lib/brevo/models/get_email_campaign.rb', line 86

def created_at
  @created_at
end

Footer of the campaign



66
67
68
# File 'lib/brevo/models/get_email_campaign.rb', line 66

def footer
  @footer
end

#headerObject

Header of the campaign



63
64
65
# File 'lib/brevo/models/get_email_campaign.rb', line 63

def header
  @header
end

#html_contentObject

HTML content of the campaign



77
78
79
# File 'lib/brevo/models/get_email_campaign.rb', line 77

def html_content
  @html_content
end

#idObject

ID of the campaign



18
19
20
# File 'lib/brevo/models/get_email_campaign.rb', line 18

def id
  @id
end

#inline_image_activationObject

Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email.



92
93
94
# File 'lib/brevo/models/get_email_campaign.rb', line 92

def inline_image_activation
  @inline_image_activation
end

#mirror_activeObject

Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign



95
96
97
# File 'lib/brevo/models/get_email_campaign.rb', line 95

def mirror_active
  @mirror_active
end

#modified_atObject

UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ)



89
90
91
# File 'lib/brevo/models/get_email_campaign.rb', line 89

def modified_at
  @modified_at
end

#nameObject

Name of the campaign



21
22
23
# File 'lib/brevo/models/get_email_campaign.rb', line 21

def name
  @name
end

#preview_textObject

Preview text or preheader of the email campaign



27
28
29
# File 'lib/brevo/models/get_email_campaign.rb', line 27

def preview_text
  @preview_text
end

#recipientsObject

Returns the value of attribute recipients.



106
107
108
# File 'lib/brevo/models/get_email_campaign.rb', line 106

def recipients
  @recipients
end

#recurringObject

FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times



98
99
100
# File 'lib/brevo/models/get_email_campaign.rb', line 98

def recurring
  @recurring
end

#reply_toObject

Email defined as the "Reply to" of the campaign



71
72
73
# File 'lib/brevo/models/get_email_campaign.rb', line 71

def reply_to
  @reply_to
end

#return_bounceObject

Total number of non-delivered campaigns for a particular campaign id.



104
105
106
# File 'lib/brevo/models/get_email_campaign.rb', line 104

def return_bounce
  @return_bounce
end

#scheduled_atObject

UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ)



36
37
38
# File 'lib/brevo/models/get_email_campaign.rb', line 36

def scheduled_at
  @scheduled_at
end

#send_at_best_timeObject

It is true if you have chosen to send your campaign at best time, otherwise it is false



57
58
59
# File 'lib/brevo/models/get_email_campaign.rb', line 57

def send_at_best_time
  @send_at_best_time
end

#senderObject

Returns the value of attribute sender.



68
69
70
# File 'lib/brevo/models/get_email_campaign.rb', line 68

def sender
  @sender
end

#sent_dateObject

Sent UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if ‘status’ of the campaign is ‘sent’



101
102
103
# File 'lib/brevo/models/get_email_campaign.rb', line 101

def sent_date
  @sent_date
end

Link to share the campaign on social medias



80
81
82
# File 'lib/brevo/models/get_email_campaign.rb', line 80

def share_link
  @share_link
end

#split_ruleObject

The size of your ab-test groups. Only available if ‘abTesting` flag of the campaign is `true`



48
49
50
# File 'lib/brevo/models/get_email_campaign.rb', line 48

def split_rule
  @split_rule
end

#statisticsObject

Returns the value of attribute statistics.



108
109
110
# File 'lib/brevo/models/get_email_campaign.rb', line 108

def statistics
  @statistics
end

#statusObject

Status of the campaign



33
34
35
# File 'lib/brevo/models/get_email_campaign.rb', line 33

def status
  @status
end

#subjectObject

Subject of the campaign. Only available if ‘abTesting` flag of the campaign is `false`



24
25
26
# File 'lib/brevo/models/get_email_campaign.rb', line 24

def subject
  @subject
end

#subject_aObject

Subject A of the ab-test campaign. Only available if ‘abTesting` flag of the campaign is `true`



42
43
44
# File 'lib/brevo/models/get_email_campaign.rb', line 42

def subject_a
  @subject_a
end

#subject_bObject

Subject B of the ab-test campaign. Only available if ‘abTesting` flag of the campaign is `true`



45
46
47
# File 'lib/brevo/models/get_email_campaign.rb', line 45

def subject_b
  @subject_b
end

#tagObject

Tag of the campaign



83
84
85
# File 'lib/brevo/models/get_email_campaign.rb', line 83

def tag
  @tag
end

#test_sentObject

Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent)



60
61
62
# File 'lib/brevo/models/get_email_campaign.rb', line 60

def test_sent
  @test_sent
end

#to_fieldObject

Customisation of the "to" field of the campaign



74
75
76
# File 'lib/brevo/models/get_email_campaign.rb', line 74

def to_field
  @to_field
end

#typeObject

Type of campaign



30
31
32
# File 'lib/brevo/models/get_email_campaign.rb', line 30

def type
  @type
end

#winner_criteriaObject

Criteria for the winning version. Only available if ‘abTesting` flag of the campaign is `true`



51
52
53
# File 'lib/brevo/models/get_email_campaign.rb', line 51

def winner_criteria
  @winner_criteria
end

#winner_delayObject

The duration of the test in hours at the end of which the winning version will be sent. Only available if ‘abTesting` flag of the campaign is `true`



54
55
56
# File 'lib/brevo/models/get_email_campaign.rb', line 54

def winner_delay
  @winner_delay
end

Class Method Details

.attribute_mapObject

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



133
134
135
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
# File 'lib/brevo/models/get_email_campaign.rb', line 133

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'subject' => :'subject',
    :'preview_text' => :'previewText',
    :'type' => :'type',
    :'status' => :'status',
    :'scheduled_at' => :'scheduledAt',
    :'ab_testing' => :'abTesting',
    :'subject_a' => :'subjectA',
    :'subject_b' => :'subjectB',
    :'split_rule' => :'splitRule',
    :'winner_criteria' => :'winnerCriteria',
    :'winner_delay' => :'winnerDelay',
    :'send_at_best_time' => :'sendAtBestTime',
    :'test_sent' => :'testSent',
    :'header' => :'header',
    :'footer' => :'footer',
    :'sender' => :'sender',
    :'reply_to' => :'replyTo',
    :'to_field' => :'toField',
    :'html_content' => :'htmlContent',
    :'share_link' => :'shareLink',
    :'tag' => :'tag',
    :'created_at' => :'createdAt',
    :'modified_at' => :'modifiedAt',
    :'inline_image_activation' => :'inlineImageActivation',
    :'mirror_active' => :'mirrorActive',
    :'recurring' => :'recurring',
    :'sent_date' => :'sentDate',
    :'return_bounce' => :'returnBounce',
    :'recipients' => :'recipients',
    :'statistics' => :'statistics'
  }
end

.swagger_typesObject

Attribute type mapping.



171
172
173
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
# File 'lib/brevo/models/get_email_campaign.rb', line 171

def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'subject' => :'String',
    :'preview_text' => :'String',
    :'type' => :'String',
    :'status' => :'String',
    :'scheduled_at' => :'String',
    :'ab_testing' => :'BOOLEAN',
    :'subject_a' => :'String',
    :'subject_b' => :'String',
    :'split_rule' => :'Integer',
    :'winner_criteria' => :'String',
    :'winner_delay' => :'Integer',
    :'send_at_best_time' => :'BOOLEAN',
    :'test_sent' => :'BOOLEAN',
    :'header' => :'String',
    :'footer' => :'String',
    :'sender' => :'GetExtendedCampaignOverviewSender',
    :'reply_to' => :'String',
    :'to_field' => :'String',
    :'html_content' => :'String',
    :'share_link' => :'String',
    :'tag' => :'String',
    :'created_at' => :'String',
    :'modified_at' => :'String',
    :'inline_image_activation' => :'BOOLEAN',
    :'mirror_active' => :'BOOLEAN',
    :'recurring' => :'BOOLEAN',
    :'sent_date' => :'String',
    :'return_bounce' => :'Integer',
    :'recipients' => :'GetCampaignRecipients',
    :'statistics' => :'GetExtendedCampaignStats'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



454
455
456
457
458
459
460
461
462
463
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
# File 'lib/brevo/models/get_email_campaign.rb', line 454

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      subject == o.subject &&
      preview_text == o.preview_text &&
      type == o.type &&
      status == o.status &&
      scheduled_at == o.scheduled_at &&
      ab_testing == o.ab_testing &&
      subject_a == o.subject_a &&
      subject_b == o.subject_b &&
      split_rule == o.split_rule &&
      winner_criteria == o.winner_criteria &&
      winner_delay == o.winner_delay &&
      send_at_best_time == o.send_at_best_time &&
      test_sent == o.test_sent &&
      header == o.header &&
      footer == o.footer &&
      sender == o.sender &&
      reply_to == o.reply_to &&
      to_field == o.to_field &&
      html_content == o.html_content &&
      share_link == o.share_link &&
      tag == o.tag &&
      created_at == o.created_at &&
      modified_at == o.modified_at &&
      inline_image_activation == o.inline_image_activation &&
      mirror_active == o.mirror_active &&
      recurring == o.recurring &&
      sent_date == o.sent_date &&
      return_bounce == o.return_bounce &&
      recipients == o.recipients &&
      statistics == o.statistics
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



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/brevo/models/get_email_campaign.rb', line 527

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 = Brevo.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



593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/brevo/models/get_email_campaign.rb', line 593

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



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/brevo/models/get_email_campaign.rb', line 506

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


493
494
495
# File 'lib/brevo/models/get_email_campaign.rb', line 493

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



499
500
501
# File 'lib/brevo/models/get_email_campaign.rb', line 499

def hash
  [id, name, subject, preview_text, type, status, scheduled_at, ab_testing, subject_a, subject_b, split_rule, winner_criteria, winner_delay, send_at_best_time, test_sent, header, footer, sender, reply_to, to_field, html_content, share_link, tag, created_at, modified_at, inline_image_activation, mirror_active, recurring, sent_date, return_bounce, recipients, statistics].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/brevo/models/get_email_campaign.rb', line 347

def list_invalid_properties
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @test_sent.nil?
    invalid_properties.push('invalid value for "test_sent", test_sent cannot be nil.')
  end

  if @header.nil?
    invalid_properties.push('invalid value for "header", header cannot be nil.')
  end

  if @footer.nil?
    invalid_properties.push('invalid value for "footer", footer cannot be nil.')
  end

  if @sender.nil?
    invalid_properties.push('invalid value for "sender", sender cannot be nil.')
  end

  if @reply_to.nil?
    invalid_properties.push('invalid value for "reply_to", reply_to cannot be nil.')
  end

  if @html_content.nil?
    invalid_properties.push('invalid value for "html_content", html_content cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @modified_at.nil?
    invalid_properties.push('invalid value for "modified_at", modified_at cannot be nil.')
  end

  if @recipients.nil?
    invalid_properties.push('invalid value for "recipients", recipients cannot be nil.')
  end

  if @statistics.nil?
    invalid_properties.push('invalid value for "statistics", statistics cannot be nil.')
  end

  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



573
574
575
# File 'lib/brevo/models/get_email_campaign.rb', line 573

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



579
580
581
582
583
584
585
586
587
# File 'lib/brevo/models/get_email_campaign.rb', line 579

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



567
568
569
# File 'lib/brevo/models/get_email_campaign.rb', line 567

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



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/brevo/models/get_email_campaign.rb', line 410

def valid?
  return false if @id.nil?
  return false if @name.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ['classic', 'trigger'])
  return false unless type_validator.valid?(@type)
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ['draft', 'sent', 'archive', 'queued', 'suspended', 'in_process'])
  return false unless status_validator.valid?(@status)
  return false if @test_sent.nil?
  return false if @header.nil?
  return false if @footer.nil?
  return false if @sender.nil?
  return false if @reply_to.nil?
  return false if @html_content.nil?
  return false if @created_at.nil?
  return false if @modified_at.nil?
  return false if @recipients.nil?
  return false if @statistics.nil?
  true
end