Class: TalonOne::CampaignAnalytics

Inherits:
Object
  • Object
show all
Defined in:
lib/talon_one/models/campaign_analytics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CampaignAnalytics

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
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
# File 'lib/talon_one/models/campaign_analytics.rb', line 142

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::CampaignAnalytics` 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 `TalonOne::CampaignAnalytics`. 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?(:'date')
    self.date = attributes[:'date']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#campaign_discount_costsObject

Amount of cost caused by discounts given in the campaign.



33
34
35
# File 'lib/talon_one/models/campaign_analytics.rb', line 33

def campaign_discount_costs
  @campaign_discount_costs
end

#campaign_free_itemsObject

Amount of free items given in the campaign.



45
46
47
# File 'lib/talon_one/models/campaign_analytics.rb', line 45

def campaign_free_items
  @campaign_free_items
end

#campaign_refundObject

Amount of refunds in this campaign (for coupon or discount sessions).



27
28
29
# File 'lib/talon_one/models/campaign_analytics.rb', line 27

def campaign_refund
  @campaign_refund
end

#campaign_refunded_discountsObject

Amount of discounts rolledback due to refund in the campaign.



39
40
41
# File 'lib/talon_one/models/campaign_analytics.rb', line 39

def campaign_refunded_discounts
  @campaign_refunded_discounts
end

#campaign_revenueObject

Amount of revenue in this campaign (for coupon or discount sessions).



21
22
23
# File 'lib/talon_one/models/campaign_analytics.rb', line 21

def campaign_revenue
  @campaign_revenue
end

#coupon_redemptionsObject

Number of coupon redemptions in the campaign.



51
52
53
# File 'lib/talon_one/models/campaign_analytics.rb', line 51

def coupon_redemptions
  @coupon_redemptions
end

#coupon_rolledback_redemptionsObject

Number of coupon redemptions that have been rolled back (due to canceling closed session) in the campaign.



57
58
59
# File 'lib/talon_one/models/campaign_analytics.rb', line 57

def coupon_rolledback_redemptions
  @coupon_rolledback_redemptions
end

#coupons_createdObject

Number of coupons created in the campaign by the rule engine.



69
70
71
# File 'lib/talon_one/models/campaign_analytics.rb', line 69

def coupons_created
  @coupons_created
end

#dateObject

Returns the value of attribute date.



18
19
20
# File 'lib/talon_one/models/campaign_analytics.rb', line 18

def date
  @date
end

#referral_redemptionsObject

Number of referral redemptions in the campaign.



63
64
65
# File 'lib/talon_one/models/campaign_analytics.rb', line 63

def referral_redemptions
  @referral_redemptions
end

#referrals_createdObject

Number of referrals created in the campaign by the rule engine.



75
76
77
# File 'lib/talon_one/models/campaign_analytics.rb', line 75

def referrals_created
  @referrals_created
end

#total_campaign_discount_costsObject

Amount of cost caused by discounts given in the campaign since it began.



36
37
38
# File 'lib/talon_one/models/campaign_analytics.rb', line 36

def total_campaign_discount_costs
  @total_campaign_discount_costs
end

#total_campaign_free_itemsObject

Amount of free items given in the campaign since it began.



48
49
50
# File 'lib/talon_one/models/campaign_analytics.rb', line 48

def total_campaign_free_items
  @total_campaign_free_items
end

#total_campaign_refundObject

Amount of refunds in this campaign since it began (for coupon or discount sessions).



30
31
32
# File 'lib/talon_one/models/campaign_analytics.rb', line 30

def total_campaign_refund
  @total_campaign_refund
end

#total_campaign_refunded_discountsObject

Amount of discounts rolledback due to refund in the campaign since it began.



42
43
44
# File 'lib/talon_one/models/campaign_analytics.rb', line 42

def total_campaign_refunded_discounts
  @total_campaign_refunded_discounts
end

#total_campaign_revenueObject

Amount of revenue in this campaign since it began (for coupon or discount sessions).



24
25
26
# File 'lib/talon_one/models/campaign_analytics.rb', line 24

def total_campaign_revenue
  @total_campaign_revenue
end

#total_coupon_redemptionsObject

Number of coupon redemptions in the campaign since it began.



54
55
56
# File 'lib/talon_one/models/campaign_analytics.rb', line 54

def total_coupon_redemptions
  @total_coupon_redemptions
end

#total_coupon_rolledback_redemptionsObject

Number of coupon redemptions that have been rolled back (due to canceling closed session) in the campaign since it began.



60
61
62
# File 'lib/talon_one/models/campaign_analytics.rb', line 60

def total_coupon_rolledback_redemptions
  @total_coupon_rolledback_redemptions
end

#total_coupons_createdObject

Number of coupons created in the campaign by the rule engine since it began.



72
73
74
# File 'lib/talon_one/models/campaign_analytics.rb', line 72

def total_coupons_created
  @total_coupons_created
end

#total_referral_redemptionsObject

Number of referral redemptions in the campaign since it began.



66
67
68
# File 'lib/talon_one/models/campaign_analytics.rb', line 66

def total_referral_redemptions
  @total_referral_redemptions
end

#total_referrals_createdObject

Number of referrals created in the campaign by the rule engine since it began.



78
79
80
# File 'lib/talon_one/models/campaign_analytics.rb', line 78

def total_referrals_created
  @total_referrals_created
end

Class Method Details

.attribute_mapObject

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/talon_one/models/campaign_analytics.rb', line 81

def self.attribute_map
  {
    :'date' => :'date',
    :'campaign_revenue' => :'campaignRevenue',
    :'total_campaign_revenue' => :'totalCampaignRevenue',
    :'campaign_refund' => :'campaignRefund',
    :'total_campaign_refund' => :'totalCampaignRefund',
    :'campaign_discount_costs' => :'campaignDiscountCosts',
    :'total_campaign_discount_costs' => :'totalCampaignDiscountCosts',
    :'campaign_refunded_discounts' => :'campaignRefundedDiscounts',
    :'total_campaign_refunded_discounts' => :'totalCampaignRefundedDiscounts',
    :'campaign_free_items' => :'campaignFreeItems',
    :'total_campaign_free_items' => :'totalCampaignFreeItems',
    :'coupon_redemptions' => :'couponRedemptions',
    :'total_coupon_redemptions' => :'totalCouponRedemptions',
    :'coupon_rolledback_redemptions' => :'couponRolledbackRedemptions',
    :'total_coupon_rolledback_redemptions' => :'totalCouponRolledbackRedemptions',
    :'referral_redemptions' => :'referralRedemptions',
    :'total_referral_redemptions' => :'totalReferralRedemptions',
    :'coupons_created' => :'couponsCreated',
    :'total_coupons_created' => :'totalCouponsCreated',
    :'referrals_created' => :'referralsCreated',
    :'total_referrals_created' => :'totalReferralsCreated'
  }
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



401
402
403
# File 'lib/talon_one/models/campaign_analytics.rb', line 401

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

.openapi_nullableObject

List of attributes with nullable: true



135
136
137
138
# File 'lib/talon_one/models/campaign_analytics.rb', line 135

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'date' => :'DateTime',
    :'campaign_revenue' => :'Float',
    :'total_campaign_revenue' => :'Float',
    :'campaign_refund' => :'Float',
    :'total_campaign_refund' => :'Float',
    :'campaign_discount_costs' => :'Float',
    :'total_campaign_discount_costs' => :'Float',
    :'campaign_refunded_discounts' => :'Float',
    :'total_campaign_refunded_discounts' => :'Float',
    :'campaign_free_items' => :'Integer',
    :'total_campaign_free_items' => :'Integer',
    :'coupon_redemptions' => :'Integer',
    :'total_coupon_redemptions' => :'Integer',
    :'coupon_rolledback_redemptions' => :'Integer',
    :'total_coupon_rolledback_redemptions' => :'Integer',
    :'referral_redemptions' => :'Integer',
    :'total_referral_redemptions' => :'Integer',
    :'coupons_created' => :'Integer',
    :'total_coupons_created' => :'Integer',
    :'referrals_created' => :'Integer',
    :'total_referrals_created' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/talon_one/models/campaign_analytics.rb', line 360

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      date == o.date &&
      campaign_revenue == o.campaign_revenue &&
      total_campaign_revenue == o.total_campaign_revenue &&
      campaign_refund == o.campaign_refund &&
      total_campaign_refund == o.total_campaign_refund &&
      campaign_discount_costs == o.campaign_discount_costs &&
      total_campaign_discount_costs == o.total_campaign_discount_costs &&
      campaign_refunded_discounts == o.campaign_refunded_discounts &&
      total_campaign_refunded_discounts == o.total_campaign_refunded_discounts &&
      campaign_free_items == o.campaign_free_items &&
      total_campaign_free_items == o.total_campaign_free_items &&
      coupon_redemptions == o.coupon_redemptions &&
      total_coupon_redemptions == o.total_coupon_redemptions &&
      coupon_rolledback_redemptions == o.coupon_rolledback_redemptions &&
      total_coupon_rolledback_redemptions == o.total_coupon_rolledback_redemptions &&
      referral_redemptions == o.referral_redemptions &&
      total_referral_redemptions == o.total_referral_redemptions &&
      coupons_created == o.coupons_created &&
      total_coupons_created == o.total_coupons_created &&
      referrals_created == o.referrals_created &&
      total_referrals_created == o.total_referrals_created
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



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/talon_one/models/campaign_analytics.rb', line 429

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
    TalonOne.const_get(type).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



498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/talon_one/models/campaign_analytics.rb', line 498

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



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/talon_one/models/campaign_analytics.rb', line 408

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_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


388
389
390
# File 'lib/talon_one/models/campaign_analytics.rb', line 388

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



394
395
396
# File 'lib/talon_one/models/campaign_analytics.rb', line 394

def hash
  [date, campaign_revenue, total_campaign_revenue, campaign_refund, total_campaign_refund, campaign_discount_costs, total_campaign_discount_costs, campaign_refunded_discounts, total_campaign_refunded_discounts, campaign_free_items, total_campaign_free_items, coupon_redemptions, total_coupon_redemptions, coupon_rolledback_redemptions, total_coupon_rolledback_redemptions, referral_redemptions, total_referral_redemptions, coupons_created, total_coupons_created, referrals_created, total_referrals_created].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/talon_one/models/campaign_analytics.rb', line 242

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if @total_referrals_created.nil?
    invalid_properties.push('invalid value for "total_referrals_created", total_referrals_created 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



474
475
476
# File 'lib/talon_one/models/campaign_analytics.rb', line 474

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



480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/talon_one/models/campaign_analytics.rb', line 480

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



468
469
470
# File 'lib/talon_one/models/campaign_analytics.rb', line 468

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



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/talon_one/models/campaign_analytics.rb', line 333

def valid?
  return false if @date.nil?
  return false if @campaign_revenue.nil?
  return false if @total_campaign_revenue.nil?
  return false if @campaign_refund.nil?
  return false if @total_campaign_refund.nil?
  return false if @campaign_discount_costs.nil?
  return false if @total_campaign_discount_costs.nil?
  return false if @campaign_refunded_discounts.nil?
  return false if @total_campaign_refunded_discounts.nil?
  return false if @campaign_free_items.nil?
  return false if @total_campaign_free_items.nil?
  return false if @coupon_redemptions.nil?
  return false if @total_coupon_redemptions.nil?
  return false if @coupon_rolledback_redemptions.nil?
  return false if @total_coupon_rolledback_redemptions.nil?
  return false if @referral_redemptions.nil?
  return false if @total_referral_redemptions.nil?
  return false if @coupons_created.nil?
  return false if @total_coupons_created.nil?
  return false if @referrals_created.nil?
  return false if @total_referrals_created.nil?
  true
end