Class: TalonOne::CampaignAnalytics
- Inherits:
-
Object
- Object
- TalonOne::CampaignAnalytics
- Defined in:
- lib/talon_one/models/campaign_analytics.rb
Instance Attribute Summary collapse
-
#campaign_discount_costs ⇒ Object
Amount of cost caused by discounts given in the campaign.
-
#campaign_free_items ⇒ Object
Amount of free items given in the campaign.
-
#campaign_revenue ⇒ Object
Amount of revenue in this campaign.
-
#coupon_redemptions ⇒ Object
Number of coupon redemptions in the campaign (only accepted referrals on sessions that were closed are considered).
-
#coupons_created ⇒ Object
Number of coupons created in the campaign by the rule engine.
-
#date ⇒ Object
Returns the value of attribute date.
-
#referral_redemptions ⇒ Object
Number of referral redemptions in the campaign.
-
#referrals_created ⇒ Object
Number of referrals created in the campaign by the rule engine.
-
#total_campaign_discount_costs ⇒ Object
Amount of cost caused by discounts given in the campaign since it began.
-
#total_campaign_free_items ⇒ Object
Amount of free items given in the campaign since it began.
-
#total_campaign_revenue ⇒ Object
Amount of revenue in this campaign since it began.
-
#total_coupon_redemptions ⇒ Object
Number of coupon redemptions in the campaign since it began.
-
#total_coupons_created ⇒ Object
Number of coupons created in the campaign by the rule engine since it began.
-
#total_referral_redemptions ⇒ Object
Number of referral redemptions in the campaign since it began.
-
#total_referrals_created ⇒ Object
Number of referrals created in the campaign by the rule engine since it began.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CampaignAnalytics
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CampaignAnalytics
Initializes the object
106 107 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 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 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 106 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?(:'date') self.date = attributes[:'date'] end if attributes.has_key?(:'campaignRevenue') self.campaign_revenue = attributes[:'campaignRevenue'] end if attributes.has_key?(:'totalCampaignRevenue') self.total_campaign_revenue = attributes[:'totalCampaignRevenue'] end if attributes.has_key?(:'campaignDiscountCosts') self.campaign_discount_costs = attributes[:'campaignDiscountCosts'] end if attributes.has_key?(:'totalCampaignDiscountCosts') self.total_campaign_discount_costs = attributes[:'totalCampaignDiscountCosts'] end if attributes.has_key?(:'campaignFreeItems') self.campaign_free_items = attributes[:'campaignFreeItems'] end if attributes.has_key?(:'totalCampaignFreeItems') self.total_campaign_free_items = attributes[:'totalCampaignFreeItems'] end if attributes.has_key?(:'couponRedemptions') self.coupon_redemptions = attributes[:'couponRedemptions'] end if attributes.has_key?(:'totalCouponRedemptions') self.total_coupon_redemptions = attributes[:'totalCouponRedemptions'] end if attributes.has_key?(:'referralRedemptions') self.referral_redemptions = attributes[:'referralRedemptions'] end if attributes.has_key?(:'totalReferralRedemptions') self.total_referral_redemptions = attributes[:'totalReferralRedemptions'] end if attributes.has_key?(:'couponsCreated') self.coupons_created = attributes[:'couponsCreated'] end if attributes.has_key?(:'totalCouponsCreated') self.total_coupons_created = attributes[:'totalCouponsCreated'] end if attributes.has_key?(:'referralsCreated') self.referrals_created = attributes[:'referralsCreated'] end if attributes.has_key?(:'totalReferralsCreated') self.total_referrals_created = attributes[:'totalReferralsCreated'] end end |
Instance Attribute Details
#campaign_discount_costs ⇒ Object
Amount of cost caused by discounts given in the campaign.
27 28 29 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 27 def campaign_discount_costs @campaign_discount_costs end |
#campaign_free_items ⇒ Object
Amount of free items given in the campaign.
33 34 35 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 33 def campaign_free_items @campaign_free_items end |
#campaign_revenue ⇒ Object
Amount of revenue in this campaign.
21 22 23 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 21 def campaign_revenue @campaign_revenue end |
#coupon_redemptions ⇒ Object
Number of coupon redemptions in the campaign (only accepted referrals on sessions that were closed are considered).
39 40 41 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 39 def coupon_redemptions @coupon_redemptions end |
#coupons_created ⇒ Object
Number of coupons created in the campaign by the rule engine.
51 52 53 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 51 def coupons_created @coupons_created end |
#date ⇒ Object
Returns the value of attribute date.
18 19 20 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 18 def date @date end |
#referral_redemptions ⇒ Object
Number of referral redemptions in the campaign.
45 46 47 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 45 def referral_redemptions @referral_redemptions end |
#referrals_created ⇒ Object
Number of referrals created in the campaign by the rule engine.
57 58 59 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 57 def referrals_created @referrals_created end |
#total_campaign_discount_costs ⇒ Object
Amount of cost caused by discounts given in the campaign since it began.
30 31 32 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 30 def total_campaign_discount_costs @total_campaign_discount_costs end |
#total_campaign_free_items ⇒ Object
Amount of free items given in the campaign since it began.
36 37 38 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 36 def total_campaign_free_items @total_campaign_free_items end |
#total_campaign_revenue ⇒ Object
Amount of revenue in this campaign since it began.
24 25 26 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 24 def total_campaign_revenue @total_campaign_revenue end |
#total_coupon_redemptions ⇒ Object
Number of coupon redemptions in the campaign since it began.
42 43 44 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 42 def total_coupon_redemptions @total_coupon_redemptions end |
#total_coupons_created ⇒ Object
Number of coupons created in the campaign by the rule engine since it began.
54 55 56 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 54 def total_coupons_created @total_coupons_created end |
#total_referral_redemptions ⇒ Object
Number of referral redemptions in the campaign since it began.
48 49 50 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 48 def total_referral_redemptions @total_referral_redemptions end |
#total_referrals_created ⇒ Object
Number of referrals created in the campaign by the rule engine since it began.
60 61 62 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 60 def total_referrals_created @total_referrals_created end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 63 def self.attribute_map { :'date' => :'date', :'campaign_revenue' => :'campaignRevenue', :'total_campaign_revenue' => :'totalCampaignRevenue', :'campaign_discount_costs' => :'campaignDiscountCosts', :'total_campaign_discount_costs' => :'totalCampaignDiscountCosts', :'campaign_free_items' => :'campaignFreeItems', :'total_campaign_free_items' => :'totalCampaignFreeItems', :'coupon_redemptions' => :'couponRedemptions', :'total_coupon_redemptions' => :'totalCouponRedemptions', :'referral_redemptions' => :'referralRedemptions', :'total_referral_redemptions' => :'totalReferralRedemptions', :'coupons_created' => :'couponsCreated', :'total_coupons_created' => :'totalCouponsCreated', :'referrals_created' => :'referralsCreated', :'total_referrals_created' => :'totalReferralsCreated' } end |
.swagger_types ⇒ Object
Attribute type mapping.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 84 def self.swagger_types { :'date' => :'DateTime', :'campaign_revenue' => :'Float', :'total_campaign_revenue' => :'Float', :'campaign_discount_costs' => :'Float', :'total_campaign_discount_costs' => :'Float', :'campaign_free_items' => :'Integer', :'total_campaign_free_items' => :'Integer', :'coupon_redemptions' => :'Integer', :'total_coupon_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.
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 263 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_discount_costs == o.campaign_discount_costs && total_campaign_discount_costs == o.total_campaign_discount_costs && 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 && 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
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 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 319 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 = TalonOne.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
385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 385 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
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 298 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 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
285 286 287 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 285 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
291 292 293 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 291 def hash [date, campaign_revenue, total_campaign_revenue, campaign_discount_costs, total_campaign_discount_costs, campaign_free_items, total_campaign_free_items, coupon_redemptions, total_coupon_redemptions, referral_redemptions, total_referral_redemptions, coupons_created, total_coupons_created, referrals_created, total_referrals_created].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 175 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_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_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 @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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
365 366 367 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 365 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
371 372 373 374 375 376 377 378 379 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 371 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_s ⇒ String
Returns the string representation of the object
359 360 361 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 359 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/talon_one/models/campaign_analytics.rb', line 242 def valid? return false if @date.nil? return false if @campaign_revenue.nil? return false if @total_campaign_revenue.nil? return false if @campaign_discount_costs.nil? return false if @total_campaign_discount_costs.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 @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 |