Class: Shipeasy::Admin::Generated::GetExperimentResponse

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/shipeasy_admin/models/get_experiment_response.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ GetExperimentResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
330
331
332
333
334
335
336
337
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 184

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

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  else
    self.description = nil
  end

  if attributes.key?(:'hypothesis')
    self.hypothesis = attributes[:'hypothesis']
  else
    self.hypothesis = nil
  end

  if attributes.key?(:'tag')
    self.tag = attributes[:'tag']
  else
    self.tag = nil
  end

  if attributes.key?(:'owner_email')
    self.owner_email = attributes[:'owner_email']
  else
    self.owner_email = nil
  end

  if attributes.key?(:'audience')
    self.audience = attributes[:'audience']
  else
    self.audience = nil
  end

  if attributes.key?(:'bucket_by')
    self.bucket_by = attributes[:'bucket_by']
  else
    self.bucket_by = nil
  end

  if attributes.key?(:'folder')
    self.folder = attributes[:'folder']
  else
    self.folder = nil
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'universe')
    self.universe = attributes[:'universe']
  else
    self.universe = nil
  end

  if attributes.key?(:'targeting_gate')
    self.targeting_gate = attributes[:'targeting_gate']
  else
    self.targeting_gate = nil
  end

  if attributes.key?(:'allocation_pct')
    self.allocation_pct = attributes[:'allocation_pct']
  else
    self.allocation_pct = nil
  end

  if attributes.key?(:'salt')
    self.salt = attributes[:'salt']
  else
    self.salt = nil
  end

  if attributes.key?(:'params')
    if (value = attributes[:'params']).is_a?(Hash)
      self.params = value
    end
  else
    self.params = nil
  end

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

  if attributes.key?(:'significance_threshold')
    self.significance_threshold = attributes[:'significance_threshold']
  else
    self.significance_threshold = nil
  end

  if attributes.key?(:'min_runtime_days')
    self.min_runtime_days = attributes[:'min_runtime_days']
  else
    self.min_runtime_days = nil
  end

  if attributes.key?(:'min_sample_size')
    self.min_sample_size = attributes[:'min_sample_size']
  else
    self.min_sample_size = nil
  end

  if attributes.key?(:'sequential_testing')
    self.sequential_testing = attributes[:'sequential_testing']
  else
    self.sequential_testing = nil
  end

  if attributes.key?(:'started_at')
    self.started_at = attributes[:'started_at']
  else
    self.started_at = nil
  end

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

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#allocation_pctObject

Allocation in basis points (0–10000).



47
48
49
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 47

def allocation_pct
  @allocation_pct
end

#audienceObject

Returns the value of attribute audience.



32
33
34
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 32

def audience
  @audience
end

#bucket_byObject

User-attribute name used as the bucketing key — e.g. user_id (default), session_id, device_id, or a custom attribute like company_id to keep a whole org on one variant. Defaults to user_id when omitted.



35
36
37
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 35

def bucket_by
  @bucket_by
end

#descriptionObject

Returns the value of attribute description.



24
25
26
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 24

def description
  @description
end

#folderObject

Returns the value of attribute folder.



37
38
39
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 37

def folder
  @folder
end

#groupsObject

Returns the value of attribute groups.



54
55
56
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 54

def groups
  @groups
end

#hypothesisObject

Returns the value of attribute hypothesis.



26
27
28
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 26

def hypothesis
  @hypothesis
end

#idObject

Stable opaque experiment id (exp_…).



19
20
21
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 19

def id
  @id
end

#min_runtime_daysObject

Returns the value of attribute min_runtime_days.



59
60
61
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 59

def min_runtime_days
  @min_runtime_days
end

#min_sample_sizeObject

Returns the value of attribute min_sample_size.



61
62
63
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 61

def min_sample_size
  @min_sample_size
end

#nameObject

Stable experiment key. Single segment or folder.name (a-z, 0-9, _/-; max 128 chars). Used by SDKs as Shipeasy.getExperiment(user, '<name>'). Immutable after create.



22
23
24
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 22

def name
  @name
end

#owner_emailObject

Returns the value of attribute owner_email.



30
31
32
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 30

def owner_email
  @owner_email
end

#paramsObject

Returns the value of attribute params.



52
53
54
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 52

def params
  @params
end

#saltObject

Optional gate name. Only callers that pass the gate are enrolled in the experiment.



50
51
52
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 50

def salt
  @salt
end

#sequential_testingObject

Returns the value of attribute sequential_testing.



63
64
65
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 63

def sequential_testing
  @sequential_testing
end

#significance_thresholdObject

Minimum detectable effect (relative, 0–1) for power planning. null to omit.



57
58
59
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 57

def significance_threshold
  @significance_threshold
end

#started_atObject

ISO-8601 timestamp the experiment last transitioned to running, or null.



66
67
68
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 66

def started_at
  @started_at
end

#statusObject

Returns the value of attribute status.



39
40
41
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 39

def status
  @status
end

#stopped_atObject

Returns the value of attribute stopped_at.



68
69
70
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 68

def stopped_at
  @stopped_at
end

#tagObject

Returns the value of attribute tag.



28
29
30
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 28

def tag
  @tag
end

#targeting_gateObject

Returns the value of attribute targeting_gate.



44
45
46
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 44

def targeting_gate
  @targeting_gate
end

#universeObject

Universe name this experiment draws from.



42
43
44
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 42

def universe
  @universe
end

#updated_atObject

Optional gate name. Only callers that pass the gate are enrolled in the experiment.



71
72
73
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 71

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



125
126
127
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 125

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



