Class: OCI::Opsi::Models::DataObjectColumnUnit
- Inherits:
-
Object
- Object
- OCI::Opsi::Models::DataObjectColumnUnit
- Defined in:
- lib/oci/opsi/models/data_object_column_unit.rb
Overview
Unit details of a data object column. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
DataObjectCoreColumnUnit, DataObjectCustomColumnUnit, DataObjectDataSizeColumnUnit, DataObjectFrequencyColumnUnit, DataObjectOtherStandardColumnUnit, DataObjectPowerColumnUnit, DataObjectRateColumnUnit, DataObjectTemperatureColumnUnit, DataObjectTimeColumnUnit
Constant Summary collapse
- UNIT_CATEGORY_ENUM =
[ UNIT_CATEGORY_DATA_SIZE = 'DATA_SIZE'.freeze, UNIT_CATEGORY_TIME = 'TIME'.freeze, UNIT_CATEGORY_POWER = 'POWER'.freeze, UNIT_CATEGORY_TEMPERATURE = 'TEMPERATURE'.freeze, UNIT_CATEGORY_CORE = 'CORE'.freeze, UNIT_CATEGORY_RATE = 'RATE'.freeze, UNIT_CATEGORY_FREQUENCY = 'FREQUENCY'.freeze, UNIT_CATEGORY_OTHER_STANDARD = 'OTHER_STANDARD'.freeze, UNIT_CATEGORY_CUSTOM = 'CUSTOM'.freeze, UNIT_CATEGORY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#display_name ⇒ String
Display name of the column's unit.
-
#unit_category ⇒ String
[Required] Category of the column's unit.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ DataObjectColumnUnit
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ DataObjectColumnUnit
Initializes the object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 85 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.unit_category = attributes[:'unitCategory'] if attributes[:'unitCategory'] raise 'You cannot provide both :unitCategory and :unit_category' if attributes.key?(:'unitCategory') && attributes.key?(:'unit_category') self.unit_category = attributes[:'unit_category'] if attributes[:'unit_category'] self.display_name = attributes[:'displayName'] if attributes[:'displayName'] raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] if attributes[:'display_name'] end |
Instance Attribute Details
#display_name ⇒ String
Display name of the column's unit.
32 33 34 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 32 def display_name @display_name end |
#unit_category ⇒ String
[Required] Category of the column's unit.
28 29 30 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 28 def unit_category @unit_category end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
35 36 37 38 39 40 41 42 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 35 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'unit_category': :'unitCategory', 'display_name': :'displayName' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 59 def self.get_subtype(object_hash) type = object_hash[:'unitCategory'] # rubocop:disable Style/SymbolLiteral return 'OCI::Opsi::Models::DataObjectCoreColumnUnit' if type == 'CORE' return 'OCI::Opsi::Models::DataObjectTimeColumnUnit' if type == 'TIME' return 'OCI::Opsi::Models::DataObjectOtherStandardColumnUnit' if type == 'OTHER_STANDARD' return 'OCI::Opsi::Models::DataObjectCustomColumnUnit' if type == 'CUSTOM' return 'OCI::Opsi::Models::DataObjectTemperatureColumnUnit' if type == 'TEMPERATURE' return 'OCI::Opsi::Models::DataObjectPowerColumnUnit' if type == 'POWER' return 'OCI::Opsi::Models::DataObjectRateColumnUnit' if type == 'RATE' return 'OCI::Opsi::Models::DataObjectFrequencyColumnUnit' if type == 'FREQUENCY' return 'OCI::Opsi::Models::DataObjectDataSizeColumnUnit' if type == 'DATA_SIZE' # TODO: Log a warning when the subtype is not found. 'OCI::Opsi::Models::DataObjectColumnUnit' end |
.swagger_types ⇒ Object
Attribute type mapping.
45 46 47 48 49 50 51 52 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 45 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'unit_category': :'String', 'display_name': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
124 125 126 127 128 129 130 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 124 def ==(other) return true if equal?(other) self.class == other.class && unit_category == other.unit_category && display_name == other.display_name end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 155 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
135 136 137 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 135 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
144 145 146 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 144 def hash [unit_category, display_name].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
188 189 190 191 192 193 194 195 196 197 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 188 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
182 183 184 |
# File 'lib/oci/opsi/models/data_object_column_unit.rb', line 182 def to_s to_hash.to_s end |