Class: Propertyware::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/propertyware/models/contact.rb

Overview

Contact Response

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



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
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
# File 'lib/propertyware/models/contact.rb', line 210

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Propertyware::Contact` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Propertyware::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'address')
    self.address = attributes[:'address']
  end

  if attributes.key?(:'allow_e_signature')
    self.allow_e_signature = attributes[:'allow_e_signature']
  end

  if attributes.key?(:'alt_email')
    self.alt_email = attributes[:'alt_email']
  end

  if attributes.key?(:'birth_date')
    self.birth_date = attributes[:'birth_date']
  end

  if attributes.key?(:'category')
    self.category = attributes[:'category']
  end

  if attributes.key?(:'comments')
    self.comments = attributes[:'comments']
  end

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

  if attributes.key?(:'created_by')
    self.created_by = attributes[:'created_by']
  end

  if attributes.key?(:'created_date_time')
    self.created_date_time = attributes[:'created_date_time']
  end

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

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'fax')
    self.fax = attributes[:'fax']
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

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

  if attributes.key?(:'home_phone')
    self.home_phone = attributes[:'home_phone']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'job_title')
    self.job_title = attributes[:'job_title']
  end

  if attributes.key?(:'last_modified_by')
    self.last_modified_by = attributes[:'last_modified_by']
  end

  if attributes.key?(:'last_modified_date_time')
    self.last_modified_date_time = attributes[:'last_modified_date_time']
  end

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

  if attributes.key?(:'middle_name')
    self.middle_name = attributes[:'middle_name']
  end

  if attributes.key?(:'mobile_phone')
    self.mobile_phone = attributes[:'mobile_phone']
  end

  if attributes.key?(:'name_on_check')
    self.name_on_check = attributes[:'name_on_check']
  end

  if attributes.key?(:'named_on_lease')
    self.named_on_lease = attributes[:'named_on_lease']
  end

  if attributes.key?(:'other_phone')
    self.other_phone = attributes[:'other_phone']
  end

  if attributes.key?(:'salutation')
    self.salutation = attributes[:'salutation']
  end

  if attributes.key?(:'suffix')
    self.suffix = attributes[:'suffix']
  end

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

  if attributes.key?(:'work_phone')
    self.work_phone = attributes[:'work_phone']
  end
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



19
20
21
# File 'lib/propertyware/models/contact.rb', line 19

def address
  @address
end

#allow_e_signatureObject

Indicates if the contact can receive eSignature request e-mail messages sent through Propertyware.



22
23
24
# File 'lib/propertyware/models/contact.rb', line 22

def allow_e_signature
  @allow_e_signature
end

#alt_emailObject

Alternate e-mail address.



25
26
27
# File 'lib/propertyware/models/contact.rb', line 25

def alt_email
  @alt_email
end

#birth_dateObject

Date of birth.



28
29
30
# File 'lib/propertyware/models/contact.rb', line 28

def birth_date
  @birth_date
end

#categoryObject

Contact category.



31
32
33
# File 'lib/propertyware/models/contact.rb', line 31

def category
  @category
end

#commentsObject

Comments.



34
35
36
# File 'lib/propertyware/models/contact.rb', line 34

def comments
  @comments
end

#companyObject

Company where the contact is employed.



37
38
39
# File 'lib/propertyware/models/contact.rb', line 37

def company
  @company
end

#created_byObject

User who created the record.



40
41
42
# File 'lib/propertyware/models/contact.rb', line 40

def created_by
  @created_by
end

#created_date_timeObject

Date and time the record was created. (Timezone: UTC)



43
44
45
# File 'lib/propertyware/models/contact.rb', line 43

def created_date_time
  @created_date_time
end

#custom_fieldsObject

Custom fields.



46
47
48
# File 'lib/propertyware/models/contact.rb', line 46

def custom_fields
  @custom_fields
end

#emailObject

E-mail address.



49
50
51
# File 'lib/propertyware/models/contact.rb', line 49

def email
  @email
end

#faxObject

Fax.



52
53
54
# File 'lib/propertyware/models/contact.rb', line 52

def fax
  @fax
end

#first_nameObject

First name.



55
56
57
# File 'lib/propertyware/models/contact.rb', line 55

def first_name
  @first_name
end

#genderObject

Gender.



58
59
60
# File 'lib/propertyware/models/contact.rb', line 58

def gender
  @gender
end

#home_phoneObject

Home phone.



61
62
63
# File 'lib/propertyware/models/contact.rb', line 61

def home_phone
  @home_phone
end

#idObject

Unique identifier.



64
65
66
# File 'lib/propertyware/models/contact.rb', line 64

def id
  @id
end

#job_titleObject

Professional title or position for the contact.



67
68
69
# File 'lib/propertyware/models/contact.rb', line 67

def job_title
  @job_title
end

#last_modified_byObject

User who last modified the record.



70
71
72
# File 'lib/propertyware/models/contact.rb', line 70

def last_modified_by
  @last_modified_by
end

#last_modified_date_timeObject

Date and time the record was last modified. (Timezone: UTC)



73
74
75
# File 'lib/propertyware/models/contact.rb', line 73

def last_modified_date_time
  @last_modified_date_time
end

#last_nameObject

Last name.



76
77
78
# File 'lib/propertyware/models/contact.rb', line 76

def last_name
  @last_name
end

#middle_nameObject

Middle name.



79
80
81
# File 'lib/propertyware/models/contact.rb', line 79

def middle_name
  @middle_name
end

#mobile_phoneObject

Mobile phone.



82
83
84
# File 'lib/propertyware/models/contact.rb', line 82

def mobile_phone
  @mobile_phone
end

#name_on_checkObject

Name on check.



85
86
87
# File 'lib/propertyware/models/contact.rb', line 85

def name_on_check
  @name_on_check
end

#named_on_leaseObject

Indicates if contact is named on lease.



88
89
90
# File 'lib/propertyware/models/contact.rb', line 88

def named_on_lease
  @named_on_lease
end

#other_phoneObject

Other phone.



91
92
93
# File 'lib/propertyware/models/contact.rb', line 91

def other_phone
  @other_phone
end

#salutationObject

Salutation.



94
95
96
# File 'lib/propertyware/models/contact.rb', line 94

def salutation
  @salutation
end

#suffixObject

Suffix.



97
98
99
# File 'lib/propertyware/models/contact.rb', line 97

def suffix
  @suffix
end

#typeObject

Contact type.



100
101
102
# File 'lib/propertyware/models/contact.rb', line 100

def type
  @type
end

#work_phoneObject

Work phone.



103
104
105
# File 'lib/propertyware/models/contact.rb', line 103

def work_phone
  @work_phone
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



163
164
165
# File 'lib/propertyware/models/contact.rb', line 163

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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/propertyware/models/contact.rb', line 128

def self.attribute_map
  {
    :'address' => :'address',
    :'allow_e_signature' => :'allowESignature',
    :'alt_email' => :'altEmail',
    :'birth_date' => :'birthDate',
    :'category' => :'category',
    :'comments' => :'comments',
    :'company' => :'company',
    :'created_by' => :'createdBy',
    :'created_date_time' => :'createdDateTime',
    :'custom_fields' => :'customFields',
    :'email' => :'email',
    :'fax' => :'fax',
    :'first_name' => :'firstName',
    :'gender' => :'gender',
    :'home_phone' => :'homePhone',
    :'id' => :'id',
    :'job_title' => :'jobTitle',
    :'last_modified_by' => :'lastModifiedBy',
    :'last_modified_date_time' => :'lastModifiedDateTime',
    :'last_name' => :'lastName',
    :'middle_name' => :'middleName',
    :'mobile_phone' => :'mobilePhone',
    :'name_on_check' => :'nameOnCheck',
    :'named_on_lease' => :'namedOnLease',
    :'other_phone' => :'otherPhone',
    :'salutation' => :'salutation',
    :'suffix' => :'suffix',
    :'type' => :'type',
    :'work_phone' => :'workPhone'
  }
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



430
431
432
# File 'lib/propertyware/models/contact.rb', line 430

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



203
204
205
206
# File 'lib/propertyware/models/contact.rb', line 203

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/propertyware/models/contact.rb', line 168

def self.openapi_types
  {
    :'address' => :'Address',
    :'allow_e_signature' => :'Boolean',
    :'alt_email' => :'String',
    :'birth_date' => :'Date',
    :'category' => :'String',
    :'comments' => :'String',
    :'company' => :'String',
    :'created_by' => :'String',
    :'created_date_time' => :'Time',
    :'custom_fields' => :'Array<CustomField>',
    :'email' => :'String',
    :'fax' => :'String',
    :'first_name' => :'String',
    :'gender' => :'String',
    :'home_phone' => :'String',
    :'id' => :'Integer',
    :'job_title' => :'String',
    :'last_modified_by' => :'String',
    :'last_modified_date_time' => :'Time',
    :'last_name' => :'String',
    :'middle_name' => :'String',
    :'mobile_phone' => :'String',
    :'name_on_check' => :'String',
    :'named_on_lease' => :'Boolean',
    :'other_phone' => :'String',
    :'salutation' => :'String',
    :'suffix' => :'String',
    :'type' => :'String',
    :'work_phone' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/propertyware/models/contact.rb', line 381

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address == o.address &&
      allow_e_signature == o.allow_e_signature &&
      alt_email == o.alt_email &&
      birth_date == o.birth_date &&
      category == o.category &&
      comments == o.comments &&
      company == o.company &&
      created_by == o.created_by &&
      created_date_time == o.created_date_time &&
      custom_fields == o.custom_fields &&
      email == o.email &&
      fax == o.fax &&
      first_name == o.first_name &&
      gender == o.gender &&
      home_phone == o.home_phone &&
      id == o.id &&
      job_title == o.job_title &&
      last_modified_by == o.last_modified_by &&
      last_modified_date_time == o.last_modified_date_time &&
      last_name == o.last_name &&
      middle_name == o.middle_name &&
      mobile_phone == o.mobile_phone &&
      name_on_check == o.name_on_check &&
      named_on_lease == o.named_on_lease &&
      other_phone == o.other_phone &&
      salutation == o.salutation &&
      suffix == o.suffix &&
      type == o.type &&
      work_phone == o.work_phone
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



461
462
463
464
465
466
467
468
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
# File 'lib/propertyware/models/contact.rb', line 461

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = Propertyware.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/propertyware/models/contact.rb', line 532

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



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/propertyware/models/contact.rb', line 437

def build_from_hash(attributes)
  return unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that 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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


417
418
419
# File 'lib/propertyware/models/contact.rb', line 417

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



423
424
425
# File 'lib/propertyware/models/contact.rb', line 423

def hash
  [address, allow_e_signature, alt_email, birth_date, category, comments, company, created_by, created_date_time, custom_fields, email, fax, first_name, gender, home_phone, id, job_title, last_modified_by, last_modified_date_time, last_name, middle_name, mobile_phone, name_on_check, named_on_lease, other_phone, salutation, suffix, type, work_phone].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



344
345
346
347
# File 'lib/propertyware/models/contact.rb', line 344

def list_invalid_properties
  invalid_properties = Array.new
  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



508
509
510
# File 'lib/propertyware/models/contact.rb', line 508

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



514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/propertyware/models/contact.rb', line 514

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



502
503
504
# File 'lib/propertyware/models/contact.rb', line 502

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



351
352
353
354
355
356
357
# File 'lib/propertyware/models/contact.rb', line 351

def valid?
  gender_validator = EnumAttributeValidator.new('String', ["UNKNOWN", "MALE", "FEMALE", "DECLINE_TO_STATE"])
  return false unless gender_validator.valid?(@gender)
  type_validator = EnumAttributeValidator.new('String', ["TENANT", "PROSPECT", "OWNER", "VENDOR", "OTHER"])
  return false unless type_validator.valid?(@type)
  true
end