Class: NewDemoApiClient::ModelMetadata
- Inherits:
-
Object
- Object
- NewDemoApiClient::ModelMetadata
- Defined in:
- lib/test_sdk/types/model_metadata.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#columns ⇒ Array<NewDemoApiClient::ColumnMiniMetadata>
readonly
The columns used in the model.
-
#description ⇒ String
readonly
A plain-english description of the model and what it represents.
-
#name ⇒ String
readonly
The name of the model.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ModelMetadata
Deserialize a JSON object to an instance of ModelMetadata.
-
.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:, description:, columns:, additional_properties: nil) ⇒ NewDemoApiClient::ModelMetadata constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ModelMetadata to a JSON object.
Constructor Details
#initialize(name:, description:, columns:, additional_properties: nil) ⇒ NewDemoApiClient::ModelMetadata
28 29 30 31 32 33 34 |
# File 'lib/test_sdk/types/model_metadata.rb', line 28 def initialize(name:, description:, columns:, additional_properties: nil) @name = name @description = description @columns = columns @additional_properties = additional_properties @_field_set = { "name": name, "description": description, "columns": columns } 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/model_metadata.rb', line 16 def additional_properties @additional_properties end |
#columns ⇒ Array<NewDemoApiClient::ColumnMiniMetadata> (readonly)
Returns The columns used in the model.
14 15 16 |
# File 'lib/test_sdk/types/model_metadata.rb', line 14 def columns @columns end |
#description ⇒ String (readonly)
Returns A plain-english description of the model and what it represents.
12 13 14 |
# File 'lib/test_sdk/types/model_metadata.rb', line 12 def description @description end |
#name ⇒ String (readonly)
Returns The name of the model.
10 11 12 |
# File 'lib/test_sdk/types/model_metadata.rb', line 10 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ModelMetadata
Deserialize a JSON object to an instance of ModelMetadata
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/test_sdk/types/model_metadata.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"] description = parsed_json["description"] columns = parsed_json["columns"]&.map do |item| item = item.to_json NewDemoApiClient::ColumnMiniMetadata.from_json(json_object: item) end new( name: name, description: description, columns: columns, 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/model_metadata.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.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.columns.is_a?(Array) != false || raise("Passed value for field obj.columns is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ModelMetadata to a JSON object
60 61 62 |
# File 'lib/test_sdk/types/model_metadata.rb', line 60 def to_json(*_args) @_field_set&.to_json end |