Class: ForgeOpsTracker::Client
- Inherits:
-
Object
- Object
- ForgeOpsTracker::Client
- Defined in:
- lib/forge_ops_tracker/client.rb
Overview
Delivers one payload over HTTP. Every failure mode -- DNS, connection,
timeout, TLS, a non-2xx response -- is caught here and turned into a
false return rather than a raised exception, since a broken or
unreachable tracker must never be able to break the host app.
Instance Method Summary collapse
- #deliver(payload) ⇒ Object
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(configuration) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/forge_ops_tracker/client.rb', line 11 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#deliver(payload) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/forge_ops_tracker/client.rb', line 15 def deliver(payload) uri = configuration.ingestion_uri return false unless uri response = http_for(uri).request(build_request(uri, payload)) response.is_a?(Net::HTTPSuccess) rescue StandardError => e log { "delivery failed: #{e.class}: #{e.}" } false end |