Class: Verizon::TriggerCondition
- Inherits:
-
Object
- Object
- Verizon::TriggerCondition
- Defined in:
- lib/verizon/models/trigger_condition.rb
Overview
The following options are supported as Trigger TriggerConditions: - enter: The message is triggered when the road user enters the geofence. For polygons and multi-polygons only. In case of multi-polygons the message is triggered when the road user enters any of the polygons. - leave: The message is triggered when the road user leaves the geofence. For polygons and multi-polygons only. In case of multi-polygons the message is triggered when the road user leaves any of the polygons. - inside: The message is triggered when the road user is inside the geofence. For polygons and multi-polygons only. In case of multi-polygons the message is triggered when the road user is inside any of the polygons. - crossing: The message is triggered when the road user crosses the geofence. For lines and multi-lines only. In case of multi-lines the message is triggered when the road user crosses any of the lines.
Constant Summary collapse
- TRIGGER_CONDITION =
[ # TODO: Write general description for ENTER ENTER = 'enter'.freeze, # TODO: Write general description for LEAVE LEAVE = 'leave'.freeze, # TODO: Write general description for INSIDE INSIDE = 'inside'.freeze, # TODO: Write general description for CROSSING CROSSING = 'crossing'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ENTER) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/verizon/models/trigger_condition.rb', line 41 def self.from_value(value, default_value = ENTER) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'enter' then ENTER when 'leave' then LEAVE when 'inside' then INSIDE when 'crossing' then CROSSING else default_value end end |
.validate(value) ⇒ Object
35 36 37 38 39 |
# File 'lib/verizon/models/trigger_condition.rb', line 35 def self.validate(value) return false if value.nil? TRIGGER_CONDITION.include?(value) end |