Class: NewDemoApiClient::AvailableModelsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/available_models_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scaling:, tradeoff_at_scale:, additional_properties: nil) ⇒ NewDemoApiClient::AvailableModelsResponse



28
29
30
31
32
33
# File 'lib/test_sdk/types/available_models_response.rb', line 28

def initialize(scaling:, tradeoff_at_scale:, additional_properties: nil)
  @scaling = scaling
  @tradeoff_at_scale = tradeoff_at_scale
  @additional_properties = additional_properties
  @_field_set = { "scaling": scaling, "tradeoff_at_scale": tradeoff_at_scale }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



15
16
17
# File 'lib/test_sdk/types/available_models_response.rb', line 15

def additional_properties
  @additional_properties
end

#scalingArray<String> (readonly)



10
11
12
# File 'lib/test_sdk/types/available_models_response.rb', line 10

def scaling
  @scaling
end

#tradeoff_at_scaleArray<String> (readonly)



13
14
15
# File 'lib/test_sdk/types/available_models_response.rb', line 13

def tradeoff_at_scale
  @tradeoff_at_scale
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::AvailableModelsResponse

Deserialize a JSON object to an instance of AvailableModelsResponse



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/test_sdk/types/available_models_response.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  scaling = parsed_json["scaling"]
  tradeoff_at_scale = parsed_json["tradeoff_at_scale"]
  new(
    scaling: scaling,
    tradeoff_at_scale: tradeoff_at_scale,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.


64
65
66
67
# File 'lib/test_sdk/types/available_models_response.rb', line 64

def self.validate_raw(obj:)
  obj.scaling.is_a?(Array) != false || raise("Passed value for field obj.scaling is not the expected type, validation failed.")
  obj.tradeoff_at_scale.is_a?(Array) != false || raise("Passed value for field obj.tradeoff_at_scale is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AvailableModelsResponse to a JSON object



54
55
56
# File 'lib/test_sdk/types/available_models_response.rb', line 54

def to_json(*_args)
  @_field_set&.to_json
end