Class: Coarnotify::Http::NetHttpResponse
- Inherits:
-
HttpResponse
- Object
- HttpResponse
- Coarnotify::Http::NetHttpResponse
- Defined in:
- lib/coarnotify/http.rb
Overview
Implementation of the HTTP response object using Net::HTTP
This wraps the Net::HTTP response object and provides the interface required by the client
Instance Method Summary collapse
-
#header(header_name) ⇒ String
Get the value of a header from the response.
-
#initialize(resp) ⇒ NetHttpResponse
constructor
Construct the object as a wrapper around the original Net::HTTP response object.
-
#net_http_response ⇒ Net::HTTPResponse
Get the original Net::HTTP response object.
-
#status_code ⇒ Integer
Get the status code of the response.
Constructor Details
#initialize(resp) ⇒ NetHttpResponse
Construct the object as a wrapper around the original Net::HTTP response object
121 122 123 |
# File 'lib/coarnotify/http.rb', line 121 def initialize(resp) @resp = resp end |
Instance Method Details
#header(header_name) ⇒ String
Get the value of a header from the response
129 130 131 |
# File 'lib/coarnotify/http.rb', line 129 def header(header_name) @resp[header_name] end |
#net_http_response ⇒ Net::HTTPResponse
Get the original Net::HTTP response object
143 144 145 |
# File 'lib/coarnotify/http.rb', line 143 def net_http_response @resp end |
#status_code ⇒ Integer
Get the status code of the response
136 137 138 |
# File 'lib/coarnotify/http.rb', line 136 def status_code @resp.code.to_i end |