Class: ConnectWise::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/connectwise-ruby-sdk/models/contact.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Contact

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
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
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 212

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?(:'firstName')
    self.first_name = attributes[:'firstName']
  end

  if attributes.has_key?(:'lastName')
    self.last_name = attributes[:'lastName']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'company')
    self.company = attributes[:'company']
  end

  if attributes.has_key?(:'site')
    self.site = attributes[:'site']
  end

  if attributes.has_key?(:'addressLine1')
    self.address_line1 = attributes[:'addressLine1']
  end

  if attributes.has_key?(:'addressLine2')
    self.address_line2 = attributes[:'addressLine2']
  end

  if attributes.has_key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'zip')
    self.zip = attributes[:'zip']
  end

  if attributes.has_key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.has_key?(:'relationship')
    self.relationship = attributes[:'relationship']
  end

  if attributes.has_key?(:'department')
    self.department = attributes[:'department']
  end

  if attributes.has_key?(:'inactiveFlag')
    self.inactive_flag = attributes[:'inactiveFlag']
  end

  if attributes.has_key?(:'defaultMergeContactId')
    self.default_merge_contact_id = attributes[:'defaultMergeContactId']
  end

  if attributes.has_key?(:'securityIdentifier')
    self.security_identifier = attributes[:'securityIdentifier']
  end

  if attributes.has_key?(:'managerContactId')
    self.manager_contact_id = attributes[:'managerContactId']
  end

  if attributes.has_key?(:'assistantContactId')
    self.assistant_contact_id = attributes[:'assistantContactId']
  end

  if attributes.has_key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.has_key?(:'school')
    self.school = attributes[:'school']
  end

  if attributes.has_key?(:'nickName')
    self.nick_name = attributes[:'nickName']
  end

  if attributes.has_key?(:'marriedFlag')
    self.married_flag = attributes[:'marriedFlag']
  end

  if attributes.has_key?(:'childrenFlag')
    self.children_flag = attributes[:'childrenFlag']
  end

  if attributes.has_key?(:'significantOther')
    self.significant_other = attributes[:'significantOther']
  end

  if attributes.has_key?(:'portalPassword')
    self.portal_password = attributes[:'portalPassword']
  end

  if attributes.has_key?(:'portalSecurityLevel')
    self.portal_security_level = attributes[:'portalSecurityLevel']
  end

  if attributes.has_key?(:'disablePortalLoginFlag')
    self. = attributes[:'disablePortalLoginFlag']
  end

  if attributes.has_key?(:'unsubscribeFlag')
    self.unsubscribe_flag = attributes[:'unsubscribeFlag']
  end

  if attributes.has_key?(:'gender')
    self.gender = attributes[:'gender']
  end

  if attributes.has_key?(:'birthDay')
    self.birth_day = attributes[:'birthDay']
  end

  if attributes.has_key?(:'anniversary')
    self.anniversary = attributes[:'anniversary']
  end

  if attributes.has_key?(:'presence')
    self.presence = attributes[:'presence']
  end

  if attributes.has_key?(:'mobileGuid')
    self.mobile_guid = attributes[:'mobileGuid']
  end

  if attributes.has_key?(:'facebookUrl')
    self.facebook_url = attributes[:'facebookUrl']
  end

  if attributes.has_key?(:'twitterUrl')
    self.twitter_url = attributes[:'twitterUrl']
  end

  if attributes.has_key?(:'linkedInUrl')
    self.linked_in_url = attributes[:'linkedInUrl']
  end

  if attributes.has_key?(:'defaultBillingFlag')
    self.default_billing_flag = attributes[:'defaultBillingFlag']
  end

  if attributes.has_key?(:'defaultFlag')
    self.default_flag = attributes[:'defaultFlag']
  end

  if attributes.has_key?(:'communicationItems')
    if (value = attributes[:'communicationItems']).is_a?(Array)
      self.communication_items = value
    end
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

  if attributes.has_key?(:'customFields')
    if (value = attributes[:'customFields']).is_a?(Array)
      self.custom_fields = value
    end
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



88
89
90
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 88

def _info
  @_info
end

#address_line1Object

Returns the value of attribute address_line1.



19
20
21
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 19

def address_line1
  @address_line1
end

#address_line2Object

Returns the value of attribute address_line2.



21
22
23
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 21

def address_line2
  @address_line2
end

#anniversaryObject

Returns the value of attribute anniversary.



69
70
71
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 69

def anniversary
  @anniversary
end

#assistant_contact_idObject

Returns the value of attribute assistant_contact_id.



43
44
45
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 43

def assistant_contact_id
  @assistant_contact_id
end

#birth_dayObject

Returns the value of attribute birth_day.



67
68
69
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 67

def birth_day
  @birth_day
end

