Class: Checkend::Client
- Inherits:
-
Object
- Object
- Checkend::Client
- Defined in:
- lib/checkend/client.rb
Overview
HTTP client for sending error notices to the Checkend API.
Uses Net::HTTP from Ruby stdlib with no external dependencies.
Constant Summary collapse
- INGEST_PATH =
'/ingest/v1/errors'- USER_AGENT =
"checkend-ruby/#{VERSION} Ruby/#{RUBY_VERSION}"
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
-
#send_notice(notice) ⇒ Hash?
Send a notice to the Checkend API.
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
17 18 19 20 |
# File 'lib/checkend/client.rb', line 17 def initialize(config) @config = config @uri = URI.parse("#{config.endpoint}#{INGEST_PATH}") end |
Instance Method Details
#send_notice(notice) ⇒ Hash?
Send a notice to the Checkend API
26 27 28 29 30 31 32 |
# File 'lib/checkend/client.rb', line 26 def send_notice(notice) response = post(notice.to_json) handle_response(response) rescue StandardError => e log_error("Failed to send notice: #{e.class} - #{e.}") nil end |