Class: LaunchDarklyApi::IterationRep

Inherits:
ApiModelBase show all
Defined in:
lib/launchdarkly_api/models/iteration_rep.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 = {}) ⇒ IterationRep

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 172

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_idObject

The iteration ID



19
20
21
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 19

def _id
  @_id
end

#attributesObject

The available attribute filters for this iteration



61
62
63
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 61

def attributes
  @attributes
end

#can_reshuffle_trafficObject

Whether the experiment may reassign traffic to different variations when the experiment audience changes (true) or must keep all traffic assigned to its initial variation (false).



40
41
42
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 40

def can_reshuffle_traffic
  @can_reshuffle_traffic
end

#covariate_infoObject

Returns the value of attribute covariate_info.



74
75
76
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 74

def covariate_info
  @covariate_info
end

#created_atObject

Returns the value of attribute created_at.



27
28
29
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 27

def created_at
  @created_at
end

#ended_atObject

Returns the value of attribute ended_at.



31
32
33
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 31

def ended_at
  @ended_at
end

#flagsObject

Details on the flag used in this experiment



43
44
45
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 43

def flags
  @flags
end

#hypothesisObject

The expected outcome of this experiment



22
23
24
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 22

def hypothesis
  @hypothesis
end

#layer_snapshotObject

Returns the value of attribute layer_snapshot.



72
73
74
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 72

def layer_snapshot
  @layer_snapshot
end

#metricsObject

Details on the metrics for this experiment



70
71
72
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 70

def metrics
  @metrics
end

#primary_funnelObject

Returns the value of attribute primary_funnel.



55
56
57
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 55

def primary_funnel
  @primary_funnel
end

#primary_metricObject

Returns the value of attribute primary_metric.



51
52
53
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 51

def primary_metric
  @primary_metric
end

#primary_single_metricObject

Returns the value of attribute primary_single_metric.



53
54
55
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 53

def primary_single_metric
  @primary_single_metric
end

#randomization_unitObject

The unit of randomization for this iteration



58
59
60
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 58

def randomization_unit
  @randomization_unit
end

#reallocation_frequency_millisObject

The cadence (in milliseconds) to update the allocation. Only present for multi-armed bandits.



46
47
48
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 46

def reallocation_frequency_millis
  @reallocation_frequency_millis
end

#secondary_metricsObject

Deprecated, use metrics instead. Details on the secondary metrics for this experiment.



67
68
69
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 67

def secondary_metrics
  @secondary_metrics
end

#started_atObject

Returns the value of attribute started_at.



29
30
31
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 29

def started_at
  @started_at
end

#statusObject

The status of the iteration: not_started, running, stopped



25
26
27
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 25

def status
  @status
end

#treatmentsObject

Details on the variations you are testing in the experiment



64
65
66
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 64

def treatments
  @treatments
end

#versionObject

The current version that the iteration is on



49
50
51
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 49

def version
  @version
end

#winning_reasonObject

The reason you stopped the experiment



37
38
39
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 37

def winning_reason
  @winning_reason
end

#winning_treatment_idObject

The ID of the treatment chosen when the experiment stopped



34
35
36
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 34

def winning_treatment_id
  @winning_treatment_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



127
128
129
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 127

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



132
133
134
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 132

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 99

def self.attribute_map
  {
    :'_id' => :'_id',
    :'hypothesis' => :'hypothesis',
    :'status' => :'status',
    :'created_at' => :'createdAt',
    :'started_at' => :'startedAt',
    :'ended_at' => :'endedAt',
    :'winning_treatment_id' => :'winningTreatmentId',
    :'winning_reason' => :'winningReason',
    :'can_reshuffle_traffic' => :'canReshuffleTraffic',
    :'flags' => :'flags',
    :'reallocation_frequency_millis' => :'reallocationFrequencyMillis',
    :'version' => :'version',
    :'primary_metric' => :'primaryMetric',
    :'primary_single_metric' => :'primarySingleMetric',
    :'primary_funnel' => :'primaryFunnel',
    :'randomization_unit' => :'randomizationUnit',
    :'attributes' => :'attributes',
    :'treatments' => :'treatments',
    :'secondary_metrics' => :'secondaryMetrics',
    :'metrics' => :'metrics',
    :'layer_snapshot' => :'layerSnapshot',
    :'covariate_info' => :'covariateInfo'
  }
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



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 397

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



165
166
167
168
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 165

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 137

def self.openapi_types
  {
    :'_id' => :'String',
    :'hypothesis' => :'String',
    :'status' => :'String',
    :'created_at' => :'Integer',
    :'started_at' => :'Integer',
    :'ended_at' => :'Integer',
    :'winning_treatment_id' => :'String',
    :'winning_reason' => :'String',
    :'can_reshuffle_traffic' => :'Boolean',
    :'flags' => :'Hash<String, FlagRep>',
    :'reallocation_frequency_millis' => :'Integer',
    :'version' => :'Integer',
    :'primary_metric' => :'DependentMetricOrMetricGroupRep',
    :'primary_single_metric' => :'MetricV2Rep',
    :'primary_funnel' => :'DependentMetricGroupRepWithMetrics',
    :'randomization_unit' => :'String',
    :'attributes' => :'Array<String>',
    :'treatments' => :'Array<TreatmentRep>',
    :'secondary_metrics' => :'Array<MetricV2Rep>',
    :'metrics' => :'Array<DependentMetricOrMetricGroupRep>',
    :'layer_snapshot' => :'LayerSnapshotRep',
    :'covariate_info' => :'CovariateInfoRep'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 355

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
      hypothesis == o.hypothesis &&
      status == o.status &&
      created_at == o.created_at &&
      started_at == o.started_at &&
      ended_at == o.ended_at &&
      winning_treatment_id == o.winning_treatment_id &&
      winning_reason == o.winning_reason &&
      can_reshuffle_traffic == o.can_reshuffle_traffic &&
      flags == o.flags &&
      reallocation_frequency_millis == o.reallocation_frequency_millis &&
      version == o.version &&
      primary_metric == o.primary_metric &&
      primary_single_metric == o.primary_single_metric &&
      primary_funnel == o.primary_funnel &&
      randomization_unit == o.randomization_unit &&
      attributes == o.attributes &&
      treatments == o.treatments &&
      secondary_metrics == o.secondary_metrics &&
      metrics == o.metrics &&
      layer_snapshot == o.layer_snapshot &&
      covariate_info == o.covariate_info
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


384
385
386
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 384

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



390
391
392
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 390

def hash
  [_id, hypothesis, status, created_at, started_at, ended_at, winning_treatment_id, winning_reason, can_reshuffle_traffic, flags, reallocation_frequency_millis, version, primary_metric, primary_single_metric, primary_funnel, randomization_unit, attributes, treatments, secondary_metrics, metrics, layer_snapshot, covariate_info].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 293

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

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

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



419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 419

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



313
314
315
316
317
318
319
320
321
# File 'lib/launchdarkly_api/models/iteration_rep.rb', line 313

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @hypothesis.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["not_started", "running", "stopped"])
  return false unless status_validator.valid?(@status)
  return false if @created_at.nil?
  true
end