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
Instance Method Details
#dispatch_event(event) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/optimizely/event_dispatcher.rb', line 29 def dispatch_event(event) # Dispatch the event being represented by the Event object. # # event - Event object 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 |