Class: BrainzLab::Reflex::Client
- Inherits:
-
Object
- Object
- BrainzLab::Reflex::Client
- Defined in:
- lib/brainzlab/reflex/client.rb
Defined Under Namespace
Classes: RetryableError
Constant Summary collapse
- MAX_RETRIES =
3- RETRY_DELAY =
0.5
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #send_batch(payloads) ⇒ Object
- #send_error(payload) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
13 14 15 |
# File 'lib/brainzlab/reflex/client.rb', line 13 def initialize(config) @config = config end |
Instance Method Details
#send_batch(payloads) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/brainzlab/reflex/client.rb', line 23 def send_batch(payloads) return unless @config.reflex_enabled && @config.reflex_valid? return if payloads.empty? post('/api/v1/errors/batch', { errors: payloads }) end |
#send_error(payload) ⇒ Object
17 18 19 20 21 |
# File 'lib/brainzlab/reflex/client.rb', line 17 def send_error(payload) return unless @config.reflex_enabled && @config.reflex_valid? post('/api/v1/errors', payload) end |