class Dogapi::EventService
DEPRECATED: Going forward, use the V1
services. This legacy service will be removed in an upcoming release.
Constants
- API_VERSION
- MAX_BODY_LENGTH
- MAX_TITLE_LENGTH
Public Instance Methods
start(api_key, event, scope, source_type=nil) { |response| ... }
click to toggle source
DEPRECATED: Going forward, use the V1
services. This legacy service will be removed in an upcoming release.
# File lib/dogapi/event.rb 105 def start(api_key, event, scope, source_type=nil) 106 warn '[DEPRECATION] Dogapi::EventService.start() has been deprecated in favor of the newer V1 services' 107 response = submit api_key, event, scope, source_type 108 success = nil 109 110 begin 111 yield response 112 rescue 113 success = false 114 raise 115 else 116 success = true 117 ensure 118 return finish api_key, response['id'], success 119 end 120 end
submit(api_key, event, scope=nil, source_type=nil)
click to toggle source
DEPRECATED: Going forward, use the V1
services. This legacy service will be removed in an upcoming release.
# File lib/dogapi/event.rb 75 def submit(api_key, event, scope=nil, source_type=nil) 76 warn '[DEPRECATION] Dogapi::EventService.submit() has been deprecated in favor of the newer V1 services' 77 scope = scope || Dogapi::Scope.new() 78 params = { 79 :api_key => api_key, 80 :api_version => API_VERSION, 81 82 :host => scope.host, 83 :device => scope.device, 84 85 :metric => event.metric, 86 :date_detected => event.date_detected, 87 :date_happened => event.date_happened, 88 :alert_type => event.alert_type, 89 :event_type => event.event_type, 90 :event_object => event.event_object, 91 :msg_title => event.msg_title[0..MAX_TITLE_LENGTH - 1], 92 :msg_text => event.msg_text[0..MAX_BODY_LENGTH - 1], 93 :json_payload => event.json_payload, 94 } 95 96 if source_type 97 params[:source_type] = source_type 98 end 99 100 request Net::HTTP::Post, '/event/submit', params 101 end
Private Instance Methods
finish(api_key, event_id, successful=nil)
click to toggle source
# File lib/dogapi/event.rb 124 def finish(api_key, event_id, successful=nil) 125 params = { 126 :api_key => api_key, 127 :event_id => event_id 128 } 129 130 request Net::HTTP::Post, '/event/ended', params 131 end