Class: LaunchDarklyApi::Experiment

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



162
163
164
165
166
167
168
169
170
171
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
# File 'lib/launchdarkly_api/models/experiment.rb', line 162

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_accessObject

Returns the value of attribute _access.



59
60
61
# File 'lib/launchdarkly_api/models/experiment.rb', line 59

def _access
  @_access
end

#_creation_dateObject

Returns the value of attribute _creation_date.



33
34
35
# File 'lib/launchdarkly_api/models/experiment.rb', line 33

def _creation_date
  @_creation_date
end

#_idObject

The experiment ID



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

def _id
  @_id
end

The location and content type of related resources



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

def _links
  @_links
end

#_maintainer_idObject

The ID of the member who maintains this experiment.



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

def _maintainer_id
  @_maintainer_id
end

#analysis_configObject

Returns the value of attribute analysis_config.



66
67
68
# File 'lib/launchdarkly_api/models/experiment.rb', line 66

def analysis_config
  @analysis_config
end

#archived_dateObject

Returns the value of attribute archived_date.



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

def archived_date
  @archived_date
end

#current_iterationObject

Returns the value of attribute current_iteration.



54
55
56
# File 'lib/launchdarkly_api/models/experiment.rb', line 54

def current_iteration
  @current_iteration
end

#data_sourceObject

The source of metric data in order to analyze results. Defaults to "launchdarkly" when not provided.



41
42
43
# File 'lib/launchdarkly_api/models/experiment.rb', line 41

def data_source
  @data_source
end

#descriptionObject

The experiment description



28
29
30
# File 'lib/launchdarkly_api/models/experiment.rb', line 28

def description
  @description
end

#draft_iterationObject

Returns the value of attribute draft_iteration.



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

def draft_iteration
  @draft_iteration
end

#environment_keyObject

Returns the value of attribute environment_key.



35
36
37
# File 'lib/launchdarkly_api/models/experiment.rb', line 35

def environment_key
  @environment_key
end

#holdout_idObject

The holdout ID



52
53
54
# File 'lib/launchdarkly_api/models/experiment.rb', line 52

def holdout_id
  @holdout_id
end

#keyObject

The experiment key



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

def key
  @key
end

#methodologyObject

The results analysis approach.



38
39
40
# File 'lib/launchdarkly_api/models/experiment.rb', line 38

def methodology
  @methodology
end

#mutable_fields_by_statusObject

Returns the value of attribute mutable_fields_by_status.



68
69
70
# File 'lib/launchdarkly_api/models/experiment.rb', line 68

def mutable_fields_by_status
  @mutable_fields_by_status
end

#nameObject

The experiment name



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

def name
  @name
end

#previous_iterationsObject

Details on the previous iterations for this experiment.



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

def previous_iterations
  @previous_iterations
end

#tagsObject

Tags for the experiment



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

def tags
  @tags
end

#typeObject

The experiment type



57
58
59
# File 'lib/launchdarkly_api/models/experiment.rb', line 57

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



119
120
121
# File 'lib/launchdarkly_api/models/experiment.rb', line 119

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



124
125
126
# File 'lib/launchdarkly_api/models/experiment.rb', line 124

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/launchdarkly_api/models/experiment.rb', line 93

def self.attribute_map
  {
    :'_id' => :'_id',
    :'key' => :'key',
    :'name' => :'name',
    :'description' => :'description',
    :'_maintainer_id' => :'_maintainerId',
    :'_creation_date' => :'_creationDate',
    :'environment_key' => :'environmentKey',
    :'methodology' => :'methodology',
    :'data_source' => :'dataSource',
    :'archived_date' => :'archivedDate',
    :'tags' => :'tags',
    :'_links' => :'_links',
    :'holdout_id' => :'holdoutId',
    :'current_iteration' => :'currentIteration',
    :'type' => :'type',
    :'_access' => :'_access',
    :'draft_iteration' => :'draftIteration',
    :'previous_iterations' => :'previousIterations',
    :'analysis_config' => :'analysisConfig',
    :'mutable_fields_by_status' => :'mutableFieldsByStatus'
  }
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



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/launchdarkly_api/models/experiment.rb', line 446

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



155
156
157
158
# File 'lib/launchdarkly_api/models/experiment.rb', line 155

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

.openapi_typesObject

Attribute type mapping.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/launchdarkly_api/models/experiment.rb', line 129

def self.openapi_types
  {
    :'_id' => :'String',
    :'key' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'_maintainer_id' => :'String',
    :'_creation_date' => :'Integer',
    :'environment_key' => :'String',
    :'methodology' => :'String',
    :'data_source' => :'String',
    :'archived_date' => :'Integer',
    :'tags' => :'Array<String>',
    :'_links' => :'Hash<String, Link>',
    :'holdout_id' => :'String',
    :'current_iteration' => :'IterationRep',
    :'type' => :'String',
    :'_access' => :'Access',
    :'draft_iteration' => :'IterationRep',
    :'previous_iterations' => :'Array<IterationRep>',
    :'analysis_config' => :'AnalysisConfigRep',
    :'mutable_fields_by_status' => :'MutableFieldsByStatusRep'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/launchdarkly_api/models/experiment.rb', line 406

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
      key == o.key &&
      name == o.name &&
      description == o.description &&
      _maintainer_id == o._maintainer_id &&
      _creation_date == o._creation_date &&
      environment_key == o.environment_key &&
      methodology == o.methodology &&
      data_source == o.data_source &&
      archived_date == o.archived_date &&
      tags == o.tags &&
      _links == o._links &&
      holdout_id == o.holdout_id &&
      current_iteration == o.current_iteration &&
      type == o.type &&
      _access == o._access &&
      draft_iteration == o.draft_iteration &&
      previous_iterations == o.previous_iterations &&
      analysis_config == o.analysis_config &&
      mutable_fields_by_status == o.mutable_fields_by_status
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


433
434
435
# File 'lib/launchdarkly_api/models/experiment.rb', line 433

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



439
440
441
# File 'lib/launchdarkly_api/models/experiment.rb', line 439

def hash
  [_id, key, name, description, _maintainer_id, _creation_date, environment_key, methodology, data_source, archived_date, tags, _links, holdout_id, current_iteration, type, _access, draft_iteration, previous_iterations, analysis_config, mutable_fields_by_status].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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



468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/launchdarkly_api/models/experiment.rb', line 468

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



309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/launchdarkly_api/models/experiment.rb', line 309

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @key.nil?
  return false if @name.nil?
  return false if @_maintainer_id.nil?
  return false if @_creation_date.nil?
  return false if @environment_key.nil?
  methodology_validator = EnumAttributeValidator.new('String', ["bayesian", "frequentist", "export_only"])
  return false unless methodology_validator.valid?(@methodology)
  data_source_validator = EnumAttributeValidator.new('String', ["launchdarkly", "snowflake"])
  return false unless data_source_validator.valid?(@data_source)
  return false if @_links.nil?
  true
end