Class: Dogapi::EventService
Overview
DEPRECATED: Going forward, use the V1 services. This legacy service will be removed in an upcoming release.
Constant Summary collapse
- API_VERSION =
'1.0.0'
- MAX_BODY_LENGTH =
4000
- MAX_TITLE_LENGTH =
100
Instance Method Summary collapse
-
#start(api_key, event, scope, source_type = nil) ⇒ Object
DEPRECATED: Going forward, use the V1 services.
-
#submit(api_key, event, scope = nil, source_type = nil) ⇒ Object
DEPRECATED: Going forward, use the V1 services.
Methods inherited from Service
#connect, #initialize, #request
Constructor Details
This class inherits a constructor from Dogapi::Service
Instance Method Details
#start(api_key, event, scope, source_type = nil) ⇒ Object
DEPRECATED: Going forward, use the V1 services. This legacy service will be removed in an upcoming release.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/dogapi/event.rb', line 105 def start(api_key, event, scope, source_type=nil) warn '[DEPRECATION] Dogapi::EventService.start() has been deprecated in favor of the newer V1 services' response = submit api_key, event, scope, source_type success = nil begin yield response rescue success = false raise else success = true ensure return finish api_key, response['id'], success end end |
#submit(api_key, event, scope = nil, source_type = nil) ⇒ Object
DEPRECATED: Going forward, use the V1 services. This legacy service will be removed in an upcoming release.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/dogapi/event.rb', line 75 def submit(api_key, event, scope=nil, source_type=nil) warn '[DEPRECATION] Dogapi::EventService.submit() has been deprecated in favor of the newer V1 services' scope = scope || Dogapi::Scope.new() params = { :api_key => api_key, :api_version => API_VERSION, :host => scope.host, :device => scope.device, :metric => event.metric, :date_detected => event.date_detected, :date_happened => event.date_happened, :alert_type => event.alert_type, :event_type => event.event_type, :event_object => event.event_object, :msg_title => event.msg_title[0..MAX_TITLE_LENGTH - 1], :msg_text => event.msg_text[0..MAX_BODY_LENGTH - 1], :json_payload => event.json_payload, } if source_type params[:source_type] = source_type end request Net::HTTP::Post, '/event/submit', params end |