4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/analytics-psw/events.rb', line 4
def record_event(event_type, metadata = {}, asynchronous = false)
return invalid_event_type_response unless event_type_exists? event_type
return invalid_metadata_response unless dimensions_exist? metadata
_record_event = -> do
metadata[:event_type] = event_type.to_s
body = create_json_body('event', metadata)
http_request(:post, "#{@service_location}/events", nil, body)
end
asynchronous ? Thread.new { _record_event.call } : _record_event.call
end
|