Method: Propertyware::SaveContact#list_invalid_properties

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

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  invalid_properties = Array.new
  if !@company.nil? && @company.to_s.length > 75
    invalid_properties.push('invalid value for "company", the character length must be smaller than or equal to 75.')
  end

  if !@company.nil? && @company.to_s.length < 1
    invalid_properties.push('invalid value for "company", the character length must be great than or equal to 1.')
  end

  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 @first_name.to_s.length < 1
    invalid_properties.push('invalid value for "first_name", the character length must be great than or equal to 1.')
  end

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

  if !@home_phone.nil? && @home_phone.to_s.length < 1
    invalid_properties.push('invalid value for "home_phone", the character length must be great than or equal to 1.')
  end

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

  if !@job_title.nil? && @job_title.to_s.length < 1
    invalid_properties.push('invalid value for "job_title", the character length must be great than or equal to 1.')
  end

  if @last_name.nil?
    invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
  end

  if @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 @last_name.to_s.length < 1
    invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.')
  end

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

  if !@middle_name.nil? && @middle_name.to_s.length < 1
    invalid_properties.push('invalid value for "middle_name", the character length must be great than or equal to 1.')
  end

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

  if !@mobile_phone.nil? && @mobile_phone.to_s.length < 1
    invalid_properties.push('invalid value for "mobile_phone", the character length must be great than or equal to 1.')
  end

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

  if !@name_on_check.nil? && @name_on_check.to_s.length < 1
    invalid_properties.push('invalid value for "name_on_check", the character length must be great than or equal to 1.')
  end

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

  if !@other_phone.nil? && @other_phone.to_s.length < 1
    invalid_properties.push('invalid value for "other_phone", the character length must be great than or equal to 1.')
  end

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

  if !@work_phone.nil? && @work_phone.to_s.length < 1
    invalid_properties.push('invalid value for "work_phone", the character length must be great than or equal to 1.')
  end

  invalid_properties
end