Class: NewDemoApiClient::ColumnMetadata
- Inherits:
-
Object
- Object
- NewDemoApiClient::ColumnMetadata
- Defined in:
- lib/test_sdk/types/column_metadata.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#cutoff ⇒ Float
readonly
The suggested cutoff value for the column.
-
#friendly_name ⇒ String
readonly
The friendly displayable name of the column.
-
#name ⇒ String
readonly
The name of the column.
-
#reverse ⇒ Boolean
readonly
Whether the column is expected to be higher or lower for better performance.
-
#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::ColumnMetadata
Deserialize a JSON object to an instance of ColumnMetadata.
-
.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:, reverse:, cutoff: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ColumnMetadata constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ColumnMetadata to a JSON object.
Constructor Details
#initialize(name:, friendly_name:, unit:, scaling:, reverse:, cutoff: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ColumnMetadata
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/test_sdk/types/column_metadata.rb', line 44 def initialize(name:, friendly_name:, unit:, scaling:, reverse:, cutoff: OMIT, additional_properties: nil) @name = name @friendly_name = friendly_name @unit = unit @scaling = scaling @reverse = reverse @cutoff = cutoff if cutoff != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "friendly_name": friendly_name, "unit": unit, "scaling": scaling, "reverse": reverse, "cutoff": cutoff }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
26 27 28 |
# File 'lib/test_sdk/types/column_metadata.rb', line 26 def additional_properties @additional_properties end |
#cutoff ⇒ Float (readonly)
Returns The suggested cutoff value for the column. This is a guideline for when the absolute value of the column is considered saturated.
24 25 26 |
# File 'lib/test_sdk/types/column_metadata.rb', line 24 def cutoff @cutoff end |
#friendly_name ⇒ String (readonly)
Returns The friendly displayable name of the column.
13 14 15 |
# File 'lib/test_sdk/types/column_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_metadata.rb', line 11 def name @name end |
#reverse ⇒ Boolean (readonly)
Returns Whether the column is expected to be higher or lower for better performance. False means higher is better, True means lower is better.
21 22 23 |
# File 'lib/test_sdk/types/column_metadata.rb', line 21 def reverse @reverse 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_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_metadata.rb', line 15 def unit @unit end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::ColumnMetadata
Deserialize a JSON object to an instance of ColumnMetadata
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/test_sdk/types/column_metadata.rb', line 68 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"] reverse = parsed_json["reverse"] cutoff = parsed_json["cutoff"] new( name: name, friendly_name: friendly_name, unit: unit, scaling: scaling, reverse: reverse, cutoff: cutoff, 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.
101 102 103 104 105 106 107 108 |
# File 'lib/test_sdk/types/column_metadata.rb', line 101 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.") obj.reverse.is_a?(Boolean) != false || raise("Passed value for field obj.reverse is not the expected type, validation failed.") obj.cutoff&.is_a?(Float) != false || raise("Passed value for field obj.cutoff is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ColumnMetadata to a JSON object
91 92 93 |
# File 'lib/test_sdk/types/column_metadata.rb', line 91 def to_json(*_args) @_field_set&.to_json end |