Module: Jets::Job::Dsl::IotEvent

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

Instance Method Summary collapse

Instance Method Details

#declare_iot_topic(props = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/jets/job/dsl/iot_event.rb', line 17

def declare_iot_topic(props={})
  r = Jets::Resource::Iot::TopicRule.new(props)
  with_fresh_properties do
    resource(r.definition) # add associated resource immediately
  end
end

#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