Firestore ODM

Configure

Add gem 'firestore-odm' to your Gemfile, or from the terminal

gem install firestore-odm

Then type

export GOOGLE_CLOUD_CREDENTIALS=<path_to_google_cloud_credentials>

How to use

require 'firestore-odm'

class Account < FirestoreODM::Model
  path :accounts

  field :name, String
  field :email, String
end

 = Account.create do |doc|
  doc.name = 'John Smith'
  doc.email = '[email protected]'
end

puts .path     #=> accounts/<document_id>
puts .to_json  #=> {"name": "John Smith", "email": "[email protected]"}