Class: OCI::Cims::Models::SubCategories
- Inherits:
-
Object
- Object
- OCI::Cims::Models::SubCategories
- Defined in:
- lib/oci/cims/models/sub_categories.rb
Overview
List of subcategories under a service.
Instance Attribute Summary collapse
-
#has_sub_category ⇒ String
Flag to identify if subComponent is present.
-
#schema ⇒ String
Schema of a subcategory.
-
#service_category ⇒ Hash<String, String>
Subcategory list.
-
#sub_categories ⇒ Array<OCI::Cims::Models::SubComponents>
The sub component list for MOS Taxonomy.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.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 = {}) ⇒ SubCategories
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 = {}) ⇒ SubCategories
Initializes the object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/oci/cims/models/sub_categories.rb', line 61 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.service_category = attributes[:'serviceCategory'] if attributes[:'serviceCategory'] raise 'You cannot provide both :serviceCategory and :service_category' if attributes.key?(:'serviceCategory') && attributes.key?(:'service_category') self.service_category = attributes[:'service_category'] if attributes[:'service_category'] self.schema = attributes[:'schema'] if attributes[:'schema'] self.has_sub_category = attributes[:'hasSubCategory'] if attributes[:'hasSubCategory'] raise 'You cannot provide both :hasSubCategory and :has_sub_category' if attributes.key?(:'hasSubCategory') && attributes.key?(:'has_sub_category') self.has_sub_category = attributes[:'has_sub_category'] if attributes[:'has_sub_category'] self.sub_categories = attributes[:'subCategories'] if attributes[:'subCategories'] raise 'You cannot provide both :subCategories and :sub_categories' if attributes.key?(:'subCategories') && attributes.key?(:'sub_categories') self.sub_categories = attributes[:'sub_categories'] if attributes[:'sub_categories'] end |
Instance Attribute Details
#has_sub_category ⇒ String
Flag to identify if subComponent is present
21 22 23 |
# File 'lib/oci/cims/models/sub_categories.rb', line 21 def has_sub_category @has_sub_category end |
#schema ⇒ String
Schema of a subcategory.
17 18 19 |
# File 'lib/oci/cims/models/sub_categories.rb', line 17 def schema @schema end |
#service_category ⇒ Hash<String, String>
Subcategory list.
13 14 15 |
# File 'lib/oci/cims/models/sub_categories.rb', line 13 def service_category @service_category end |
#sub_categories ⇒ Array<OCI::Cims::Models::SubComponents>
The sub component list for MOS Taxonomy.
25 26 27 |
# File 'lib/oci/cims/models/sub_categories.rb', line 25 def sub_categories @sub_categories end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/oci/cims/models/sub_categories.rb', line 28 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'service_category': :'serviceCategory', 'schema': :'schema', 'has_sub_category': :'hasSubCategory', 'sub_categories': :'subCategories' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/oci/cims/models/sub_categories.rb', line 40 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'service_category': :'Hash<String, String>', 'schema': :'String', 'has_sub_category': :'String', 'sub_categories': :'Array<OCI::Cims::Models::SubComponents>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
95 96 97 98 99 100 101 102 103 |
# File 'lib/oci/cims/models/sub_categories.rb', line 95 def ==(other) return true if equal?(other) self.class == other.class && service_category == other.service_category && schema == other.schema && has_sub_category == other.has_sub_category && sub_categories == other.sub_categories end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/oci/cims/models/sub_categories.rb', line 128 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
108 109 110 |
# File 'lib/oci/cims/models/sub_categories.rb', line 108 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
117 118 119 |
# File 'lib/oci/cims/models/sub_categories.rb', line 117 def hash [service_category, schema, has_sub_category, sub_categories].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/oci/cims/models/sub_categories.rb', line 161 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
155 156 157 |
# File 'lib/oci/cims/models/sub_categories.rb', line 155 def to_s to_hash.to_s end |