Method: Propertyware::SaveContact#valid?

Defined in:
lib/propertyware/models/save_contact.rb

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



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

def valid?
  return false if !@company.nil? && @company.to_s.length > 75
  return false if !@company.nil? && @company.to_s.length < 1
  return false if @first_name.nil?
  return false if @first_name.to_s.length > 30
  return false if @first_name.to_s.length < 1
  gender_validator = EnumAttributeValidator.new('String', ["UNKNOWN", "MALE", "FEMALE", "DECLINE_TO_STATE"])
  return false unless gender_validator.valid?(@gender)
  return false if !@home_phone.nil? && @home_phone.to_s.length > 22
  return false if !@home_phone.nil? && @home_phone.to_s.length < 1
  return false if !@job_title.nil? && @job_title.to_s.length > 75
  return false if !@job_title.nil? && @job_title.to_s.length < 1
  return false if @last_name.nil?
  return false if @last_name.to_s.length > 30
  return false if @last_name.to_s.length < 1
  return false if !@middle_name.nil? && @middle_name.to_s.length > 30
  return false if !@middle_name.nil? && @middle_name.to_s.length < 1
  return false if !@mobile_phone.nil? && @mobile_phone.to_s.length > 22
  return false if !@mobile_phone.nil? && @mobile_phone.to_s.length < 1
  return false if !@name_on_check.nil? && @name_on_check.to_s.length > 100
  return false if !@name_on_check.nil? && @name_on_check.to_s.length < 1
  return false if !@other_phone.nil? && @other_phone.to_s.length > 22
  return false if !@other_phone.nil? && @other_phone.to_s.length < 1
  return false if !@work_phone.nil? && @work_phone.to_s.length > 22
  return false if !@work_phone.nil? && @work_phone.to_s.length < 1
  true
end