Class: NewDemoApiClient::ColumnMiniMetadata
- Inherits:
-
Object
- Object
- NewDemoApiClient::ColumnMiniMetadata
- Defined in:
- lib/test_sdk/types/column_mini_metadata.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#friendly_name ⇒ String
readonly
The friendly displayable name of the column.
-
#name ⇒ String
readonly
The name of the column.
-
#scaling ⇒ NewDemoApiClient::Scaling
readonly
The scaling type of the column.
-
#unit ⇒ NewDemoApiClient::Unit
readonly
The unit of the category.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::ColumnMiniMetadata
Deserialize a JSON object to an instance of ColumnMiniMetadata.
-
.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:, friendly_name:, unit:, scaling:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnMiniMetadata constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ColumnMiniMetadata to a JSON object.
Constructor Details
#initialize(name:, friendly_name:, unit:, scaling:, additional_properties: nil) ⇒ NewDemoApiClient::ColumnMiniMetadata
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_properties ⇒ OpenStruct (readonly)
Returns 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_name ⇒ String (readonly)
Returns 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 |
#name ⇒ String (readonly)
Returns The name of the column.
11 12 13 |
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 11 def name @name end |
#scaling ⇒ NewDemoApiClient::Scaling (readonly)
Returns 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 |
#unit ⇒ NewDemoApiClient::Unit (readonly)
Returns The unit of the category.
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
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.
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
66 67 68 |
# File 'lib/test_sdk/types/column_mini_metadata.rb', line 66 def to_json(*_args) @_field_set&.to_json end |