Class: TalonOne::ExperimentVariantResult
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- TalonOne::ExperimentVariantResult
- Defined in:
- lib/talon_one_sdk/models/experiment_variant_result.rb
Instance Attribute Summary collapse
-
#avg_discounted_session_value ⇒ Object
The average customer session value, calculated by dividing the revenue value by the number of sessions.
-
#avg_items_per_session ⇒ Object
The number of items from sessions divided by the number of sessions.
-
#avg_session_value ⇒ Object
The average customer session value, calculated by dividing the revenue value by the number of sessions.
-
#coupons_count ⇒ Object
The number of times a coupon was successfully redeemed in sessions.
-
#is_winner ⇒ Object
Calculated flag if the variant is the winner.
-
#sessions_count ⇒ Object
The number of all closed sessions.
-
#total_discounts ⇒ Object
The total value of discounts given for cart items in sessions.
-
#total_revenue ⇒ Object
The total, pre-discount value of all items purchased in a customer session.
-
#variant_id ⇒ Object
The ID of the variant.
-
#variant_name ⇒ Object
The name of the variant.
-
#variant_weight ⇒ Object
The weight of the variant.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ExperimentVariantResult
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ExperimentVariantResult
Initializes the object
103 104 105 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 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 103 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ExperimentVariantResult` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ExperimentVariantResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'variant_id') self.variant_id = attributes[:'variant_id'] end if attributes.key?(:'variant_name') self.variant_name = attributes[:'variant_name'] end if attributes.key?(:'variant_weight') self.variant_weight = attributes[:'variant_weight'] end if attributes.key?(:'is_winner') self.is_winner = attributes[:'is_winner'] end if attributes.key?(:'total_revenue') self.total_revenue = attributes[:'total_revenue'] end if attributes.key?(:'sessions_count') self.sessions_count = attributes[:'sessions_count'] end if attributes.key?(:'avg_items_per_session') self.avg_items_per_session = attributes[:'avg_items_per_session'] end if attributes.key?(:'avg_session_value') self.avg_session_value = attributes[:'avg_session_value'] end if attributes.key?(:'avg_discounted_session_value') self.avg_discounted_session_value = attributes[:'avg_discounted_session_value'] end if attributes.key?(:'total_discounts') self.total_discounts = attributes[:'total_discounts'] end if attributes.key?(:'coupons_count') self.coupons_count = attributes[:'coupons_count'] end end |
Instance Attribute Details
#avg_discounted_session_value ⇒ Object
The average customer session value, calculated by dividing the revenue value by the number of sessions.
43 44 45 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 43 def avg_discounted_session_value @avg_discounted_session_value end |
#avg_items_per_session ⇒ Object
The number of items from sessions divided by the number of sessions.
37 38 39 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 37 def avg_items_per_session @avg_items_per_session end |
#avg_session_value ⇒ Object
The average customer session value, calculated by dividing the revenue value by the number of sessions.
40 41 42 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 40 def avg_session_value @avg_session_value end |
#coupons_count ⇒ Object
The number of times a coupon was successfully redeemed in sessions.
49 50 51 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 49 def coupons_count @coupons_count end |
#is_winner ⇒ Object
Calculated flag if the variant is the winner.
28 29 30 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 28 def is_winner @is_winner end |
#sessions_count ⇒ Object
The number of all closed sessions.
34 35 36 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 34 def sessions_count @sessions_count end |
#total_discounts ⇒ Object
The total value of discounts given for cart items in sessions.
46 47 48 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 46 def total_discounts @total_discounts end |
#total_revenue ⇒ Object
The total, pre-discount value of all items purchased in a customer session.
31 32 33 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 31 def total_revenue @total_revenue end |
#variant_id ⇒ Object
The ID of the variant.
19 20 21 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 19 def variant_id @variant_id end |
#variant_name ⇒ Object
The name of the variant.
22 23 24 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 22 def variant_name @variant_name end |
#variant_weight ⇒ Object
The weight of the variant.
25 26 27 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 25 def variant_weight @variant_weight end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
69 70 71 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 69 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
74 75 76 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 74 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 52 def self.attribute_map { :'variant_id' => :'variantId', :'variant_name' => :'variantName', :'variant_weight' => :'variantWeight', :'is_winner' => :'isWinner', :'total_revenue' => :'totalRevenue', :'sessions_count' => :'sessionsCount', :'avg_items_per_session' => :'avgItemsPerSession', :'avg_session_value' => :'avgSessionValue', :'avg_discounted_session_value' => :'avgDiscountedSessionValue', :'total_discounts' => :'totalDiscounts', :'coupons_count' => :'couponsCount' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 210 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
96 97 98 99 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 96 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 79 def self.openapi_types { :'variant_id' => :'Integer', :'variant_name' => :'String', :'variant_weight' => :'Integer', :'is_winner' => :'Boolean', :'total_revenue' => :'Float', :'sessions_count' => :'Float', :'avg_items_per_session' => :'Float', :'avg_session_value' => :'Float', :'avg_discounted_session_value' => :'Float', :'total_discounts' => :'Float', :'coupons_count' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 179 def ==(o) return true if self.equal?(o) self.class == o.class && variant_id == o.variant_id && variant_name == o.variant_name && variant_weight == o.variant_weight && is_winner == o.is_winner && total_revenue == o.total_revenue && sessions_count == o.sessions_count && avg_items_per_session == o.avg_items_per_session && avg_session_value == o.avg_session_value && avg_discounted_session_value == o.avg_discounted_session_value && total_discounts == o.total_discounts && coupons_count == o.coupons_count end |
#eql?(o) ⇒ Boolean
197 198 199 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 197 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
203 204 205 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 203 def hash [variant_id, variant_name, variant_weight, is_winner, total_revenue, sessions_count, avg_items_per_session, avg_session_value, avg_discounted_session_value, total_discounts, coupons_count].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
164 165 166 167 168 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 164 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 232 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
172 173 174 175 |
# File 'lib/talon_one_sdk/models/experiment_variant_result.rb', line 172 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |