Class: ConnectWise::CorporateStructure
- Inherits:
-
Object
- Object
- ConnectWise::CorporateStructure
- Defined in:
- lib/connectwise-ruby-sdk/models/corporate_structure.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Metadata of the entity.
-
#base_currency ⇒ Object
Returns the value of attribute base_currency.
-
#chief_operating_officer ⇒ Object
Returns the value of attribute chief_operating_officer.
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#dispatcher ⇒ Object
Returns the value of attribute dispatcher.
-
#duty_manager ⇒ Object
Returns the value of attribute duty_manager.
-
#fiscal_year_start ⇒ Object
Returns the value of attribute fiscal_year_start.
-
#group_caption ⇒ Object
Returns the value of attribute group_caption.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level1_name ⇒ Object
Returns the value of attribute level1_name.
-
#level2_name ⇒ Object
Returns the value of attribute level2_name.
-
#level3_name ⇒ Object
Returns the value of attribute level3_name.
-
#level4_name ⇒ Object
Returns the value of attribute level4_name.
-
#level5_name ⇒ Object
Returns the value of attribute level5_name.
-
#level_count ⇒ Object
Returns the value of attribute level_count.
-
#location_caption ⇒ Object
Returns the value of attribute location_caption.
-
#president ⇒ Object
Returns the value of attribute president.
-
#service_manager ⇒ Object
Returns the value of attribute service_manager.
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
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CorporateStructure
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CorporateStructure
Initializes the object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 116 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} if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'levelCount') self.level_count = attributes[:'levelCount'] end if attributes.has_key?(:'level1Name') self.level1_name = attributes[:'level1Name'] end if attributes.has_key?(:'level2Name') self.level2_name = attributes[:'level2Name'] end if attributes.has_key?(:'level3Name') self.level3_name = attributes[:'level3Name'] end if attributes.has_key?(:'level4Name') self.level4_name = attributes[:'level4Name'] end if attributes.has_key?(:'level5Name') self.level5_name = attributes[:'level5Name'] end if attributes.has_key?(:'fiscalYearStart') self.fiscal_year_start = attributes[:'fiscalYearStart'] end if attributes.has_key?(:'locationCaption') self.location_caption = attributes[:'locationCaption'] end if attributes.has_key?(:'groupCaption') self.group_caption = attributes[:'groupCaption'] end if attributes.has_key?(:'baseCurrency') self.base_currency = attributes[:'baseCurrency'] end if attributes.has_key?(:'president') self.president = attributes[:'president'] end if attributes.has_key?(:'chiefOperatingOfficer') self. = attributes[:'chiefOperatingOfficer'] end if attributes.has_key?(:'controller') self.controller = attributes[:'controller'] end if attributes.has_key?(:'dispatcher') self.dispatcher = attributes[:'dispatcher'] end if attributes.has_key?(:'serviceManager') self.service_manager = attributes[:'serviceManager'] end if attributes.has_key?(:'dutyManager') self.duty_manager = attributes[:'dutyManager'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end |
Instance Attribute Details
#_info ⇒ Object
Metadata of the entity
42 43 44 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 42 def _info @_info end |
#base_currency ⇒ Object
Returns the value of attribute base_currency.
27 28 29 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 27 def base_currency @base_currency end |
#chief_operating_officer ⇒ Object
Returns the value of attribute chief_operating_officer.
31 32 33 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 31 def @chief_operating_officer end |
#controller ⇒ Object
Returns the value of attribute controller.
33 34 35 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 33 def controller @controller end |
#dispatcher ⇒ Object
Returns the value of attribute dispatcher.
35 36 37 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 35 def dispatcher @dispatcher end |
#duty_manager ⇒ Object
Returns the value of attribute duty_manager.
39 40 41 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 39 def duty_manager @duty_manager end |
#fiscal_year_start ⇒ Object
Returns the value of attribute fiscal_year_start.
21 22 23 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 21 def fiscal_year_start @fiscal_year_start end |
#group_caption ⇒ Object
Returns the value of attribute group_caption.
25 26 27 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 25 def group_caption @group_caption end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 7 def id @id end |
#level1_name ⇒ Object
Returns the value of attribute level1_name.
11 12 13 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 11 def level1_name @level1_name end |
#level2_name ⇒ Object
Returns the value of attribute level2_name.
13 14 15 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 13 def level2_name @level2_name end |
#level3_name ⇒ Object
Returns the value of attribute level3_name.
15 16 17 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 15 def level3_name @level3_name end |
#level4_name ⇒ Object
Returns the value of attribute level4_name.
17 18 19 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 17 def level4_name @level4_name end |
#level5_name ⇒ Object
Returns the value of attribute level5_name.
19 20 21 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 19 def level5_name @level5_name end |
#level_count ⇒ Object
Returns the value of attribute level_count.
9 10 11 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 9 def level_count @level_count end |
#location_caption ⇒ Object
Returns the value of attribute location_caption.
23 24 25 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 23 def location_caption @location_caption end |
#president ⇒ Object
Returns the value of attribute president.
29 30 31 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 29 def president @president end |
#service_manager ⇒ Object
Returns the value of attribute service_manager.
37 38 39 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 37 def service_manager @service_manager end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 67 def self.attribute_map { :'id' => :'id', :'level_count' => :'levelCount', :'level1_name' => :'level1Name', :'level2_name' => :'level2Name', :'level3_name' => :'level3Name', :'level4_name' => :'level4Name', :'level5_name' => :'level5Name', :'fiscal_year_start' => :'fiscalYearStart', :'location_caption' => :'locationCaption', :'group_caption' => :'groupCaption', :'base_currency' => :'baseCurrency', :'president' => :'president', :'chief_operating_officer' => :'chiefOperatingOfficer', :'controller' => :'controller', :'dispatcher' => :'dispatcher', :'service_manager' => :'serviceManager', :'duty_manager' => :'dutyManager', :'_info' => :'_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 91 def self.swagger_types { :'id' => :'Integer', :'level_count' => :'String', :'level1_name' => :'String', :'level2_name' => :'String', :'level3_name' => :'String', :'level4_name' => :'String', :'level5_name' => :'String', :'fiscal_year_start' => :'String', :'location_caption' => :'String', :'group_caption' => :'String', :'base_currency' => :'CurrencyReference', :'president' => :'MemberReference', :'chief_operating_officer' => :'MemberReference', :'controller' => :'MemberReference', :'dispatcher' => :'MemberReference', :'service_manager' => :'MemberReference', :'duty_manager' => :'MemberReference', :'_info' => :'Metadata' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 373 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && level_count == o.level_count && level1_name == o.level1_name && level2_name == o.level2_name && level3_name == o.level3_name && level4_name == o.level4_name && level5_name == o.level5_name && fiscal_year_start == o.fiscal_year_start && location_caption == o.location_caption && group_caption == o.group_caption && base_currency == o.base_currency && president == o.president && == o. && controller == o.controller && dispatcher == o.dispatcher && service_manager == o.service_manager && duty_manager == o.duty_manager && _info == o._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 432 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = ConnectWise.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 498 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 411 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/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) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean
398 399 400 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 398 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
404 405 406 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 404 def hash [id, level_count, level1_name, level2_name, level3_name, level4_name, level5_name, fiscal_year_start, location_caption, group_caption, base_currency, president, , controller, dispatcher, service_manager, duty_manager, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 198 def list_invalid_properties invalid_properties = Array.new if !@level1_name.nil? && @level1_name.to_s.length > 20 invalid_properties.push("invalid value for 'level1_name', the character length must be smaller than or equal to 20.") end if !@level2_name.nil? && @level2_name.to_s.length > 20 invalid_properties.push("invalid value for 'level2_name', the character length must be smaller than or equal to 20.") end if !@level3_name.nil? && @level3_name.to_s.length > 20 invalid_properties.push("invalid value for 'level3_name', the character length must be smaller than or equal to 20.") end if !@level4_name.nil? && @level4_name.to_s.length > 20 invalid_properties.push("invalid value for 'level4_name', the character length must be smaller than or equal to 20.") end if !@level5_name.nil? && @level5_name.to_s.length > 20 invalid_properties.push("invalid value for 'level5_name', the character length must be smaller than or equal to 20.") end if @fiscal_year_start.nil? invalid_properties.push("invalid value for 'fiscal_year_start', fiscal_year_start cannot be nil.") end if @location_caption.nil? invalid_properties.push("invalid value for 'location_caption', location_caption cannot be nil.") end if @location_caption.to_s.length > 50 invalid_properties.push("invalid value for 'location_caption', the character length must be smaller than or equal to 50.") end if @group_caption.nil? invalid_properties.push("invalid value for 'group_caption', group_caption cannot be nil.") end if @group_caption.to_s.length > 50 invalid_properties.push("invalid value for 'group_caption', the character length must be smaller than or equal to 50.") end if @base_currency.nil? invalid_properties.push("invalid value for 'base_currency', base_currency cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
478 479 480 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 478 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
484 485 486 487 488 489 490 491 492 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 484 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
472 473 474 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 472 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/connectwise-ruby-sdk/models/corporate_structure.rb', line 249 def valid? level_count_validator = EnumAttributeValidator.new('String', ["Level1", "Level2", "Level3", "Level4", "Level5"]) return false unless level_count_validator.valid?(@level_count) return false if !@level1_name.nil? && @level1_name.to_s.length > 20 return false if !@level2_name.nil? && @level2_name.to_s.length > 20 return false if !@level3_name.nil? && @level3_name.to_s.length > 20 return false if !@level4_name.nil? && @level4_name.to_s.length > 20 return false if !@level5_name.nil? && @level5_name.to_s.length > 20 return false if @fiscal_year_start.nil? fiscal_year_start_validator = EnumAttributeValidator.new('String', ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]) return false unless fiscal_year_start_validator.valid?(@fiscal_year_start) return false if @location_caption.nil? return false if @location_caption.to_s.length > 50 return false if @group_caption.nil? return false if @group_caption.to_s.length > 50 return false if @base_currency.nil? return true end |