Class: SibApiV3Sdk::GetCampaignOverview

Inherits:
Object
  • Object
show all
Defined in:
lib/sib-api-v3-sdk/models/get_campaign_overview.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetCampaignOverview

Initializes the object

Parameters:

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

    Model attributes in the form of hash



118
119
120
121
122
123
124
125
126
127
128
129
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
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 118

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
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/sib-api-v3-sdk/models/get_campaign_overview.rb', line 36

def ab_testing
  @ab_testing
end

#idObject

ID of the campaign



18
19
20
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 18

def id
  @id
end

#nameObject

Name of the campaign



21
22
23
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 21

def name
  @name
end

#scheduled_atObject

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



33
34
35
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.rb', line 54

def send_at_best_time
  @send_at_best_time
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/sib-api-v3-sdk/models/get_campaign_overview.rb', line 45

def split_rule
  @split_rule
end

#statusObject

Status of the campaign



30
31
32
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.rb', line 42

def subject_b
  @subject_b
end

#typeObject

Type of campaign



27
28
29
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.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/sib-api-v3-sdk/models/get_campaign_overview.rb', line 51

def winner_delay
  @winner_delay
end

Class Method Details

.attribute_mapObject

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



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 79

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'
  }
end

.swagger_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 98

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'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 236

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
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



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
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 290

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



356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 356

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



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 269

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


256
257
258
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 256

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



262
263
264
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 262

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].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 179

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

  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



336
337
338
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 336

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



342
343
344
345
346
347
348
349
350
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 342

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



330
331
332
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 330

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



202
203
204
205
206
207
208
209
210
211
212
# File 'lib/sib-api-v3-sdk/models/get_campaign_overview.rb', line 202

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)
  true
end