Class: UnderOs::HTTP::Response
- Inherits:
-
Object
- Object
- UnderOs::HTTP::Response
- Defined in:
- lib/under_os/http/response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #body ⇒ Object
- #content_length ⇒ Object
- #content_type ⇒ Object
- #headers ⇒ Object
-
#initialize(response, data) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response, data) ⇒ Response
Returns a new instance of Response.
4 5 6 7 |
# File 'lib/under_os/http/response.rb', line 4 def initialize(response, data) @response = response @data = data # raw NSData end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
2 3 4 |
# File 'lib/under_os/http/response.rb', line 2 def data @data end |
Instance Method Details
#body ⇒ Object
13 14 15 |
# File 'lib/under_os/http/response.rb', line 13 def body @body ||= @data.to_s end |
#content_length ⇒ Object
17 18 19 |
# File 'lib/under_os/http/response.rb', line 17 def content_length headers["Content-Length"].to_i end |
#content_type ⇒ Object
21 22 23 |
# File 'lib/under_os/http/response.rb', line 21 def content_type headers["Content-Type"] end |
#headers ⇒ Object
9 10 11 |
# File 'lib/under_os/http/response.rb', line 9 def headers @response.allHeaderFields end |