Class: BrevoRuby::GetEmailCampaign

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo-ruby/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



205
206
207
208
209
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
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 205

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?(:'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.



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

def ab_testing
  @ab_testing
end

#created_atObject

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



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

def created_at
  @created_at
end

Footer of the campaign



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

def footer
  @footer
end

#headerObject

Header of the campaign



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

def header
  @header
end

#html_contentObject

HTML content of the campaign



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

def html_content
  @html_content
end

#idObject

ID of the campaign



18
19
20
# File 'lib/brevo-ruby/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.



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

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



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

def mirror_active
  @mirror_active
end

#modified_atObject

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



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

def modified_at
  @modified_at
end

#nameObject

Name of the campaign



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

def name
  @name
end

#recipientsObject

Returns the value of attribute recipients.



103
104
105
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 103

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



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

def recurring
  @recurring
end

#reply_toObject

Email defined as the "Reply to" of the campaign



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

def reply_to
  @reply_to
end

#return_bounceObject

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



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

def return_bounce
  @return_bounce
end

#scheduled_atObject

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



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

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



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

def send_at_best_time
  @send_at_best_time
end

#senderObject

Returns the value of attribute sender.



65
66
67
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 65

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’



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

def sent_date
  @sent_date
end

Link to share the campaign on social medias



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

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`



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

def split_rule
  @split_rule
end

#statisticsObject

Returns the value of attribute statistics.



105
106
107
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 105

def statistics
  @statistics
end

#statusObject

Status of the campaign



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

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-ruby/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`



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

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`



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

def subject_b
  @subject_b
end

#tagObject

Tag of the campaign



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

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)



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

def test_sent
  @test_sent
end

#to_fieldObject

Customisation of the "to" field of the campaign



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

def to_field
  @to_field
end

#typeObject

Type of campaign



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

def type
  @type
end

#winner_criteriaObject

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



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

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`



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

def winner_delay
  @winner_delay
end

Class Method Details

.attribute_mapObject

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



130
131
132
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
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 130

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'subject' => :'subject',
    :'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.



167
168
169
170
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
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 167

def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'subject' => :'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



445
446
447
448
449
450
451
452
453
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
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 445

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      subject == o.subject &&
      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



517
518
519
520
521
522
523
524
525
526
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
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 517

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



583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 583

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



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 496

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


483
484
485
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 483

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



489
490
491
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 489

def hash
  [id, name, subject, 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



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

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



563
564
565
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 563

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



569
570
571
572
573
574
575
576
577
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 569

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



557
558
559
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 557

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



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/brevo-ruby/models/get_email_campaign.rb', line 401

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