Class: NewDemoApiClient::ModelsMetadataResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::ModelsMetadataResponse
- Defined in:
- lib/test_sdk/types/models_metadata_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#available_models ⇒ Array<NewDemoApiClient::ModelMetadata>
readonly
A list of implementations and variants of this class of models.
-
#model_description ⇒ String
readonly
A plain-english description of the class of models and what they represent.
-
#name ⇒ String
readonly
The name of the class of models.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ModelsMetadataResponse
Deserialize a JSON object to an instance of ModelsMetadataResponse.
-
.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.
Instance Method Summary collapse
- #initialize(name:, model_description:, available_models:, additional_properties: nil) ⇒ NewDemoApiClient::ModelsMetadataResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ModelsMetadataResponse to a JSON object.
Constructor Details
#initialize(name:, model_description:, available_models:, additional_properties: nil) ⇒ NewDemoApiClient::ModelsMetadataResponse
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_properties ⇒ OpenStruct (readonly)
Returns 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_models ⇒ Array<NewDemoApiClient::ModelMetadata> (readonly)
Returns A list of implementations and variants of this class of models.
14 15 16 |
# File 'lib/test_sdk/types/models_metadata_response.rb', line 14 def available_models @available_models end |
#model_description ⇒ String (readonly)
Returns 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 |
#name ⇒ String (readonly)
Returns 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
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.
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
60 61 62 |
# File 'lib/test_sdk/types/models_metadata_response.rb', line 60 def to_json(*_args) @_field_set&.to_json end |