#children_flagObject

Returns the value of attribute children_flag.



53
54
55
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 53

def children_flag
  @children_flag
end

#cityObject

Returns the value of attribute city.



23
24
25
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 23

def city
  @city
end

#communication_itemsObject

Returns the value of attribute communication_items.



85
86
87
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 85

def communication_items
  @communication_items
end

#companyObject

Returns the value of attribute company.



15
16
17
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 15

def company
  @company
end

#countryObject

Returns the value of attribute country.



29
30
31
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 29

def country
  @country
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



90
91
92
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 90

def custom_fields
  @custom_fields
end

#default_billing_flagObject

Returns the value of attribute default_billing_flag.



81
82
83
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 81

def default_billing_flag
  @default_billing_flag
end

#default_flagObject

Returns the value of attribute default_flag.



83
84
85
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 83

def default_flag
  @default_flag
end

#default_merge_contact_idObject

Returns the value of attribute default_merge_contact_id.



37
38
39
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 37

def default_merge_contact_id
  @default_merge_contact_id
end

#departmentObject

Returns the value of attribute department.



33
34
35
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 33

def department
  @department
end

#disable_portal_login_flagObject

Returns the value of attribute disable_portal_login_flag.



61
62
63
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 61

def 
  @disable_portal_login_flag
end

#facebook_urlObject

Returns the value of attribute facebook_url.



75
76
77
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 75

def facebook_url
  @facebook_url
end

#first_nameObject

Returns the value of attribute first_name.



9
10
11
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 9

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender.



65
66
67
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 65

def gender
  @gender
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 7

def id
  @id
end

#inactive_flagObject

Returns the value of attribute inactive_flag.



35
36
37
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 35

def inactive_flag
  @inactive_flag
end

#last_nameObject

Returns the value of attribute last_name.



11
12
13
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 11

def last_name
  @last_name
end

#linked_in_urlObject

Returns the value of attribute linked_in_url.



79
80
81
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 79

def linked_in_url
  @linked_in_url
end

#manager_contact_idObject

Returns the value of attribute manager_contact_id.



41
42
43
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 41

def manager_contact_id
  @manager_contact_id
end

#married_flagObject

Returns the value of attribute married_flag.



51
52
53
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 51

def married_flag
  @married_flag
end

#mobile_guidObject

Returns the value of attribute mobile_guid.



73
74
75
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 73

def mobile_guid
  @mobile_guid
end

#nick_nameObject

Returns the value of attribute nick_name.



49
50
51
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 49

def nick_name
  @nick_name
end

#portal_passwordObject

Returns the value of attribute portal_password.



57
58
59
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 57

def portal_password
  @portal_password
end

#portal_security_levelObject

Returns the value of attribute portal_security_level.



59
60
61
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 59

def portal_security_level
  @portal_security_level
end

#presenceObject

Returns the value of attribute presence.



71
72
73
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 71

def presence
  @presence
end

#relationshipObject

Returns the value of attribute relationship.



31
32
33
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 31

def relationship
  @relationship
end

#schoolObject

Returns the value of attribute school.



47
48
49
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 47

def school
  @school
end

#security_identifierObject

Returns the value of attribute security_identifier.



39
40
41
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 39

def security_identifier
  @security_identifier
end

#significant_otherObject

Returns the value of attribute significant_other.



55
56
57
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 55

def significant_other
  @significant_other
end

#siteObject

Returns the value of attribute site.



17
18
19
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 17

def site
  @site
end

#stateObject

Returns the value of attribute state.



25
26
27
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 25

def state
  @state
end

#titleObject

Returns the value of attribute title.



45
46
47
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 45

def title
  @title
end

#twitter_urlObject

Returns the value of attribute twitter_url.



77
78
79
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 77

def twitter_url
  @twitter_url
end

#typeObject

Returns the value of attribute type.



13
14
15
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 13

def type
  @type
end

#unsubscribe_flagObject

Returns the value of attribute unsubscribe_flag.



63
64
65
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 63

def unsubscribe_flag
  @unsubscribe_flag
end

#zipObject

Returns the value of attribute zip.



27
28
29
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 27

def zip
  @zip
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 115

