class Honeybadger::Backend::Server
def check_in(id)
-
(Response)
-
Parameters:
-
id
(String
) -- The unique check_in id.
def check_in(id) Response.new(@http.get("#{CHECK_IN_ENDPOINT}/#{id}")) rescue *HTTP_ERRORS => e Response.new(:error, nil, "HTTP Error: #{e.class}") end
def initialize(config)
def initialize(config) @http = Util::HTTP.new(config) super end
def notify(feature, payload)
-
(Response)
-
Parameters:
-
payload
(#to_json
) -- The JSON payload to send. -
feature
(Symbol
) -- The feature which is being notified.
def notify(feature, payload) ENDPOINTS[feature] or raise(BackendError, "Unknown feature: #{feature}") Response.new(@http.post(ENDPOINTS[feature], payload, payload_headers(payload))) rescue *HTTP_ERRORS => e Response.new(:error, nil, "HTTP Error: #{e.class}") end
def payload_headers(payload)
def payload_headers(payload) if payload.respond_to?(:api_key) && payload.api_key { 'X-API-Key' => payload.api_key } end end