Class: Ferto::Response
- Inherits:
-
Object
- Object
- Ferto::Response
- Defined in:
- lib/ferto/response.rb
Overview
A point-in-time snapshot of a download response. The underlying Curl::Easy handle is reused by the thread's next download, so every field is captured eagerly here and the handle is not retained.
Instance Attribute Summary collapse
-
#body ⇒ Object
(also: #body_str)
readonly
Returns the value of attribute body.
-
#response_code ⇒ Object
readonly
Returns the value of attribute response_code.
Instance Method Summary collapse
-
#initialize(handle) ⇒ Response
constructor
A new instance of Response.
- #job_id ⇒ Object
Constructor Details
#initialize(handle) ⇒ Response
Returns a new instance of Response.
10 11 12 13 |
# File 'lib/ferto/response.rb', line 10 def initialize(handle) @response_code = handle.response_code @body = handle.body end |
Instance Attribute Details
#body ⇒ Object (readonly) Also known as: body_str
Returns the value of attribute body.
6 7 8 |
# File 'lib/ferto/response.rb', line 6 def body @body end |
#response_code ⇒ Object (readonly)
Returns the value of attribute response_code.
6 7 8 |
# File 'lib/ferto/response.rb', line 6 def response_code @response_code end |
Instance Method Details
#job_id ⇒ Object
15 16 17 |
# File 'lib/ferto/response.rb', line 15 def job_id @job_id ||= body.nil? ? nil : JSON.parse(body)['id'] end |