Class: SimpleFirebase::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_firebase/response.rb

Instance Method Summary collapse

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

#bodyObject



17
18
19
# File 'lib/simple_firebase/response.rb', line 17

def body
  @http_response.body
end

#json_bodyObject



13
14
15
# File 'lib/simple_firebase/response.rb', line 13

def json_body
  JSON.parse(@http_response.body || 'null')
end

#success?Boolean

Returns:

  • (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