Class: Pebblebed::Http::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/pebblebed/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(easy) ⇒ Response

Returns a new instance of Response.



48
49
50
51
52
53
# File 'lib/pebblebed/http.rb', line 48

def initialize(easy)
  @body = easy.body_str
  # We parse it ourselves because Curl::Easy fails when there's no text message
  @status = easy.header_str.scan(/HTTP\/\d\.\d\s(\d+)\s/).map(&:first).last.to_i
  @url = easy.url
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



55
56
57
# File 'lib/pebblebed/http.rb', line 55

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



55
56
57
# File 'lib/pebblebed/http.rb', line 55

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



55
56
57
# File 'lib/pebblebed/http.rb', line 55

def url
  @url
end