Class: UltracartClient::EmailPerformance

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/email_performance.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EmailPerformance

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/ultracart_api/models/email_performance.rb', line 179

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::EmailPerformance` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::EmailPerformance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'active_customers')
    self.active_customers = attributes[:'active_customers']
  end

  if attributes.key?(:'actual_customers')
    self.actual_customers = attributes[:'actual_customers']
  end

  if attributes.key?(:'bounce_count')
    self.bounce_count = attributes[:'bounce_count']
  end

  if attributes.key?(:'bounce_percentage')
    self.bounce_percentage = attributes[:'bounce_percentage']
  end

  if attributes.key?(:'bounce_percentage_formatted')
    self.bounce_percentage_formatted = attributes[:'bounce_percentage_formatted']
  end

  if attributes.key?(:'customer_histogram')
    self.customer_histogram = attributes[:'customer_histogram']
  end

  if attributes.key?(:'daily_stats')
    if (value = attributes[:'daily_stats']).is_a?(Array)
      self.daily_stats = value
    end
  end

  if attributes.key?(:'delivered_count')
    self.delivered_count = attributes[:'delivered_count']
  end

  if attributes.key?(:'loyalty_program_type')
    self.loyalty_program_type = attributes[:'loyalty_program_type']
  end

  if attributes.key?(:'max_active_customers')
    self.max_active_customers = attributes[:'max_active_customers']
  end

  if attributes.key?(:'max_emails_per_day')
    self.max_emails_per_day = attributes[:'max_emails_per_day']
  end

  if attributes.key?(:'max_emails_per_hour')
    self.max_emails_per_hour = attributes[:'max_emails_per_hour']
  end

  if attributes.key?(:'max_emails_per_month')
    self.max_emails_per_month = attributes[:'max_emails_per_month']
  end

  if attributes.key?(:'paused_for_spam')
    self.paused_for_spam = attributes[:'paused_for_spam']
  end

  if attributes.key?(:'revenue')
    self.revenue = attributes[:'revenue']
  end

  if attributes.key?(:'sent_emails_per_day')
    self.sent_emails_per_day = attributes[:'sent_emails_per_day']
  end

  if attributes.key?(:'sent_emails_per_hour')
    self.sent_emails_per_hour = attributes[:'sent_emails_per_hour']
  end

  if attributes.key?(:'sent_emails_per_month')
    self.sent_emails_per_month = attributes[:'sent_emails_per_month']
  end

  if attributes.key?(:'sequence_send_count')
    self.sequence_send_count = attributes[:'sequence_send_count']
  end

  if attributes.key?(:'spam_count')
    self.spam_count = attributes[:'spam_count']
  end

  if attributes.key?(:'spam_percentage')
    self.spam_percentage = attributes[:'spam_percentage']
  end

  if attributes.key?(:'spam_percentage_formatted')
    self.spam_percentage_formatted = attributes[:'spam_percentage_formatted']
  end

  if attributes.key?(:'transactional_send_count')
    self.transactional_send_count = attributes[:'transactional_send_count']
  end
end

Instance Attribute Details

#active_customersObject

Active customers. The value will be -1 if calculation is pending.



19
20
21
# File 'lib/ultracart_api/models/email_performance.rb', line 19

def active_customers
  @active_customers
end

#actual_customersObject

Actual customers that they have regardless of active state. The value will be -1 if calculation is pending.



22
23
24
# File 'lib/ultracart_api/models/email_performance.rb', line 22

def actual_customers
  @actual_customers
end

#bounce_countObject

Bounce count



25
26
27
# File 'lib/ultracart_api/models/email_performance.rb', line 25

def bounce_count
  @bounce_count
end

#bounce_percentageObject

bounce percentage rate based upon our look back window. This should be under five percent or the account will be paused for sending.



28
29
30
# File 'lib/ultracart_api/models/email_performance.rb', line 28

def bounce_percentage
  @bounce_percentage
end

#bounce_percentage_formattedObject

bounce percentage rate (formatted) based upon our look back window. This should be under five percent or the account will be paused for sending.



31
32
33
# File 'lib/ultracart_api/models/email_performance.rb', line 31

def bounce_percentage_formatted
  @bounce_percentage_formatted
end

#customer_histogramObject

Returns the value of attribute customer_histogram.



33
34
35
# File 'lib/ultracart_api/models/email_performance.rb', line 33

def customer_histogram
  @customer_histogram
end

#daily_statsObject

Daily statistics used for charting



36
37
38
# File 'lib/ultracart_api/models/email_performance.rb', line 36

def daily_stats
  @daily_stats
end

#delivered_countObject

Delivered count



39
40
41
# File 'lib/ultracart_api/models/email_performance.rb', line 39

def delivered_count
  @delivered_count
end

#loyalty_program_typeObject

Loyalty Program Type



42
43
44
# File 'lib/ultracart_api/models/email_performance.rb', line 42

def loyalty_program_type
  @loyalty_program_type
end

#max_active_customersObject

Maximum active customers allowed under their billing plan



45
46
47
# File 'lib/ultracart_api/models/email_performance.rb', line 45

def max_active_customers
  @max_active_customers
end

#max_emails_per_dayObject

Max emails per day



48
49
50
# File 'lib/ultracart_api/models/email_performance.rb', line 48

def max_emails_per_day
  @max_emails_per_day
end

#max_emails_per_hourObject

Max emails per hour



51
52
53
# File 'lib/ultracart_api/models/email_performance.rb', line 51

def max_emails_per_hour
  @max_emails_per_hour
end

#max_emails_per_monthObject

Max emails per month



54
55
56
# File 'lib/ultracart_api/models/email_performance.rb', line 54

def max_emails_per_month
  @max_emails_per_month
end

#paused_for_spamObject

True if campaign/flow emails are paused due to spam complaints.



57
58
59
# File 'lib/ultracart_api/models/email_performance.rb', line 57

def paused_for_spam
  @paused_for_spam
end

#revenueObject

Revenue



60
61
62
# File 'lib/ultracart_api/models/email_performance.rb', line 60

def revenue
  @revenue
end

#sent_emails_per_dayObject

Sent emails last 24 hours



63
64
65
# File 'lib/ultracart_api/models/email_performance.rb', line 63

def sent_emails_per_day
  @sent_emails_per_day
end

#sent_emails_per_hourObject

Sent emails last hour



66
67
68
# File 'lib/ultracart_api/models/email_performance.rb', line 66

def sent_emails_per_hour
  @sent_emails_per_hour
end

#sent_emails_per_monthObject

Sent emails last 31 days



69
70
71
# File 'lib/ultracart_api/models/email_performance.rb', line 69

def sent_emails_per_month
  @sent_emails_per_month
end

#sequence_send_countObject

Total sequence (campaign/flow) emails sent



72
73
74
# File 'lib/ultracart_api/models/email_performance.rb', line 72

def sequence_send_count
  @sequence_send_count
end

#spam_countObject

Spam complaints



75
76
77
# File 'lib/ultracart_api/models/email_performance.rb', line 75

def spam_count
  @spam_count
end

#spam_percentageObject

Spam percentage rate based upon our look back window. This should be under one half a percent or the account will be paused for sending.



78
79
80
# File 'lib/ultracart_api/models/email_performance.rb', line 78

def spam_percentage
  @spam_percentage
end

#spam_percentage_formattedObject

Spam percentage rate (formatted) based upon our look back window. This should be under one half a percent or the account will be paused for sending.



81
82
83
# File 'lib/ultracart_api/models/email_performance.rb', line 81

def spam_percentage_formatted
  @spam_percentage_formatted
end

#transactional_send_countObject

Total transactions emails sent



84
85
86
# File 'lib/ultracart_api/models/email_performance.rb', line 84

def transactional_send_count
  @transactional_send_count
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



138
139
140
# File 'lib/ultracart_api/models/email_performance.rb', line 138

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/ultracart_api/models/email_performance.rb', line 109

def self.attribute_map
  {
    :'active_customers' => :'active_customers',
    :'actual_customers' => :'actual_customers',
    :'bounce_count' => :'bounce_count',
    :'bounce_percentage' => :'bounce_percentage',
    :'bounce_percentage_formatted' => :'bounce_percentage_formatted',
    :'customer_histogram' => :'customer_histogram',
    :'daily_stats' => :'daily_stats',
    :'delivered_count' => :'delivered_count',
    :'loyalty_program_type' => :'loyalty_program_type',
    :'max_active_customers' => :'max_active_customers',
    :'max_emails_per_day' => :'max_emails_per_day',
    :'max_emails_per_hour' => :'max_emails_per_hour',
    :'max_emails_per_month' => :'max_emails_per_month',
    :'paused_for_spam' => :'paused_for_spam',
    :'revenue' => :'revenue',
    :'sent_emails_per_day' => :'sent_emails_per_day',
    :'sent_emails_per_hour' => :'sent_emails_per_hour',
    :'sent_emails_per_month' => :'sent_emails_per_month',
    :'sequence_send_count' => :'sequence_send_count',
    :'spam_count' => :'spam_count',
    :'spam_percentage' => :'spam_percentage',
    :'spam_percentage_formatted' => :'spam_percentage_formatted',
    :'transactional_send_count' => :'transactional_send_count'
  }
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



357
358
359
# File 'lib/ultracart_api/models/email_performance.rb', line 357

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



172
173
174
175
# File 'lib/ultracart_api/models/email_performance.rb', line 172

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/ultracart_api/models/email_performance.rb', line 143

def self.openapi_types
  {
    :'active_customers' => :'Integer',
    :'actual_customers' => :'Integer',
    :'bounce_count' => :'Integer',
    :'bounce_percentage' => :'Float',
    :'bounce_percentage_formatted' => :'String',
    :'customer_histogram' => :'EmailPerformanceCustomerHistogram',
    :'daily_stats' => :'Array<EmailPerformanceDaily>',
    :'delivered_count' => :'Integer',
    :'loyalty_program_type' => :'String',
    :'max_active_customers' => :'Integer',
    :'max_emails_per_day' => :'Integer',
    :'max_emails_per_hour' => :'Integer',
    :'max_emails_per_month' => :'Integer',
    :'paused_for_spam' => :'Boolean',
    :'revenue' => :'Float',
    :'sent_emails_per_day' => :'Integer',
    :'sent_emails_per_hour' => :'Integer',
    :'sent_emails_per_month' => :'Integer',
    :'sequence_send_count' => :'Integer',
    :'spam_count' => :'Integer',
    :'spam_percentage' => :'Float',
    :'spam_percentage_formatted' => :'String',
    :'transactional_send_count' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/ultracart_api/models/email_performance.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active_customers == o.active_customers &&
      actual_customers == o.actual_customers &&
      bounce_count == o.bounce_count &&
      bounce_percentage == o.bounce_percentage &&
      bounce_percentage_formatted == o.bounce_percentage_formatted &&
      customer_histogram == o.customer_histogram &&
      daily_stats == o.daily_stats &&
      delivered_count == o.delivered_count &&
      loyalty_program_type == o.loyalty_program_type &&
      max_active_customers == o.max_active_customers &&
      max_emails_per_day == o.max_emails_per_day &&
      max_emails_per_hour == o.max_emails_per_hour &&
      max_emails_per_month == o.max_emails_per_month &&
      paused_for_spam == o.paused_for_spam &&
      revenue == o.revenue &&
      sent_emails_per_day == o.sent_emails_per_day &&
      sent_emails_per_hour == o.sent_emails_per_hour &&
      sent_emails_per_month == o.sent_emails_per_month &&
      sequence_send_count == o.sequence_send_count &&
      spam_count == o.spam_count &&
      spam_percentage == o.spam_percentage &&
      spam_percentage_formatted == o.spam_percentage_formatted &&
      transactional_send_count == o.transactional_send_count
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



388
389
390
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
# File 'lib/ultracart_api/models/email_performance.rb', line 388

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = UltracartClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/ultracart_api/models/email_performance.rb', line 459

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



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/ultracart_api/models/email_performance.rb', line 364

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif 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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


344
345
346
# File 'lib/ultracart_api/models/email_performance.rb', line 344

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



350
351
352
# File 'lib/ultracart_api/models/email_performance.rb', line 350

def hash
  [active_customers, actual_customers, bounce_count, bounce_percentage, bounce_percentage_formatted, customer_histogram, daily_stats, delivered_count, loyalty_program_type, max_active_customers, max_emails_per_day, max_emails_per_hour, max_emails_per_month, paused_for_spam, revenue, sent_emails_per_day, sent_emails_per_hour, sent_emails_per_month, sequence_send_count, spam_count, spam_percentage, spam_percentage_formatted, transactional_send_count].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



289
290
291
292
# File 'lib/ultracart_api/models/email_performance.rb', line 289

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



435
436
437
# File 'lib/ultracart_api/models/email_performance.rb', line 435

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



441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/ultracart_api/models/email_performance.rb', line 441

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



429
430
431
# File 'lib/ultracart_api/models/email_performance.rb', line 429

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



296
297
298
299
300
# File 'lib/ultracart_api/models/email_performance.rb', line 296

def valid?
  loyalty_program_type_validator = EnumAttributeValidator.new('String', ["disabled", "points", "cashback"])
  return false unless loyalty_program_type_validator.valid?(@loyalty_program_type)
  true
end