Class: NewDemoApiClient::ColumnMiniMetadata

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, friendly_name:, unit:, scaling:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnMiniMetadata

Parameters:

  • name (String)

    The name of the column.

  • friendly_name (String)

    The friendly displayable name of the column.

  • unit (NewDemoApiClient::Unit)

    The unit of the category.

  • scaling (NewDemoApiClient::Scaling)

    The scaling type of the column. Geometric indicates exponential changes are expected, while arithmetic indicates linear changes.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 34

def initialize(name:, friendly_name:, unit:, scaling:, additional_properties: nil)
  @name = name
  @friendly_name = friendly_name
  @unit = unit
  @scaling = scaling
  @additional_properties = additional_properties
  @_field_set = { "name": name, "friendly_name": friendly_name, "unit": unit, "scaling": scaling }
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



20
21
22
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 20

def additional_properties
  @additional_properties
end

#friendly_nameString (readonly)

Returns The friendly displayable name of the column.

Returns:

  • (String)

    The friendly displayable name of the column.



13
14
15
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 13

def friendly_name
  @friendly_name
end

#nameString (readonly)

Returns The name of the column.

Returns:

  • (String)

    The name of the column.



11
12
13
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 11

def name
  @name
end

#scalingNewDemoApiClient::Scaling (readonly)

Returns The scaling type of the column. Geometric indicates exponential changes are expected, while arithmetic indicates linear changes.

Returns:

  • (NewDemoApiClient::Scaling)

    The scaling type of the column. Geometric indicates exponential changes are expected, while arithmetic indicates linear changes.



18
19
20
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 18

def scaling
  @scaling
end

#unitNewDemoApiClient::Unit (readonly)

Returns The unit of the category.

Returns:



15
16
17
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 15

def unit
  @unit
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::ColumnMiniMetadata

Deserialize a JSON object to an instance of ColumnMiniMetadata

Parameters:

  • json_object (String)

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 47

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  friendly_name = parsed_json["friendly_name"]
  unit = parsed_json["unit"]
  scaling = parsed_json["scaling"]
  new(
    name: name,
    friendly_name: friendly_name,
    unit: unit,
    scaling: scaling,
    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)


76
77
78
79
80
81
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 76

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.friendly_name.is_a?(String) != false || raise("Passed value for field obj.friendly_name is not the expected type, validation failed.")
  obj.unit.is_a?(NewDemoApiClient::Unit) != false || raise("Passed value for field obj.unit is not the expected type, validation failed.")
  obj.scaling.is_a?(NewDemoApiClient::Scaling) != false || raise("Passed value for field obj.scaling is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ColumnMiniMetadata to a JSON object

Returns:

  • (String)


66
67
68
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 66

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