Class: Delighted::HTTPResponse
- Inherits:
-
Object
- Object
- Delighted::HTTPResponse
- Defined in:
- lib/delighted/http_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(raw_status_code, raw_headers, raw_body) ⇒ HTTPResponse
constructor
A new instance of HTTPResponse.
- #next_link ⇒ Object
- #retry_after ⇒ Object
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/delighted/http_response.rb', line 3 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/delighted/http_response.rb', line 3 def headers @headers end |
#status_code ⇒ Object (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_type ⇒ Object
11 12 13 |
# File 'lib/delighted/http_response.rb', line 11 def content_type get_header_value("content-type") end |
#next_link ⇒ Object
15 16 17 18 |
# File 'lib/delighted/http_response.rb', line 15 def next_link link_header = get_header_value("link") parse_link_header(link_header)[:next] end |
#retry_after ⇒ Object
20 21 22 23 24 |
# File 'lib/delighted/http_response.rb', line 20 def retry_after if value = get_header_value("retry-after") value.to_i end end |