Class: Intrinsic::AsyncDetectionsClient
- Inherits:
-
Object
- Object
- Intrinsic::AsyncDetectionsClient
- Defined in:
- lib/intrinsic/detections/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #get_detection(id:, request_options: nil) ⇒ DetectionObject
- #initialize(request_client:) ⇒ AsyncDetectionsClient constructor
Constructor Details
#initialize(request_client:) ⇒ AsyncDetectionsClient
36 37 38 39 |
# File 'lib/intrinsic/detections/client.rb', line 36 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
32 33 34 |
# File 'lib/intrinsic/detections/client.rb', line 32 def request_client @request_client end |
Instance Method Details
#get_detection(id:, request_options: nil) ⇒ DetectionObject
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/intrinsic/detections/client.rb', line 44 def get_detection(id:, request_options: nil) Async do response = @request_client.conn.get("/api/v2/detections/#{id}") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X-API-Key"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end DetectionObject.from_json(json_object: response.body) end end |