Class: Ferto::Response

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#bodyObject (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_codeObject (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_idObject



15
16
17
# File 'lib/ferto/response.rb', line 15

def job_id
  @job_id ||= body.nil? ? nil : JSON.parse(body)['id']
end