def self.attribute_map
  {
    :'id' => :'id',
    :'first_name' => :'firstName',
    :'last_name' => :'lastName',
    :'type' => :'type',
    :'company' => :'company',
    :'site' => :'site',
    :'address_line1' => :'addressLine1',
    :'address_line2' => :'addressLine2',
    :'city' => :'city',
    :'state' => :'state',
    :'zip' => :'zip',
    :'country' => :'country',
    :'relationship' => :'relationship',
    :'department' => :'department',
    :'inactive_flag' => :'inactiveFlag',
    :'default_merge_contact_id' => :'defaultMergeContactId',
    :'security_identifier' => :'securityIdentifier',
    :'manager_contact_id' => :'managerContactId',
    :'assistant_contact_id' => :'assistantContactId',
    :'title' => :'title',
    :'school' => :'school',
    :'nick_name' => :'nickName',
    :'married_flag' => :'marriedFlag',
    :'children_flag' => :'childrenFlag',
    :'significant_other' => :'significantOther',
    :'portal_password' => :'portalPassword',
    :'portal_security_level' => :'portalSecurityLevel',
    :'disable_portal_login_flag' => :'disablePortalLoginFlag',
    :'unsubscribe_flag' => :'unsubscribeFlag',
    :'gender' => :'gender',
    :'birth_day' => :'birthDay',
    :'anniversary' => :'anniversary',
    :'presence' => :'presence',
    :'mobile_guid' => :'mobileGuid',
    :'facebook_url' => :'facebookUrl',
    :'twitter_url' => :'twitterUrl',
    :'linked_in_url' => :'linkedInUrl',
    :'default_billing_flag' => :'defaultBillingFlag',
    :'default_flag' => :'defaultFlag',
    :'communication_items' => :'communicationItems',
    :'_info' => :'_info',
    :'custom_fields' => :'customFields'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 163

def self.swagger_types
  {
    :'id' => :'Integer',
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'type' => :'ContactTypeReference',
    :'company' => :'CompanyReference',
    :'site' => :'SiteReference',
    :'address_line1' => :'String',
    :'address_line2' => :'String',
    :'city' => :'String',
    :'state' => :'String',
    :'zip' => :'String',
    :'country' => :'String',
    :'relationship' => :'RelationshipReference',
    :'department' => :'ContactDepartmentReference',
    :'inactive_flag' => :'BOOLEAN',
    :'default_merge_contact_id' => :'Integer',
    :'security_identifier' => :'String',
    :'manager_contact_id' => :'Integer',
    :'assistant_contact_id' => :'Integer',
    :'title' => :'String',
    :'school' => :'String',
    :'nick_name' => :'String',
    :'married_flag' => :'BOOLEAN',
    :'children_flag' => :'BOOLEAN',
    :'significant_other' => :'String',
    :'portal_password' => :'String',
    :'portal_security_level' => :'Integer',
    :'disable_portal_login_flag' => :'BOOLEAN',
    :'unsubscribe_flag' => :'BOOLEAN',
    :'gender' => :'String',
    :'birth_day' => :'DateTime',
    :'anniversary' => :'DateTime',
    :'presence' => :'String',
    :'mobile_guid' => :'Guid',
    :'facebook_url' => :'String',
    :'twitter_url' => :'String',
    :'linked_in_url' => :'String',
    :'default_billing_flag' => :'BOOLEAN',
    :'default_flag' => :'BOOLEAN',
    :'communication_items' => :'Array<ContactCommunicationItem>',
    :'_info' => :'Metadata',
    :'custom_fields' => :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 688

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      type == o.type &&
      company == o.company &&
      site == o.site &&
      address_line1 == o.address_line1 &&
      address_line2 == o.address_line2 &&
      city == o.city &&
      state == o.state &&
      zip == o.zip &&
      country == o.country &&
      relationship == o.relationship &&
      department == o.department &&
      inactive_flag == o.inactive_flag &&
      default_merge_contact_id == o.default_merge_contact_id &&
      security_identifier == o.security_identifier &&
      manager_contact_id == o.manager_contact_id &&
      assistant_contact_id == o.assistant_contact_id &&
      title == o.title &&
      school == o.school &&
      nick_name == o.nick_name &&
      married_flag == o.married_flag &&
      children_flag == o.children_flag &&
      significant_other == o.significant_other &&
      portal_password == o.portal_password &&
      portal_security_level == o.portal_security_level &&
       == o. &&
      unsubscribe_flag == o.unsubscribe_flag &&
      gender == o.gender &&
      birth_day == o.birth_day &&
      anniversary == o.anniversary &&
      presence == o.presence &&
      mobile_guid == o.mobile_guid &&
      facebook_url == o.facebook_url &&
      twitter_url == o.twitter_url &&
      linked_in_url == o.linked_in_url &&
      default_billing_flag == o.default_billing_flag &&
      default_flag == o.default_flag &&
      communication_items == o.communication_items &&
      _info == o._info &&
      custom_fields == o.custom_fields
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 771

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 837

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 750

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


737
738
739
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 737

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



743
744
745
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 743

def hash
  [id, first_name, last_name, type, company, site, address_line1, address_line2, city, state, zip, country, relationship, department, inactive_flag, default_merge_contact_id, security_identifier, manager_contact_id, assistant_contact_id, title, school, nick_name, married_flag, children_flag, significant_other, portal_password, portal_security_level, , unsubscribe_flag, gender, birth_day, anniversary, presence, mobile_guid, facebook_url, twitter_url, linked_in_url, default_billing_flag, default_flag, communication_items, _info, custom_fields].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



394
395
396
397
398
399
400
401
402
403
404
405
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
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
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 394

def list_invalid_properties
  invalid_properties = Array.new
  if @first_name.nil?
    invalid_properties.push("invalid value for 'first_name', first_name cannot be nil.")
  end

  if @first_name.to_s.length > 30
    invalid_properties.push("invalid value for 'first_name', the character length must be smaller than or equal to 30.")
  end

  if !@last_name.nil? && @last_name.to_s.length > 30
    invalid_properties.push("invalid value for 'last_name', the character length must be smaller than or equal to 30.")
  end

  if !@address_line1.nil? && @address_line1.to_s.length > 50
    invalid_properties.push("invalid value for 'address_line1', the character length must be smaller than or equal to 50.")
  end

  if !@address_line2.nil? && @address_line2.to_s.length > 50
    invalid_properties.push("invalid value for 'address_line2', the character length must be smaller than or equal to 50.")
  end

  if !@city.nil? && @city.to_s.length > 50
    invalid_properties.push("invalid value for 'city', the character length must be smaller than or equal to 50.")
  end

  if !@state.nil? && @state.to_s.length > 50
    invalid_properties.push("invalid value for 'state', the character length must be smaller than or equal to 50.")
  end

  if !@zip.nil? && @zip.to_s.length > 12
    invalid_properties.push("invalid value for 'zip', the character length must be smaller than or equal to 12.")
  end

  if !@country.nil? && @country.to_s.length > 50
    invalid_properties.push("invalid value for 'country', the character length must be smaller than or equal to 50.")
  end

  if !@security_identifier.nil? && @security_identifier.to_s.length > 184
    invalid_properties.push("invalid value for 'security_identifier', the character length must be smaller than or equal to 184.")
  end

  if !@title.nil? && @title.to_s.length > 100
    invalid_properties.push("invalid value for 'title', the character length must be smaller than or equal to 100.")
  end

  if !@school.nil? && @school.to_s.length > 50
    invalid_properties.push("invalid value for 'school', the character length must be smaller than or equal to 50.")
  end

  if !@nick_name.nil? && @nick_name.to_s.length > 30
    invalid_properties.push("invalid value for 'nick_name', the character length must be smaller than or equal to 30.")
  end

  if !@significant_other.nil? && @significant_other.to_s.length > 30
    invalid_properties.push("invalid value for 'significant_other', the character length must be smaller than or equal to 30.")
  end

  if !@portal_password.nil? && @portal_password.to_s.length > 15
    invalid_properties.push("invalid value for 'portal_password', the character length must be smaller than or equal to 15.")
  end

  if !@portal_security_level.nil? && @portal_security_level > 6
    invalid_properties.push("invalid value for 'portal_security_level', must be smaller than or equal to 6.")
  end

  if !@portal_security_level.nil? && @portal_security_level < 1
    invalid_properties.push("invalid value for 'portal_security_level', must be greater than or equal to 1.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



817
818
819
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 817

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



823
824
825
826
827
828
829
830
831
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 823

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



811
812
813
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 811

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/connectwise-ruby-sdk/models/contact.rb', line 469

def valid?
  return false if @first_name.nil?
  return false if @first_name.to_s.length > 30
  return false if !@last_name.nil? && @last_name.to_s.length > 30
  return false if !@address_line1.nil? && @address_line1.to_s.length > 50
  return false if !@address_line2.nil? && @address_line2.to_s.length > 50
  return false if !@city.nil? && @city.to_s.length > 50
  return false if !@state.nil? && @state.to_s.length > 50
  return false if !@zip.nil? && @zip.to_s.length > 12
  return false if !@country.nil? && @country.to_s.length > 50
  return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184
  return false if !@title.nil? && @title.to_s.length > 100
  return false if !@school.nil? && @school.to_s.length > 50
  return false if !@nick_name.nil? && @nick_name.to_s.length > 30
  return false if !@significant_other.nil? && @significant_other.to_s.length > 30
  return false if !@portal_password.nil? && @portal_password.to_s.length > 15
  return false if !@portal_security_level.nil? && @portal_security_level > 6
  return false if !@portal_security_level.nil? && @portal_security_level < 1
  gender_validator = EnumAttributeValidator.new('String', ["Male", "Female"])
  return false unless gender_validator.valid?(@gender)
  presence_validator = EnumAttributeValidator.new('String', ["Online", "DoNotDisturb", "Away", "Offline", "NoAgent"])
  return false unless presence_validator.valid?(@presence)
  return true
end