Skip to content

Instantly share code, notes, and snippets.

@nikukyugamer
Last active September 30, 2020 11:10
Show Gist options
  • Save nikukyugamer/5b67a94464f002849506714f693e994c to your computer and use it in GitHub Desktop.
Save nikukyugamer/5b67a94464f002849506714f693e994c to your computer and use it in GitHub Desktop.
Ruby で Firestore(雛形)
# gem 'google-cloud-firestore'
GOOGLE_APPLICATION_CREDENTIALS='foobar-firestore-beginner-1234567890abcdef.json'
require 'google/cloud/firestore'
firestore = Google::Cloud::Firestore.new(
project_id: 'foobar-12345678901234567890',
credentials: GOOGLE_APPLICATION_CREDENTIALS
)
city = firestore.col('cities').doc('SF')
city.set(
{
name: 'San Francisco',
state: 'CA',
country: 'USA',
capital: false,
population: 860000
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment