Class: Sqreen::Kit::Signals::AuthSignalsClient
- Inherits:
-
Object
- Object
- Sqreen::Kit::Signals::AuthSignalsClient
- Defined in:
- lib/sqreen/kit/signals/auth_signals_client.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
for testing only.
Instance Method Summary collapse
-
#initialize(signals_client, auth_data) ⇒ AuthSignalsClient
constructor
A new instance of AuthSignalsClient.
- #report_batch(signals_and_traces) ⇒ Object
- #report_signal(signal) ⇒ Object
- #report_trace(trace) ⇒ Object
Constructor Details
#initialize(signals_client, auth_data) ⇒ AuthSignalsClient
Returns a new instance of AuthSignalsClient.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sqreen/kit/signals/auth_signals_client.rb', line 16 def initialize(signals_client, auth_data) @signals_client = signals_client @headers = {} session_key = auth_data[:session_key] api_key = auth_data[:api_key] app_name = auth_data[:app_name] if session_key @headers['X-Session-Key'] = session_key elsif api_key @headers['X-Api-Key'] = api_key @headers['X-App-Name'] = app_name if app_name else raise ArgumentError, 'Authentication data not provided' end end |
Instance Attribute Details
#headers ⇒ Object (readonly)
for testing only
12 13 14 |
# File 'lib/sqreen/kit/signals/auth_signals_client.rb', line 12 def headers @headers end |
Instance Method Details
#report_batch(signals_and_traces) ⇒ Object
34 35 36 |
# File 'lib/sqreen/kit/signals/auth_signals_client.rb', line 34 def report_batch(signals_and_traces) @signals_client.report_batch(signals_and_traces, @headers) end |
#report_signal(signal) ⇒ Object
39 40 41 |
# File 'lib/sqreen/kit/signals/auth_signals_client.rb', line 39 def report_signal(signal) @signals_client.report_signal(signal, @headers) end |
#report_trace(trace) ⇒ Object
44 45 46 |
# File 'lib/sqreen/kit/signals/auth_signals_client.rb', line 44 def report_trace(trace) @signals_client.report_trace(trace, @headers) end |