Class: Optimizely::EventDispatcher
- Inherits:
-
Object
- Object
- Optimizely::EventDispatcher
- Defined in:
- lib/optimizely/event_dispatcher.rb
Constant Summary collapse
- REQUEST_TIMEOUT =
10
Instance Method Summary collapse
-
#dispatch_event(event) ⇒ Object
Dispatch the event being represented by the Event object.
Instance Method Details
#dispatch_event(event) ⇒ Object
Dispatch the event being represented by the Event object.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/optimizely/event_dispatcher.rb', line 34 def dispatch_event(event) if event.http_verb == :get begin HTTParty.get(event.url, headers: event.headers, query: event.params, timeout: REQUEST_TIMEOUT) rescue Timeout::Error => e return e end elsif event.http_verb == :post begin HTTParty.post(event.url, body: event.params.to_json, headers: event.headers, timeout: REQUEST_TIMEOUT) rescue Timeout::Error => e return e end end end |