Class: Firebase::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/firebase/response.rb', line 3

def response
  @response
end

Instance Method Details

#bodyObject



9
10
11
# File 'lib/firebase/response.rb', line 9

def body
  JSON.parse(response.body, :quirks_mode => true)
end

#codeObject



21
22
23
# File 'lib/firebase/response.rb', line 21

def code
  response.status
end

#raw_bodyObject



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

def raw_body
  response.body
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  [200, 204].include? response.status
end