Class: SimpleFirebase::Response
- Inherits:
-
Object
- Object
- SimpleFirebase::Response
- Defined in:
- lib/simple_firebase/response.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #json_body ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/simple_firebase/response.rb', line 5 def initialize(http_response) @http_response = http_response end |
Instance Method Details
#body ⇒ Object
17 18 19 |
# File 'lib/simple_firebase/response.rb', line 17 def body @http_response.body end |
#json_body ⇒ Object
13 14 15 |
# File 'lib/simple_firebase/response.rb', line 13 def json_body JSON.parse(@http_response.body || 'null') end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/simple_firebase/response.rb', line 9 def success? @http_response.code.to_i >= 200 && @http_response.code.to_i < 300 end |