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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/optimizely/event_dispatcher.rb', line 14 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 |