Class: Firebase::Response
- Inherits:
-
Object
- Object
- Firebase::Response
- Defined in:
- lib/firebase/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #raw_body ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/firebase/response.rb', line 5 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/firebase/response.rb', line 3 def response @response end |
Instance Method Details
#body ⇒ Object
9 10 11 |
# File 'lib/firebase/response.rb', line 9 def body JSON.parse(response.body, :quirks_mode => true) end |
#code ⇒ Object
21 22 23 |
# File 'lib/firebase/response.rb', line 21 def code response.status end |
#raw_body ⇒ Object
13 14 15 |
# File 'lib/firebase/response.rb', line 13 def raw_body response.body end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/firebase/response.rb', line 17 def success? [200, 204].include? response.status end |