Method: Jets::Job::Dsl::IotEvent#iot_event

Defined in:
lib/jets/job/dsl/iot_event.rb

#iot_event(props = {}) ⇒ Object

The user must at least pass in an SQL statement



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/jets/job/dsl/iot_event.rb', line 4

def iot_event(props={})
  if props.is_a?(String) # SQL Statement
    props = {sql: props}
    topic_props = {topic_rule_payload: props}
  elsif props.key?(:topic_rule_payload) # full properties structure
    topic_props = props
  else # just the topic_rule_payload
    topic_props = {topic_rule_payload: props}
  end

  declare_iot_topic(topic_props)
end