Class: UdooNeoRest::ValidateValue

Inherits:
Validate
  • Object
show all
Defined in:
lib/udooneorest/validators.rb

Overview

Validate the Value parameter

value : the value to be validated

Instance Attribute Summary

Attributes inherited from Validate

#error_message, #value

Instance Method Summary collapse

Methods inherited from Validate

#initialize

Constructor Details

This class inherits a constructor from UdooNeoRest::Validate

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


70
71
72
73
74
75
76
77
78
# File 'lib/udooneorest/validators.rb', line 70

def valid?
  if (@value != VALUE_LOW ) && (@value != VALUE_HIGH)
    @error_message = UdooNeoRest::Base.status_error("Value of '#{@value}' is invalid. Should be one of #{VALUE_LOW} or #{VALUE_HIGH}.")
    return false
  end

  @error_message  = nil
  true
end