Class: NewDemoApiClient::ColumnsMetadataResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::ColumnsMetadataResponse
- Defined in:
- lib/test_sdk/types/columns_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.
-
#columns ⇒ Array<NewDemoApiClient::ColumnMetadata>
readonly
A list of column metadata.
-
#name_map ⇒ Hash{String => NewDemoApiClient::ColumnMetadata}
readonly
A mapping column names to their metadata for lookup convenience.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ColumnsMetadataResponse
Deserialize a JSON object to an instance of ColumnsMetadataResponse.
-
.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(columns:, name_map:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnsMetadataResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ColumnsMetadataResponse to a JSON object.
Constructor Details
#initialize(columns:, name_map:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnsMetadataResponse
25 26 27 28 29 30 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 25 def initialize(columns:, name_map:, additional_properties: nil) @columns = columns @name_map = name_map @additional_properties = additional_properties @_field_set = { "columns": columns, "name_map": name_map } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 14 def additional_properties @additional_properties end |
#columns ⇒ Array<NewDemoApiClient::ColumnMetadata> (readonly)
Returns A list of column metadata.
10 11 12 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 10 def columns @columns end |
#name_map ⇒ Hash{String => NewDemoApiClient::ColumnMetadata} (readonly)
Returns A mapping column names to their metadata for lookup convenience.
12 13 14 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 12 def name_map @name_map end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ColumnsMetadataResponse
Deserialize a JSON object to an instance of ColumnsMetadataResponse
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) columns = parsed_json["columns"]&.map do |item| item = item.to_json NewDemoApiClient::ColumnMetadata.from_json(json_object: item) end name_map = parsed_json["name_map"]&.transform_values do |value| value = value.to_json NewDemoApiClient::ColumnMetadata.from_json(json_object: value) end new( columns: columns, name_map: name_map, 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.
67 68 69 70 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 67 def self.validate_raw(obj:) obj.columns.is_a?(Array) != false || raise("Passed value for field obj.columns is not the expected type, validation failed.") obj.name_map.is_a?(Hash) != false || raise("Passed value for field obj.name_map is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ColumnsMetadataResponse to a JSON object
57 58 59 |
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 57 def to_json(*_args) @_field_set&.to_json end |