Class: NetNoop::Response
- Inherits:
-
Object
- Object
- NetNoop::Response
- Defined in:
- lib/netnoop/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 ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 |
# File 'lib/netnoop/response.rb', line 7 def initialize(http_response) @status = http_response.code @body = http_response.body @headers = http_response.header.to_hash end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/netnoop/response.rb', line 4 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/netnoop/response.rb', line 5 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/netnoop/response.rb', line 3 def status @status end |
Instance Method Details
#content_type ⇒ Object
13 14 15 16 17 18 |
# File 'lib/netnoop/response.rb', line 13 def content_type if ct = headers['content-type'] return ct.first if ct.is_a?(Array) return ct end end |