Class: Motion::HTTP::Response
- Inherits:
-
Object
- Object
- Motion::HTTP::Response
- Defined in:
- lib/common/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.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code, headers, body_string, body_object = nil) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(status_code, headers, body_string, body_object = nil) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 |
# File 'lib/common/http/response.rb', line 6 def initialize(status_code, headers, body_string, body_object = nil) @status_code = status_code @headers = headers @body = body_string @object = body_object end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/common/http/response.rb', line 4 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/common/http/response.rb', line 4 def headers @headers end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
4 5 6 |
# File 'lib/common/http/response.rb', line 4 def object @object end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
4 5 6 |
# File 'lib/common/http/response.rb', line 4 def status_code @status_code end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/common/http/response.rb', line 18 def inspect "<Motion::HTTP::Response status_code:#{status_code} headers:<#{headers.class}> body:<#{body.class}>>" end |
#success? ⇒ Boolean
13 14 15 16 |
# File 'lib/common/http/response.rb', line 13 def success? return false unless status_code status_code >= 200 && status_code < 300 end |