Class: NRB::HTTPService::Response
- Inherits:
-
Object
- Object
- NRB::HTTPService::Response
- Defined in:
- lib/drink-socially/http_service/response.rb
Direct Known Subclasses
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
- #errored? ⇒ Boolean
-
#initialize(args) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(args) ⇒ Response
Returns a new instance of Response.
14 15 16 17 18 |
# File 'lib/drink-socially/http_service/response.rb', line 14 def initialize(args) @status = args[:status] @body = Hashie::Mash.new args[:body] @headers = Hashie::Mash.new args[:headers] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/drink-socially/http_service/response.rb', line 7 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/drink-socially/http_service/response.rb', line 7 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/drink-socially/http_service/response.rb', line 7 def status @status end |
Instance Method Details
#errored? ⇒ Boolean
9 10 11 |
# File 'lib/drink-socially/http_service/response.rb', line 9 def errored? ! success? end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/drink-socially/http_service/response.rb', line 21 def success? @status >= 200 && @status < 300 end |