Class: ConnectWise::Service
- Inherits:
-
Object
- Object
- ConnectWise::Service
- Defined in:
- lib/connectwise-ruby-sdk/models/service.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Metadata of the entity.
-
#allow_cc_flag ⇒ Object
Returns the value of attribute allow_cc_flag.
-
#calendar_setup ⇒ Object
Returns the value of attribute calendar_setup.
-
#contact_color ⇒ Object
Returns the value of attribute contact_color.
-
#contact_color_disable_flag ⇒ Object
Returns the value of attribute contact_color_disable_flag.
-
#header_color ⇒ Object
Returns the value of attribute header_color.
-
#header_color_disable_flag ⇒ Object
Returns the value of attribute header_color_disable_flag.
-
#hide_delimiter_flag ⇒ Object
Returns the value of attribute hide_delimiter_flag.
-
#id ⇒ Object
Returns the value of attribute id.
-
#member_color ⇒ Object
Returns the value of attribute member_color.
-
#member_color_disable_flag ⇒ Object
Returns the value of attribute member_color_disable_flag.
-
#schedule_span ⇒ Object
Returns the value of attribute schedule_span.
-
#sr_notify ⇒ Object
Returns the value of attribute sr_notify.
-
#unknown_color ⇒ Object
Returns the value of attribute unknown_color.
-
#unknown_color_disable_flag ⇒ Object
Returns the value of attribute unknown_color_disable_flag.
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 = {}) ⇒ Service
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 = {}) ⇒ Service
Initializes the object
104 105 106 107 108 109 110 111 112 113 114 115 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 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 104 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?(:'srNotify') self.sr_notify = attributes[:'srNotify'] end if attributes.has_key?(:'scheduleSpan') self.schedule_span = attributes[:'scheduleSpan'] end if attributes.has_key?(:'hideDelimiterFlag') self.hide_delimiter_flag = attributes[:'hideDelimiterFlag'] end if attributes.has_key?(:'allowCCFlag') self.allow_cc_flag = attributes[:'allowCCFlag'] end if attributes.has_key?(:'headerColor') self.header_color = attributes[:'headerColor'] end if attributes.has_key?(:'memberColor') self.member_color = attributes[:'memberColor'] end if attributes.has_key?(:'contactColor') self.contact_color = attributes[:'contactColor'] end if attributes.has_key?(:'unknownColor') self.unknown_color = attributes[:'unknownColor'] end if attributes.has_key?(:'calendarSetup') self.calendar_setup = attributes[:'calendarSetup'] end if attributes.has_key?(:'headerColorDisableFlag') self.header_color_disable_flag = attributes[:'headerColorDisableFlag'] end if attributes.has_key?(:'memberColorDisableFlag') self.member_color_disable_flag = attributes[:'memberColorDisableFlag'] end if attributes.has_key?(:'contactColorDisableFlag') self.contact_color_disable_flag = attributes[:'contactColorDisableFlag'] end if attributes.has_key?(:'unknownColorDisableFlag') self.unknown_color_disable_flag = attributes[:'unknownColorDisableFlag'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end |
Instance Attribute Details
#_info ⇒ Object
Metadata of the entity
36 37 38 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 36 def _info @_info end |
#allow_cc_flag ⇒ Object
Returns the value of attribute allow_cc_flag.
15 16 17 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 15 def allow_cc_flag @allow_cc_flag end |
#calendar_setup ⇒ Object
Returns the value of attribute calendar_setup.
25 26 27 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 25 def calendar_setup @calendar_setup end |
#contact_color ⇒ Object
Returns the value of attribute contact_color.
21 22 23 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 21 def contact_color @contact_color end |
#contact_color_disable_flag ⇒ Object
Returns the value of attribute contact_color_disable_flag.
31 32 33 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 31 def contact_color_disable_flag @contact_color_disable_flag end |
#header_color ⇒ Object
Returns the value of attribute header_color.
17 18 19 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 17 def header_color @header_color end |
#header_color_disable_flag ⇒ Object
Returns the value of attribute header_color_disable_flag.
27 28 29 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 27 def header_color_disable_flag @header_color_disable_flag end |
#hide_delimiter_flag ⇒ Object
Returns the value of attribute hide_delimiter_flag.
13 14 15 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 13 def hide_delimiter_flag @hide_delimiter_flag end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 7 def id @id end |
#member_color ⇒ Object
Returns the value of attribute member_color.
19 20 21 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 19 def member_color @member_color end |
#member_color_disable_flag ⇒ Object
Returns the value of attribute member_color_disable_flag.
29 30 31 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 29 def member_color_disable_flag @member_color_disable_flag end |
#schedule_span ⇒ Object
Returns the value of attribute schedule_span.
11 12 13 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 11 def schedule_span @schedule_span end |
#sr_notify ⇒ Object
Returns the value of attribute sr_notify.
9 10 11 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 9 def sr_notify @sr_notify end |
#unknown_color ⇒ Object
Returns the value of attribute unknown_color.
23 24 25 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 23 def unknown_color @unknown_color end |
#unknown_color_disable_flag ⇒ Object
Returns the value of attribute unknown_color_disable_flag.
33 34 35 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 33 def unknown_color_disable_flag @unknown_color_disable_flag end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 61 def self.attribute_map { :'id' => :'id', :'sr_notify' => :'srNotify', :'schedule_span' => :'scheduleSpan', :'hide_delimiter_flag' => :'hideDelimiterFlag', :'allow_cc_flag' => :'allowCCFlag', :'header_color' => :'headerColor', :'member_color' => :'memberColor', :'contact_color' => :'contactColor', :'unknown_color' => :'unknownColor', :'calendar_setup' => :'calendarSetup', :'header_color_disable_flag' => :'headerColorDisableFlag', :'member_color_disable_flag' => :'memberColorDisableFlag', :'contact_color_disable_flag' => :'contactColorDisableFlag', :'unknown_color_disable_flag' => :'unknownColorDisableFlag', :'_info' => :'_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 82 def self.swagger_types { :'id' => :'Integer', :'sr_notify' => :'String', :'schedule_span' => :'String', :'hide_delimiter_flag' => :'BOOLEAN', :'allow_cc_flag' => :'BOOLEAN', :'header_color' => :'String', :'member_color' => :'String', :'contact_color' => :'String', :'unknown_color' => :'String', :'calendar_setup' => :'CalendarSetupReference', :'header_color_disable_flag' => :'BOOLEAN', :'member_color_disable_flag' => :'BOOLEAN', :'contact_color_disable_flag' => :'BOOLEAN', :'unknown_color_disable_flag' => :'BOOLEAN', :'_info' => :'Metadata' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 285 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && sr_notify == o.sr_notify && schedule_span == o.schedule_span && hide_delimiter_flag == o.hide_delimiter_flag && allow_cc_flag == o.allow_cc_flag && header_color == o.header_color && member_color == o.member_color && contact_color == o.contact_color && unknown_color == o.unknown_color && calendar_setup == o.calendar_setup && header_color_disable_flag == o.header_color_disable_flag && member_color_disable_flag == o.member_color_disable_flag && contact_color_disable_flag == o.contact_color_disable_flag && unknown_color_disable_flag == o.unknown_color_disable_flag && _info == o._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 341 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
407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 407 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
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 320 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
307 308 309 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 307 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
313 314 315 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 313 def hash [id, sr_notify, schedule_span, hide_delimiter_flag, allow_cc_flag, header_color, member_color, contact_color, unknown_color, calendar_setup, header_color_disable_flag, member_color_disable_flag, contact_color_disable_flag, unknown_color_disable_flag, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 174 def list_invalid_properties invalid_properties = Array.new if @sr_notify.nil? invalid_properties.push("invalid value for 'sr_notify', sr_notify cannot be nil.") end if @schedule_span.nil? invalid_properties.push("invalid value for 'schedule_span', schedule_span cannot be nil.") end if !@header_color.nil? && @header_color.to_s.length > 50 invalid_properties.push("invalid value for 'header_color', the character length must be smaller than or equal to 50.") end if !@member_color.nil? && @member_color.to_s.length > 50 invalid_properties.push("invalid value for 'member_color', the character length must be smaller than or equal to 50.") end if !@contact_color.nil? && @contact_color.to_s.length > 50 invalid_properties.push("invalid value for 'contact_color', the character length must be smaller than or equal to 50.") end if !@unknown_color.nil? && @unknown_color.to_s.length > 50 invalid_properties.push("invalid value for 'unknown_color', the character length must be smaller than or equal to 50.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
387 388 389 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 387 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
393 394 395 396 397 398 399 400 401 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 393 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
381 382 383 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 381 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/connectwise-ruby-sdk/models/service.rb', line 205 def valid? return false if @sr_notify.nil? sr_notify_validator = EnumAttributeValidator.new('String', ["None", "All", "NewRequestsOnly", "ClosedRequestsOnly", "NewAndClosedRequests"]) return false unless sr_notify_validator.valid?(@sr_notify) return false if @schedule_span.nil? schedule_span_validator = EnumAttributeValidator.new('String', ["Standard", "OfficeHours", "Overnight"]) return false unless schedule_span_validator.valid?(@schedule_span) return false if !@header_color.nil? && @header_color.to_s.length > 50 return false if !@member_color.nil? && @member_color.to_s.length > 50 return false if !@contact_color.nil? && @contact_color.to_s.length > 50 return false if !@unknown_color.nil? && @unknown_color.to_s.length > 50 return true end |