Class: UdooNeoRest::ValidateDirection

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

Overview

Validate the Direction parameter

value : the direction 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)


32
33
34
35
36
37
38
39
40
# File 'lib/udooneorest/validators.rb', line 32

def valid?
  if (@value != DIRECTION_IN ) && (@value != DIRECTION_OUT)
    @error_message = UdooNeoRest::Base.status_error("Direction value of '#{@value}' is invalid. Should only be 'in' or 'out'.")
    return false
  end

  @error_message  = nil
  true
end