Class: NewDemoApiClient::ModelsMetadataResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, model_description:, available_models:, additional_properties: nil) ⇒ NewDemoApiClient::ModelsMetadataResponse

Parameters:

  • name (String)

    The name of the class of models.

  • model_description (String)

    A plain-english description of the class of models and what they represent.

  • available_models (Array<NewDemoApiClient::ModelMetadata>)

    A list of implementations and variants of this class of models.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(name:, model_description:, available_models:, additional_properties: nil)
  @name = name
  @model_description = model_description
  @available_models = available_models
  @additional_properties = additional_properties
  @_field_set = { "name": name, "model_description": model_description, "available_models": available_models }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/test_sdk/types/models_metadata_response.rb', line 16

def additional_properties
  @additional_properties
end

#available_modelsArray<NewDemoApiClient::ModelMetadata> (readonly)

Returns A list of implementations and variants of this class of models.

Returns:



14
15
16
# File 'lib/test_sdk/types/models_metadata_response.rb', line 14

def available_models
  @available_models
end

#model_descriptionString (readonly)

Returns A plain-english description of the class of models and what they represent.

Returns:

  • (String)

    A plain-english description of the class of models and what they represent.



12
13
14
# File 'lib/test_sdk/types/models_metadata_response.rb', line 12

def model_description
  @model_description
end

#nameString (readonly)

Returns The name of the class of models.

Returns:

  • (String)

    The name of the class of models.



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

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::ModelsMetadataResponse

Deserialize a JSON object to an instance of ModelsMetadataResponse

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/test_sdk/types/models_metadata_response.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  model_description = parsed_json["model_description"]
  available_models = parsed_json["available_models"]&.map do |item|
    item = item.to_json
    NewDemoApiClient::ModelMetadata.from_json(json_object: item)
  end
  new(
    name: name,
    model_description: model_description,
    available_models: available_models,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
74
# File 'lib/test_sdk/types/models_metadata_response.rb', line 70

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ModelsMetadataResponse to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/test_sdk/types/models_metadata_response.rb', line 60

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