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.



41
42
43
44
45
46
# File 'lib/pebblebed/http.rb', line 41

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.



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

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end