Class: Intrinsic::DetectionsClient
- Inherits:
-
Object
- Object
- Intrinsic::DetectionsClient
- 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:) ⇒ DetectionsClient constructor
Constructor Details
#initialize(request_client:) ⇒ DetectionsClient
13 14 15 16 |
# File 'lib/intrinsic/detections/client.rb', line 13 def initialize(request_client:) # @type [RequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
9 10 11 |
# File 'lib/intrinsic/detections/client.rb', line 9 def request_client @request_client end |
Instance Method Details
#get_detection(id:, request_options: nil) ⇒ DetectionObject
21 22 23 24 25 26 27 28 |
# File 'lib/intrinsic/detections/client.rb', line 21 def get_detection(id:, request_options: nil) 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 |