Created
August 4, 2017 19:06
-
-
Save AlexKalinin/92ddcd590c2046dc3074950e4fa530d6 to your computer and use it in GitHub Desktop.
Firebase example, ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/oscardelben/firebase-ruby | |
# https://github.com/firebase/firebase-token-generator-ruby | |
# Gemfile | |
# gem 'firebase' | |
# gem 'firebase_token_generator' | |
require 'rubygems' | |
require 'bundler/setup' | |
Bundler.require(:default) | |
fb_url = 'https://<DATABASE_NAME>.firebaseio.com' | |
payload = {:uid => "1", :auth_data => "foo", :other_auth_data => "bar"} | |
# https://console.firebase.google.com/project/<DATABASE_NAME>/settings/serviceaccounts/databasesecrets | |
generator = Firebase::FirebaseTokenGenerator.new('<SECRET_KEY>') | |
token = generator.create_token(payload) | |
fb = Firebase::Client.new(fb_url, token) | |
result = fb.get('clients', {orderBy: '"$key"', :startAt => '"ZXCVSSXCVV23655446"'}) | |
binding.pry | |
puts result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment