8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/cloudfuji/expectation.rb', line 8
def create!(options={})
return StandardError("Cloudfuji::Event format incorrect, please make sure you're using the correct structure for sending events") unless !options[:criteria].nil? && !options[:expires_at].nil? && !options[:event].nil?
return StandardError("Cloudfuji::Event format incorrect, please make sure you're using the correct structure for sending events") unless !options[:event][:category].nil? && !options[:event][:name].nil? && !options[:event][:data].nil?
expectation = {}
expectation[:criteria] = options[:criteria]
expectation[:expires_at] = options[:expires_at]
expectation[:event] = options[:event]
expectation[:parent_event_id] = options[:parent_event_id]
payload = {:expectation => expectation}
Cloudfuji::Command.post_command(expectations_url, payload)
end
|