Class: UltracartClient::Experiment
- Inherits:
-
Object
- Object
- UltracartClient::Experiment
- Defined in:
- lib/ultracart_api/models/experiment.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#container_id ⇒ Object
Contained ID where the experiment element was located.
-
#duration_days ⇒ Object
Duration in days.
-
#end_dts ⇒ Object
End date/time.
-
#equal_weighting ⇒ Object
Whether or not traffic is equally weighted or shifts over time during the experiment.
-
#experiment_type ⇒ Object
The type of experiment.
-
#id ⇒ Object
Experiment id.
-
#name ⇒ Object
Experiment name.
-
#notes ⇒ Object
Notes about the experiment.
-
#objective ⇒ Object
Objective that is being optimized.
-
#objective_parameter ⇒ Object
Objective parameter (such as event name) that is being optimized.
-
#openai_current_iteration ⇒ Object
The current iteration of the OpenAI related experiment.
-
#openai_element_type ⇒ Object
The type of OpenAI element being experimented on.
-
#openai_model ⇒ Object
The type of OpenAI model used.
-
#openai_total_iterations ⇒ Object
The total number of iterations to perform on the experiment.
-
#optimization_type ⇒ Object
Type of optimization.
-
#p95_sessions_needed ⇒ Object
Estimated sessions needed to achieve P95.
-
#p_value ⇒ Object
Statistics p-value for the experiment.
-
#session_count ⇒ Object
Total number of sessions in the experiment.
-
#start_dts ⇒ Object
Start date/time.
-
#status ⇒ Object
Status of the experiment.
-
#storefront_experiment_oid ⇒ Object
Storefront Experiment Oid.
-
#storefront_oid ⇒ Object
Storefront oid.
-
#uri ⇒ Object
URI the experiment was started on.
-
#variations ⇒ Object
Variations being tested in the experiment.
Class Method Summary collapse
-
.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.
-
#_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 ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Experiment
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 = {}) ⇒ Experiment
Initializes the object
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 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/ultracart_api/models/experiment.rb', line 185 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::Experiment` 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::Experiment`. 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?(:'container_id') self.container_id = attributes[:'container_id'] end if attributes.key?(:'duration_days') self.duration_days = attributes[:'duration_days'] end if attributes.key?(:'end_dts') self.end_dts = attributes[:'end_dts'] end if attributes.key?(:'equal_weighting') self.equal_weighting = attributes[:'equal_weighting'] end if attributes.key?(:'experiment_type') self.experiment_type = attributes[:'experiment_type'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'notes') self.notes = attributes[:'notes'] end if attributes.key?(:'objective') self.objective = attributes[:'objective'] end if attributes.key?(:'objective_parameter') self.objective_parameter = attributes[:'objective_parameter'] end if attributes.key?(:'openai_current_iteration') self.openai_current_iteration = attributes[:'openai_current_iteration'] end if attributes.key?(:'openai_element_type') self.openai_element_type = attributes[:'openai_element_type'] end if attributes.key?(:'openai_model') self.openai_model = attributes[:'openai_model'] end if attributes.key?(:'openai_total_iterations') self.openai_total_iterations = attributes[:'openai_total_iterations'] end if attributes.key?(:'optimization_type') self.optimization_type = attributes[:'optimization_type'] end if attributes.key?(:'p95_sessions_needed') self.p95_sessions_needed = attributes[:'p95_sessions_needed'] end if attributes.key?(:'p_value') self.p_value = attributes[:'p_value'] end if attributes.key?(:'session_count') self.session_count = attributes[:'session_count'] end if attributes.key?(:'start_dts') self.start_dts = attributes[:'start_dts'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'storefront_experiment_oid') self.storefront_experiment_oid = attributes[:'storefront_experiment_oid'] end if attributes.key?(:'storefront_oid') self.storefront_oid = attributes[:'storefront_oid'] end if attributes.key?(:'uri') self.uri = attributes[:'uri'] end if attributes.key?(:'variations') if (value = attributes[:'variations']).is_a?(Array) self.variations = value end end end |
Instance Attribute Details
#container_id ⇒ Object
Contained ID where the experiment element was located
19 20 21 |
# File 'lib/ultracart_api/models/experiment.rb', line 19 def container_id @container_id end |
#duration_days ⇒ Object
Duration in days
22 23 24 |
# File 'lib/ultracart_api/models/experiment.rb', line 22 def duration_days @duration_days end |
#end_dts ⇒ Object
End date/time
25 26 27 |
# File 'lib/ultracart_api/models/experiment.rb', line 25 def end_dts @end_dts end |
#equal_weighting ⇒ Object
Whether or not traffic is equally weighted or shifts over time during the experiment
28 29 30 |
# File 'lib/ultracart_api/models/experiment.rb', line 28 def equal_weighting @equal_weighting end |
#experiment_type ⇒ Object
The type of experiment
31 32 33 |
# File 'lib/ultracart_api/models/experiment.rb', line 31 def experiment_type @experiment_type end |
#id ⇒ Object
Experiment id
34 35 36 |
# File 'lib/ultracart_api/models/experiment.rb', line 34 def id @id end |
#name ⇒ Object
Experiment name
37 38 39 |
# File 'lib/ultracart_api/models/experiment.rb', line 37 def name @name end |
#notes ⇒ Object
Notes about the experiment
40 41 42 |
# File 'lib/ultracart_api/models/experiment.rb', line 40 def notes @notes end |
#objective ⇒ Object
Objective that is being optimized
43 44 45 |
# File 'lib/ultracart_api/models/experiment.rb', line 43 def objective @objective end |
#objective_parameter ⇒ Object
Objective parameter (such as event name) that is being optimized
46 47 48 |
# File 'lib/ultracart_api/models/experiment.rb', line 46 def objective_parameter @objective_parameter end |
#openai_current_iteration ⇒ Object
The current iteration of the OpenAI related experiment
49 50 51 |
# File 'lib/ultracart_api/models/experiment.rb', line 49 def openai_current_iteration @openai_current_iteration end |
#openai_element_type ⇒ Object
The type of OpenAI element being experimented on
52 53 54 |
# File 'lib/ultracart_api/models/experiment.rb', line 52 def openai_element_type @openai_element_type end |
#openai_model ⇒ Object
The type of OpenAI model used
55 56 57 |
# File 'lib/ultracart_api/models/experiment.rb', line 55 def openai_model @openai_model end |
#openai_total_iterations ⇒ Object
The total number of iterations to perform on the experiment
58 59 60 |
# File 'lib/ultracart_api/models/experiment.rb', line 58 def openai_total_iterations @openai_total_iterations end |
#optimization_type ⇒ Object
Type of optimization
61 62 63 |
# File 'lib/ultracart_api/models/experiment.rb', line 61 def optimization_type @optimization_type end |
#p95_sessions_needed ⇒ Object
Estimated sessions needed to achieve P95
64 65 66 |
# File 'lib/ultracart_api/models/experiment.rb', line 64 def p95_sessions_needed @p95_sessions_needed end |
#p_value ⇒ Object
Statistics p-value for the experiment
67 68 69 |
# File 'lib/ultracart_api/models/experiment.rb', line 67 def p_value @p_value end |
#session_count ⇒ Object
Total number of sessions in the experiment
70 71 72 |
# File 'lib/ultracart_api/models/experiment.rb', line 70 def session_count @session_count end |
#start_dts ⇒ Object
Start date/time
73 74 75 |
# File 'lib/ultracart_api/models/experiment.rb', line 73 def start_dts @start_dts end |
#status ⇒ Object
Status of the experiment
76 77 78 |
# File 'lib/ultracart_api/models/experiment.rb', line 76 def status @status end |
#storefront_experiment_oid ⇒ Object
Storefront Experiment Oid
79 80 81 |
# File 'lib/ultracart_api/models/experiment.rb', line 79 def storefront_experiment_oid @storefront_experiment_oid end |
#storefront_oid ⇒ Object
Storefront oid
82 83 84 |
# File 'lib/ultracart_api/models/experiment.rb', line 82 def storefront_oid @storefront_oid end |
#uri ⇒ Object
URI the experiment was started on
85 86 87 |
# File 'lib/ultracart_api/models/experiment.rb', line 85 def uri @uri end |
#variations ⇒ Object
Variations being tested in the experiment
88 89 90 |
# File 'lib/ultracart_api/models/experiment.rb', line 88 def variations @variations end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
143 144 145 |
# File 'lib/ultracart_api/models/experiment.rb', line 143 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/ultracart_api/models/experiment.rb', line 113 def self.attribute_map { :'container_id' => :'container_id', :'duration_days' => :'duration_days', :'end_dts' => :'end_dts', :'equal_weighting' => :'equal_weighting', :'experiment_type' => :'experiment_type', :'id' => :'id', :'name' => :'name', :'notes' => :'notes', :'objective' => :'objective', :'objective_parameter' => :'objective_parameter', :'openai_current_iteration' => :'openai_current_iteration', :'openai_element_type' => :'openai_element_type', :'openai_model' => :'openai_model', :'openai_total_iterations' => :'openai_total_iterations', :'optimization_type' => :'optimization_type', :'p95_sessions_needed' => :'p95_sessions_needed', :'p_value' => :'p_value', :'session_count' => :'session_count', :'start_dts' => :'start_dts', :'status' => :'status', :'storefront_experiment_oid' => :'storefront_experiment_oid', :'storefront_oid' => :'storefront_oid', :'uri' => :'uri', :'variations' => :'variations' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
380 381 382 |
# File 'lib/ultracart_api/models/experiment.rb', line 380 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
178 179 180 181 |
# File 'lib/ultracart_api/models/experiment.rb', line 178 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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/ultracart_api/models/experiment.rb', line 148 def self.openapi_types { :'container_id' => :'String', :'duration_days' => :'Integer', :'end_dts' => :'String', :'equal_weighting' => :'Boolean', :'experiment_type' => :'String', :'id' => :'String', :'name' => :'String', :'notes' => :'String', :'objective' => :'String', :'objective_parameter' => :'String', :'openai_current_iteration' => :'Integer', :'openai_element_type' => :'String', :'openai_model' => :'String', :'openai_total_iterations' => :'Integer', :'optimization_type' => :'String', :'p95_sessions_needed' => :'Integer', :'p_value' => :'Float', :'session_count' => :'Integer', :'start_dts' => :'String', :'status' => :'String', :'storefront_experiment_oid' => :'Integer', :'storefront_oid' => :'Integer', :'uri' => :'String', :'variations' => :'Array<ExperimentVariation>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/ultracart_api/models/experiment.rb', line 336 def ==(o) return true if self.equal?(o) self.class == o.class && container_id == o.container_id && duration_days == o.duration_days && end_dts == o.end_dts && equal_weighting == o.equal_weighting && experiment_type == o.experiment_type && id == o.id && name == o.name && notes == o.notes && objective == o.objective && objective_parameter == o.objective_parameter && openai_current_iteration == o.openai_current_iteration && openai_element_type == o.openai_element_type && openai_model == o.openai_model && openai_total_iterations == o.openai_total_iterations && optimization_type == o.optimization_type && p95_sessions_needed == o.p95_sessions_needed && p_value == o.p_value && session_count == o.session_count && start_dts == o.start_dts && status == o.status && storefront_experiment_oid == o.storefront_experiment_oid && storefront_oid == o.storefront_oid && uri == o.uri && variations == o.variations end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/ultracart_api/models/experiment.rb', line 411 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
482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/ultracart_api/models/experiment.rb', line 482 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
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/ultracart_api/models/experiment.rb', line 387 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
367 368 369 |
# File 'lib/ultracart_api/models/experiment.rb', line 367 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
373 374 375 |
# File 'lib/ultracart_api/models/experiment.rb', line 373 def hash [container_id, duration_days, end_dts, equal_weighting, experiment_type, id, name, notes, objective, objective_parameter, openai_current_iteration, openai_element_type, openai_model, openai_total_iterations, optimization_type, p95_sessions_needed, p_value, session_count, start_dts, status, storefront_experiment_oid, storefront_oid, uri, variations].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
299 300 301 302 |
# File 'lib/ultracart_api/models/experiment.rb', line 299 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
458 459 460 |
# File 'lib/ultracart_api/models/experiment.rb', line 458 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/ultracart_api/models/experiment.rb', line 464 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_s ⇒ String
Returns the string representation of the object
452 453 454 |
# File 'lib/ultracart_api/models/experiment.rb', line 452 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
306 307 308 309 310 311 312 |
# File 'lib/ultracart_api/models/experiment.rb', line 306 def valid? openai_element_type_validator = EnumAttributeValidator.new('String', ["headline", "text", "textblock"]) return false unless openai_element_type_validator.valid?(@openai_element_type) status_validator = EnumAttributeValidator.new('String', ["Running", "Ended", "Deleted"]) return false unless status_validator.valid?(@status) true end |