130
131
132
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 130

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 96

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'description' => :'description',
    :'hypothesis' => :'hypothesis',
    :'tag' => :'tag',
    :'owner_email' => :'ownerEmail',
    :'audience' => :'audience',
    :'bucket_by' => :'bucketBy',
    :'folder' => :'folder',
    :'status' => :'status',
    :'universe' => :'universe',
    :'targeting_gate' => :'targetingGate',
    :'allocation_pct' => :'allocationPct',
    :'salt' => :'salt',
    :'params' => :'params',
    :'groups' => :'groups',
    :'significance_threshold' => :'significanceThreshold',
    :'min_runtime_days' => :'minRuntimeDays',
    :'min_sample_size' => :'minSampleSize',
    :'sequential_testing' => :'sequentialTesting',
    :'started_at' => :'startedAt',
    :'stopped_at' => :'stoppedAt',
    :'updated_at' => :'updatedAt'
  }
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



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 650

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_nullableObject

List of attributes with nullable: true



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 164

def self.openapi_nullable
  Set.new([
    :'description',
    :'hypothesis',
    :'tag',
    :'owner_email',
    :'audience',
    :'bucket_by',
    :'folder',
    :'targeting_gate',
    :'salt',
    :'significance_threshold',
    :'started_at',
    :'stopped_at',
    :'updated_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 135

def self.openapi_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'hypothesis' => :'String',
    :'tag' => :'String',
    :'owner_email' => :'String',
    :'audience' => :'String',
    :'bucket_by' => :'String',
    :'folder' => :'String',
    :'status' => :'String',
    :'universe' => :'String',
    :'targeting_gate' => :'String',
    :'allocation_pct' => :'Integer',
    :'salt' => :'String',
    :'params' => :'Hash<String, String>',
    :'groups' => :'Array<ListExperimentsResponseDataInnerGroupsInner>',
    :'significance_threshold' => :'Float',
    :'min_runtime_days' => :'Integer',
    :'min_sample_size' => :'Integer',
    :'sequential_testing' => :'Boolean',
    :'started_at' => :'String',
    :'stopped_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 607

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      description == o.description &&
      hypothesis == o.hypothesis &&
      tag == o.tag &&
      owner_email == o.owner_email &&
      audience == o.audience &&
      bucket_by == o.bucket_by &&
      folder == o.folder &&
      status == o.status &&
      universe == o.universe &&
      targeting_gate == o.targeting_gate &&
      allocation_pct == o.allocation_pct &&
      salt == o.salt &&
      params == o.params &&
      groups == o.groups &&
      significance_threshold == o.significance_threshold &&
      min_runtime_days == o.min_runtime_days &&
      min_sample_size == o.min_sample_size &&
      sequential_testing == o.sequential_testing &&
      started_at == o.started_at &&
      stopped_at == o.stopped_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


637
638
639
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 637

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



643
644
645
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 643

def hash
  [id, name, description, hypothesis, tag, owner_email, audience, bucket_by, folder, status, universe, targeting_gate, allocation_pct, salt, params, groups, significance_threshold, min_runtime_days, min_sample_size, sequential_testing, started_at, stopped_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
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
385
386
387
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
426
427
428
429
430
431
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 341

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

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

  if @name.to_s.length > 128
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 128.')
  end

  pattern = Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
  if @name !~ pattern
    invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
  end

  if @bucket_by.to_s.length > 128
    invalid_properties.push('invalid value for "bucket_by", the character length must be smaller than or equal to 128.')
  end

  if @bucket_by.to_s.length < 1
    invalid_properties.push('invalid value for "bucket_by", the character length must be greater than or equal to 1.')
  end

  pattern = Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
  if @bucket_by !~ pattern
    invalid_properties.push("invalid value for \"bucket_by\", must conform to the pattern #{pattern}.")
  end

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

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

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

  if @allocation_pct > 9007199254740991
    invalid_properties.push('invalid value for "allocation_pct", must be smaller than or equal to 9007199254740991.')
  end

  if @allocation_pct < -9007199254740991
    invalid_properties.push('invalid value for "allocation_pct", must be greater than or equal to -9007199254740991.')
  end

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

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

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

  if @min_runtime_days > 9007199254740991
    invalid_properties.push('invalid value for "min_runtime_days", must be smaller than or equal to 9007199254740991.')
  end

  if @min_runtime_days < -9007199254740991
    invalid_properties.push('invalid value for "min_runtime_days", must be greater than or equal to -9007199254740991.')
  end

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

  if @min_sample_size > 9007199254740991
    invalid_properties.push('invalid value for "min_sample_size", must be smaller than or equal to 9007199254740991.')
  end

  if @min_sample_size < -9007199254740991
    invalid_properties.push('invalid value for "min_sample_size", must be greater than or equal to -9007199254740991.')
  end

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 672

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

Returns:

  • (Boolean)

    true if the model is valid



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
# File 'lib/shipeasy_admin/models/get_experiment_response.rb', line 435

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @name.nil?
  return false if @name.to_s.length > 128
  return false if @name !~ Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
  return false if @bucket_by.to_s.length > 128
  return false if @bucket_by.to_s.length < 1
  return false if @bucket_by !~ Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["draft", "running", "stopped", "archived"])
  return false unless status_validator.valid?(@status)
  return false if @universe.nil?
  return false if @allocation_pct.nil?
  return false if @allocation_pct > 9007199254740991
  return false if @allocation_pct < -9007199254740991
  return false if @params.nil?
  return false if @groups.nil?
  return false if @min_runtime_days.nil?
  return false if @min_runtime_days > 9007199254740991
  return false if @min_runtime_days < -9007199254740991
  return false if @min_sample_size.nil?
  return false if @min_sample_size > 9007199254740991
  return false if @min_sample_size < -9007199254740991
  return false if @sequential_testing.nil?
  true
end