Class: Honeybadger::Backend::Server Private
- Defined in:
- lib/honeybadger/backend/server.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- ENDPOINTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ notices: '/v1/notices'.freeze, deploys: '/v1/deploys'.freeze, }.freeze
- CHECK_IN_ENDPOINT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/v1/check_in'.freeze
- EVENTS_ENDPOINT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/v1/events'.freeze
- HTTP_ERRORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Util::HTTP::ERRORS
Instance Method Summary collapse
-
#check_in(id) ⇒ Response
private
Does a check in using the input id.
-
#event(payload) ⇒ Response
private
Send event.
-
#initialize(config) ⇒ Server
constructor
private
A new instance of Server.
-
#notify(feature, payload) ⇒ Response
private
Post payload to endpoint for feature.
Methods inherited from Base
Constructor Details
#initialize(config) ⇒ Server
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Server.
21 22 23 24 |
# File 'lib/honeybadger/backend/server.rb', line 21 def initialize(config) @http = Util::HTTP.new(config) super end |
Instance Method Details
#check_in(id) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Does a check in using the input id.
44 45 46 47 48 |
# File 'lib/honeybadger/backend/server.rb', line 44 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 |
#event(payload) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Send event
56 57 58 59 60 |
# File 'lib/honeybadger/backend/server.rb', line 56 def event(payload) Response.new(@http.post_newline_delimited(EVENTS_ENDPOINT, payload)) rescue *HTTP_ERRORS => e Response.new(:error, nil, "HTTP Error: #{e.class}") end |
#notify(feature, payload) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Post payload to endpoint for feature.
32 33 34 35 36 37 |
# File 'lib/honeybadger/backend/server.rb', line 32 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 |