Class: Delighted::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/delighted/http_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_status_code, raw_headers, raw_body) ⇒ HTTPResponse

Returns a new instance of HTTPResponse.



5
6
7
8
9
# File 'lib/delighted/http_response.rb', line 5

def initialize(raw_status_code, raw_headers, raw_body)
  @status_code = raw_status_code.to_i
  @headers = raw_headers
  @body = raw_body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/delighted/http_response.rb', line 3

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/delighted/http_response.rb', line 3

def headers
  @headers
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



3
4
5
# File 'lib/delighted/http_response.rb', line 3

def status_code
  @status_code
end

Instance Method Details

#content_typeObject



11
12
13
# File 'lib/delighted/http_response.rb', line 11

def content_type
  get_header_value("content-type")
end

#retry_afterObject



15
16
17
18
19
# File 'lib/delighted/http_response.rb', line 15

def retry_after
  if value = get_header_value("retry-after")
    value.to_i
  end
end