Class: NewDemoApiClient::ColumnsMetadataResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns:, name_map:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnsMetadataResponse

Parameters:

  • columns (Array<NewDemoApiClient::ColumnMetadata>)

    A list of column metadata.

  • name_map (Hash{String => NewDemoApiClient::ColumnMetadata})

    A mapping column names to their metadata for lookup convenience.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#columnsArray<NewDemoApiClient::ColumnMetadata> (readonly)

Returns A list of column metadata.

Returns:



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

def columns
  @columns
end

#name_mapHash{String => NewDemoApiClient::ColumnMetadata} (readonly)

Returns A mapping column names to their metadata for lookup convenience.

Returns:



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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


57
58
59
# File 'lib/test_sdk/types/columns_metadata_response.rb', line 57

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