Class: Scanii::PendingResult
- Inherits:
-
Object
- Object
- Scanii::PendingResult
- Defined in:
- lib/scanii/pending_result.rb
Overview
Result of an asynchronous scan submission returned by Client#process_async and Client#fetch.
The actual scan result is fetched later via Client#retrieve, or delivered to the supplied callback URL.
Instance Attribute Summary collapse
-
#host_id ⇒ Object
readonly
Returns the value of attribute host_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#resource_location ⇒ Object
readonly
Returns the value of attribute resource_location.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, request_id:, host_id:, resource_location:, raw_response:) ⇒ PendingResult
constructor
A new instance of PendingResult.
Constructor Details
#initialize(id:, request_id:, host_id:, resource_location:, raw_response:) ⇒ PendingResult
Returns a new instance of PendingResult.
14 15 16 17 18 19 20 |
# File 'lib/scanii/pending_result.rb', line 14 def initialize(id:, request_id:, host_id:, resource_location:, raw_response:) @id = id @request_id = request_id @host_id = host_id @resource_location = resource_location @raw_response = raw_response end |
Instance Attribute Details
#host_id ⇒ Object (readonly)
Returns the value of attribute host_id.
12 13 14 |
# File 'lib/scanii/pending_result.rb', line 12 def host_id @host_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/scanii/pending_result.rb', line 12 def id @id end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
12 13 14 |
# File 'lib/scanii/pending_result.rb', line 12 def raw_response @raw_response end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
12 13 14 |
# File 'lib/scanii/pending_result.rb', line 12 def request_id @request_id end |
#resource_location ⇒ Object (readonly)
Returns the value of attribute resource_location.
12 13 14 |
# File 'lib/scanii/pending_result.rb', line 12 def resource_location @resource_location end |
Class Method Details
.from_response(body, headers) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/scanii/pending_result.rb', line 22 def self.from_response(body, headers) json = body.nil? || body.empty? ? {} : JSON.parse(body) new( id: (json["id"] || "").to_s, request_id: headers["x-scanii-request-id"], host_id: headers["x-scanii-host-id"], resource_location: headers["location"], raw_response: body ) end |