lib/firebase-ruby/database.rb in firebase-ruby-0.2.0.1 vs lib/firebase-ruby/database.rb in firebase-ruby-0.3.0
- old
+ new
@@ -1,9 +1,10 @@
-module Firebase
+require 'firebase-ruby/neko-http'
- class Database
+module Firebase
+ class Database
FIREBASE_URL_TEMPLATE = 'https://%s.firebaseio.com/'
attr_accessor :auth, :print, :shallow
def initialize()
@@ -57,11 +58,11 @@
end
def http
unless @http
url = FIREBASE_URL_TEMPLATE % project_id
- @http = HTTP.new(url, {'Content-Type' => 'application/json'})
+ @http = Neko::HTTP.new(url, {'Content-Type' => 'application/json'})
end
@http.headers['Authorization'] = "Bearer #{auth.valid_token}"
return @http
end
@@ -75,9 +76,7 @@
Firebase.logger.error("HTTP response error: #{data[:code]}\n#{data[:message]}")
return nil
end
return JSON.parse(data[:body], {symbolize_names: true})
end
-
end
-
end