Class: LaunchDarklyApi::AgentOptimizationResultPatch

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#activityObject

Returns the value of attribute activity.



20
21
22
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 20

def activity
  @activity
end

#completion_responseObject

Returns the value of attribute completion_response.



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

def completion_response
  @completion_response
end

#created_variation_keyObject

Returns the value of attribute created_variation_key.



36
37
38
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 36

def created_variation_key
  @created_variation_key
end

#evaluation_latenciesObject

Returns the value of attribute evaluation_latencies.



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

def evaluation_latencies
  @evaluation_latencies
end

#evaluation_tokensObject

Returns the value of attribute evaluation_tokens.



30
31
32
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 30

def evaluation_tokens
  @evaluation_tokens
end

#generation_latencyObject

Returns the value of attribute generation_latency.



32
33
34
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 32

def generation_latency
  @generation_latency
end

#generation_tokensObject

Returns the value of attribute generation_tokens.



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

def generation_tokens
  @generation_tokens
end

#scoresObject

Returns the value of attribute scores.



26
27
28
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 26

def scores
  @scores
end

#statusObject

Returns the value of attribute status.



18
19
20
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 18

def status
  @status
end

#variationObject

Returns the value of attribute variation.



24
25
26
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 24

def variation
  @variation
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



77
78
79
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 77

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



82
83
84
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 82

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 61

def self.attribute_map
  {
    :'status' => :'status',
    :'activity' => :'activity',
    :'completion_response' => :'completionResponse',
    :'variation' => :'variation',
    :'scores' => :'scores',
    :'generation_tokens' => :'generationTokens',
    :'evaluation_tokens' => :'evaluationTokens',
    :'generation_latency' => :'generationLatency',
    :'evaluation_latencies' => :'evaluationLatencies',
    :'created_variation_key' => :'createdVariationKey'
  }
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



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 222

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



103
104
105
106
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 103

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

.openapi_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 87

def self.openapi_types
  {
    :'status' => :'AgentOptimizationResultStatus',
    :'activity' => :'AgentOptimizationResultActivity',
    :'completion_response' => :'String',
    :'variation' => :'Hash<String, Object>',
    :'scores' => :'Hash<String, Object>',
    :'generation_tokens' => :'Hash<String, Object>',
    :'evaluation_tokens' => :'Hash<String, Object>',
    :'generation_latency' => :'Integer',
    :'evaluation_latencies' => :'Hash<String, Object>',
    :'created_variation_key' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 192

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      status == o.status &&
      activity == o.activity &&
      completion_response == o.completion_response &&
      variation == o.variation &&
      scores == o.scores &&
      generation_tokens == o.generation_tokens &&
      evaluation_tokens == o.evaluation_tokens &&
      generation_latency == o.generation_latency &&
      evaluation_latencies == o.evaluation_latencies &&
      created_variation_key == o.created_variation_key
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


209
210
211
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 209

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



215
216
217
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 215

def hash
  [status, activity, completion_response, variation, scores, generation_tokens, evaluation_tokens, generation_latency, evaluation_latencies, created_variation_key].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



177
178
179
180
181
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 177

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 244

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



185
186
187
188
# File 'lib/launchdarkly_api/models/agent_optimization_result_patch.rb', line 185

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end