Class: ConnectWise::UserDefinedField
- Inherits:
-
Object
- Object
- ConnectWise::UserDefinedField
- Defined in:
- lib/connectwise-ruby-sdk/models/user_defined_field.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Metadata of the entity.
-
#add_all_business_units ⇒ Object
Returns the value of attribute add_all_business_units.
-
#add_all_locations ⇒ Object
Returns the value of attribute add_all_locations.
-
#business_unit_ids ⇒ Object
Returns the value of attribute business_unit_ids.
-
#button_url ⇒ Object
Only available with Button Field Type.
-
#caption ⇒ Object
Field caption.
-
#date_created ⇒ Object
Date in UTC the custom field was created.
-
#display_on_screen_flag ⇒ Object
Returns the value of attribute display_on_screen_flag.
-
#entry_type_identifier ⇒ Object
Returns the value of attribute entry_type_identifier.
-
#field_type_identifier ⇒ Object
Returns the value of attribute field_type_identifier.
-
#help_text ⇒ Object
Help text to accompany the custom field.
-
#id ⇒ Object
ID of the custom user defined field.
-
#list_view_flag ⇒ Object
Denotes that this custom field is included on a list view.
-
#location_ids ⇒ Object
Returns the value of attribute location_ids.
-
#number_decimals ⇒ Object
Only valid for Number or percent.
-
#options ⇒ Object
Returns the value of attribute options.
-
#pod_id ⇒ Object
Id of the Pod where the custom field will be placed.
-
#read_only_flag ⇒ Object
Returns the value of attribute read_only_flag.
-
#remove_all_business_units ⇒ Object
Returns the value of attribute remove_all_business_units.
-
#remove_all_locations ⇒ Object
Returns the value of attribute remove_all_locations.
-
#required_flag ⇒ Object
Returns the value of attribute required_flag.
-
#sequence_number ⇒ Object
Must be between 1 and 50.
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 = {}) ⇒ UserDefinedField
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 = {}) ⇒ UserDefinedField
Initializes the object
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 195 196 197 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 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 141 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?(:'podId') self.pod_id = attributes[:'podId'] end if attributes.has_key?(:'caption') self.caption = attributes[:'caption'] end if attributes.has_key?(:'sequenceNumber') self.sequence_number = attributes[:'sequenceNumber'] end if attributes.has_key?(:'helpText') self.help_text = attributes[:'helpText'] end if attributes.has_key?(:'fieldTypeIdentifier') self.field_type_identifier = attributes[:'fieldTypeIdentifier'] end if attributes.has_key?(:'numberDecimals') self.number_decimals = attributes[:'numberDecimals'] end if attributes.has_key?(:'entryTypeIdentifier') self.entry_type_identifier = attributes[:'entryTypeIdentifier'] end if attributes.has_key?(:'requiredFlag') self.required_flag = attributes[:'requiredFlag'] end if attributes.has_key?(:'displayOnScreenFlag') self.display_on_screen_flag = attributes[:'displayOnScreenFlag'] end if attributes.has_key?(:'readOnlyFlag') self.read_only_flag = attributes[:'readOnlyFlag'] end if attributes.has_key?(:'listViewFlag') self.list_view_flag = attributes[:'listViewFlag'] end if attributes.has_key?(:'buttonUrl') self. = attributes[:'buttonUrl'] end if attributes.has_key?(:'options') if (value = attributes[:'options']).is_a?(Array) self. = value end end if attributes.has_key?(:'businessUnitIds') if (value = attributes[:'businessUnitIds']).is_a?(Array) self.business_unit_ids = value end end if attributes.has_key?(:'locationIds') if (value = attributes[:'locationIds']).is_a?(Array) self.location_ids = value end end if attributes.has_key?(:'addAllBusinessUnits') self.add_all_business_units = attributes[:'addAllBusinessUnits'] end if attributes.has_key?(:'removeAllBusinessUnits') self.remove_all_business_units = attributes[:'removeAllBusinessUnits'] end if attributes.has_key?(:'addAllLocations') self.add_all_locations = attributes[:'addAllLocations'] end if attributes.has_key?(:'removeAllLocations') self.remove_all_locations = attributes[:'removeAllLocations'] end if attributes.has_key?(:'dateCreated') self.date_created = attributes[:'dateCreated'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end |
Instance Attribute Details
#_info ⇒ Object
Metadata of the entity
59 60 61 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 59 def _info @_info end |
#add_all_business_units ⇒ Object
Returns the value of attribute add_all_business_units.
47 48 49 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 47 def add_all_business_units @add_all_business_units end |
#add_all_locations ⇒ Object
Returns the value of attribute add_all_locations.
51 52 53 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 51 def add_all_locations @add_all_locations end |
#business_unit_ids ⇒ Object
Returns the value of attribute business_unit_ids.
43 44 45 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 43 def business_unit_ids @business_unit_ids end |
#button_url ⇒ Object
Only available with Button Field Type. Required when entryTypeIdentifier is button
39 40 41 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 39 def @button_url end |
#caption ⇒ Object
Field caption
14 15 16 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 14 def caption @caption end |
#date_created ⇒ Object
Date in UTC the custom field was created
56 57 58 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 56 def date_created @date_created end |
#display_on_screen_flag ⇒ Object
Returns the value of attribute display_on_screen_flag.
31 32 33 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 31 def display_on_screen_flag @display_on_screen_flag end |
#entry_type_identifier ⇒ Object
Returns the value of attribute entry_type_identifier.
27 28 29 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 27 def entry_type_identifier @entry_type_identifier end |
#field_type_identifier ⇒ Object
Returns the value of attribute field_type_identifier.
22 23 24 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 22 def field_type_identifier @field_type_identifier end |
#help_text ⇒ Object
Help text to accompany the custom field
20 21 22 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 20 def help_text @help_text end |
#id ⇒ Object
ID of the custom user defined field
8 9 10 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 8 def id @id end |
#list_view_flag ⇒ Object
Denotes that this custom field is included on a list view
36 37 38 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 36 def list_view_flag @list_view_flag end |
#location_ids ⇒ Object
Returns the value of attribute location_ids.
45 46 47 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 45 def location_ids @location_ids end |
#number_decimals ⇒ Object
Only valid for Number or percent
25 26 27 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 25 def number_decimals @number_decimals end |
#options ⇒ Object
Returns the value of attribute options.
41 42 43 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 41 def @options end |
#pod_id ⇒ Object
Id of the Pod where the custom field will be placed
11 12 13 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 11 def pod_id @pod_id end |
#read_only_flag ⇒ Object
Returns the value of attribute read_only_flag.
33 34 35 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 33 def read_only_flag @read_only_flag end |
#remove_all_business_units ⇒ Object
Returns the value of attribute remove_all_business_units.
49 50 51 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 49 def remove_all_business_units @remove_all_business_units end |
#remove_all_locations ⇒ Object
Returns the value of attribute remove_all_locations.
53 54 55 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 53 def remove_all_locations @remove_all_locations end |
#required_flag ⇒ Object
Returns the value of attribute required_flag.
29 30 31 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 29 def required_flag @required_flag end |
#sequence_number ⇒ Object
Must be between 1 and 50. This defines the order in which the custom fields will appear
17 18 19 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 17 def sequence_number @sequence_number end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 84 def self.attribute_map { :'id' => :'id', :'pod_id' => :'podId', :'caption' => :'caption', :'sequence_number' => :'sequenceNumber', :'help_text' => :'helpText', :'field_type_identifier' => :'fieldTypeIdentifier', :'number_decimals' => :'numberDecimals', :'entry_type_identifier' => :'entryTypeIdentifier', :'required_flag' => :'requiredFlag', :'display_on_screen_flag' => :'displayOnScreenFlag', :'read_only_flag' => :'readOnlyFlag', :'list_view_flag' => :'listViewFlag', :'button_url' => :'buttonUrl', :'options' => :'options', :'business_unit_ids' => :'businessUnitIds', :'location_ids' => :'locationIds', :'add_all_business_units' => :'addAllBusinessUnits', :'remove_all_business_units' => :'removeAllBusinessUnits', :'add_all_locations' => :'addAllLocations', :'remove_all_locations' => :'removeAllLocations', :'date_created' => :'dateCreated', :'_info' => :'_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 112 def self.swagger_types { :'id' => :'Integer', :'pod_id' => :'Integer', :'caption' => :'String', :'sequence_number' => :'Integer', :'help_text' => :'String', :'field_type_identifier' => :'String', :'number_decimals' => :'Integer', :'entry_type_identifier' => :'String', :'required_flag' => :'BOOLEAN', :'display_on_screen_flag' => :'BOOLEAN', :'read_only_flag' => :'BOOLEAN', :'list_view_flag' => :'BOOLEAN', :'button_url' => :'String', :'options' => :'Array<UserDefinedFieldOption>', :'business_unit_ids' => :'Array<Integer>', :'location_ids' => :'Array<Integer>', :'add_all_business_units' => :'BOOLEAN', :'remove_all_business_units' => :'BOOLEAN', :'add_all_locations' => :'BOOLEAN', :'remove_all_locations' => :'BOOLEAN', :'date_created' => :'DateTime', :'_info' => :'Metadata' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 406 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && pod_id == o.pod_id && caption == o.caption && sequence_number == o.sequence_number && help_text == o.help_text && field_type_identifier == o.field_type_identifier && number_decimals == o.number_decimals && entry_type_identifier == o.entry_type_identifier && required_flag == o.required_flag && display_on_screen_flag == o.display_on_screen_flag && read_only_flag == o.read_only_flag && list_view_flag == o.list_view_flag && == o. && == o. && business_unit_ids == o.business_unit_ids && location_ids == o.location_ids && add_all_business_units == o.add_all_business_units && remove_all_business_units == o.remove_all_business_units && add_all_locations == o.add_all_locations && remove_all_locations == o.remove_all_locations && date_created == o.date_created && _info == o._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 469 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
535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 535 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
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 448 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
435 436 437 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 435 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
441 442 443 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 441 def hash [id, pod_id, caption, sequence_number, help_text, field_type_identifier, number_decimals, entry_type_identifier, required_flag, display_on_screen_flag, read_only_flag, list_view_flag, , , business_unit_ids, location_ids, add_all_business_units, remove_all_business_units, add_all_locations, remove_all_locations, date_created, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 245 def list_invalid_properties invalid_properties = Array.new if @pod_id.nil? invalid_properties.push("invalid value for 'pod_id', pod_id cannot be nil.") end if @caption.nil? invalid_properties.push("invalid value for 'caption', caption cannot be nil.") end if @caption.to_s.length > 25 invalid_properties.push("invalid value for 'caption', the character length must be smaller than or equal to 25.") end if @sequence_number.nil? invalid_properties.push("invalid value for 'sequence_number', sequence_number cannot be nil.") end if @sequence_number > 50 invalid_properties.push("invalid value for 'sequence_number', must be smaller than or equal to 50.") end if @sequence_number < 1 invalid_properties.push("invalid value for 'sequence_number', must be greater than or equal to 1.") end if !@help_text.nil? && @help_text.to_s.length > 1000 invalid_properties.push("invalid value for 'help_text', the character length must be smaller than or equal to 1000.") end if @field_type_identifier.nil? invalid_properties.push("invalid value for 'field_type_identifier', field_type_identifier cannot be nil.") end if !@number_decimals.nil? && @number_decimals > 5 invalid_properties.push("invalid value for 'number_decimals', must be smaller than or equal to 5.") end if !@number_decimals.nil? && @number_decimals < 0 invalid_properties.push("invalid value for 'number_decimals', must be greater than or equal to 0.") end if !@button_url.nil? && @button_url.to_s.length > 1000 invalid_properties.push("invalid value for 'button_url', the character length must be smaller than or equal to 1000.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
515 516 517 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 515 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
521 522 523 524 525 526 527 528 529 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 521 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
509 510 511 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 509 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/connectwise-ruby-sdk/models/user_defined_field.rb', line 296 def valid? return false if @pod_id.nil? return false if @caption.nil? return false if @caption.to_s.length > 25 return false if @sequence_number.nil? return false if @sequence_number > 50 return false if @sequence_number < 1 return false if !@help_text.nil? && @help_text.to_s.length > 1000 return false if @field_type_identifier.nil? field_type_identifier_validator = EnumAttributeValidator.new('String', ["Button", "Checkbox", "Date", "Hyperlink", "Number", "Percent", "Text", "TextArea"]) return false unless field_type_identifier_validator.valid?(@field_type_identifier) return false if !@number_decimals.nil? && @number_decimals > 5 return false if !@number_decimals.nil? && @number_decimals < 0 entry_type_identifier_validator = EnumAttributeValidator.new('String', ["EntryField", "List", "Option"]) return false unless entry_type_identifier_validator.valid?(@entry_type_identifier) return false if !@button_url.nil? && @button_url.to_s.length > 1000 return true end |