All Projects → fauna → faunadb-ruby

fauna / faunadb-ruby

Licence: other
Ruby driver for FaunaDB

Programming Languages

ruby
36898 projects - #4 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to faunadb-ruby

faunadb-csharp
C# driver for FaunaDB
Stars: ✭ 55 (+48.65%)
Mutual labels:  driver, clients, drivers, faunadb, fauna
node-drivers
Industrial protocol drivers in node.js
Stars: ✭ 20 (-45.95%)
Mutual labels:  driver, drivers
use-fauna
React hooks for interacting with Fauna databases
Stars: ✭ 44 (+18.92%)
Mutual labels:  faunadb, fauna
rtl88x2BU WiFi linux v5.2.4.1 22719 COEX20170518-4444.20170613
rtl88x2bu driver updated for modern kernels.
Stars: ✭ 26 (-29.73%)
Mutual labels:  driver, drivers
fauna-gatsby-comments
Roll your own comments with Gatsby and FaunaDB 🗞️
Stars: ✭ 29 (-21.62%)
Mutual labels:  faunadb, fauna
fauna-workers
A template for building fast, globally distributed applications using Cloudflare Workers and Fauna, the data API for modern applications.
Stars: ✭ 35 (-5.41%)
Mutual labels:  faunadb, fauna
Driver.NET
Lightweight and flexible library to load and communicate with kernel drivers on Windows.
Stars: ✭ 59 (+59.46%)
Mutual labels:  driver, drivers
fauna-gql-upload
A tool for managing your FaunaDB database using files. Create resources such as functions by simply creating a new file.
Stars: ✭ 45 (+21.62%)
Mutual labels:  faunadb, fauna
Faunadb Js
Javascript driver for FaunaDB
Stars: ✭ 498 (+1245.95%)
Mutual labels:  driver, drivers
Faunadb Jvm
Scala and Java driver for FaunaDB
Stars: ✭ 50 (+35.14%)
Mutual labels:  driver, drivers
Rtl88x2bu wifi linux v5.2.4.4 26334.20180126 coex20171012 5044
rtl88x2bu driver updated for modern kernels.
Stars: ✭ 55 (+48.65%)
Mutual labels:  driver, drivers
coderplex-org
Official Website for Coderplex Community. Built with Next.js and deployed on Vercel.
Stars: ✭ 32 (-13.51%)
Mutual labels:  faunadb, fauna
Faunadb Go
Go driver for FaunaDB
Stars: ✭ 140 (+278.38%)
Mutual labels:  driver, drivers
Dokany
User mode file system library for windows with FUSE Wrapper
Stars: ✭ 4,055 (+10859.46%)
Mutual labels:  driver, drivers
Faunadb Python
Python driver for FaunaDB
Stars: ✭ 75 (+102.7%)
Mutual labels:  driver, drivers
shopnote
shopnote is a JAMstack application that helps in creating notes with shopping items. This application is built to showcase the JAMstack concept using Fauna, Netlify Serverless Functions and GatsbyJS.
Stars: ✭ 15 (-59.46%)
Mutual labels:  faunadb, fauna
rtw88-usb
rtw88 family usb driver for linux rtl8723du rtl8822bu rtl8821cu rtl8822cu
Stars: ✭ 40 (+8.11%)
Mutual labels:  driver
gspca-kinect2
Kinect2 Sensor Device Driver for Linux
Stars: ✭ 25 (-32.43%)
Mutual labels:  driver
sqlite3
The fastest and correct module for SQLite3 in Deno.
Stars: ✭ 143 (+286.49%)
Mutual labels:  driver
mongodb-jdbc-driver
MongoDB JDBC Driver | DbSchema MongoDB Designer
Stars: ✭ 47 (+27.03%)
Mutual labels:  driver

Commmunity-supported Ruby Driver for FaunaDB

FaunaDB's Ruby driver is now "community-supported". If you are using this driver in production, it will continue to work as expected. However, new features won't be exposed in the driver unless the necessary changes are contributed by a community member. Please email [email protected] if you have any questions/concerns about the model or would like to take a more active role in the development of the driver (eg. partnering with us and operating as a "maintainer" for the driver).

Coverage Status Gem Version License

Installation

The FaunaDB ruby driver is distributed as a gem. Install it via:

$ gem install fauna

Or if you use Bundler, add it to your application's Gemfile:

gem 'fauna'

And then execute:

$ bundle

Documentation

The driver documentation is hosted on GitHub Pages.

Please see the FaunaDB Documentation for a complete API reference, or look in /test for more examples.

Compatibility

Tested and compatible with the following ruby versions:

  • MRI 1.9.3
  • MRI 2.2.3
  • Jruby 1.7.19

Basic Usage

First, require the gem:

require 'fauna'

Creating a Client

All API requests pass through a Fauna::Client. Creating a client requires either an admin key, server key, client key, or a token.

server_key = 'ls8AkXLdakAAAALPAJFy3LvQAAGwDRAS_Prjy6O8VQBfQAlZzwAA'

Now we can make a database-level client:

$fauna = Fauna::Client.new(secret: server_key)

You can optionally configure an observer on the client. To ease debugging, we provide a simple logging observer at Fauna::ClientLogger.logger, which you can configure as such:

require 'logger'
logger = Logger.new(STDERR)
observer = Fauna::ClientLogger.logger { |log| logger.debug(log) }

$fauna = Fauna::Client.new(
  secret: server_key,
  observer: observer)

Using the Client

Now that we have a client, we can start performing queries:

# Create a class
$fauna.query { create ref('classes'), name: 'users' }

# Create an instance of the class
taran = $fauna.query do
  create ref('classes/users'), data: { email: '[email protected]' }
end

# Update the instance
taran = $fauna.query do
  update taran[:ref], data: {
    name: 'Taran',
    profession: 'Pigkeeper'
  }
end

# Page through a set
pigkeepers = Fauna::Query.expr { match(ref('indexes/users_by_profession'), 'Pigkeeper') }
oracles = Fauna::Query.expr { match(ref('indexes/users_by_profession'), 'Oracle') }

$fauna.query { paginate(union(pigkeepers, oracles)) }

# Delete the user
$fauna.query { delete taran[:ref] }

Running Tests

You can run tests against FaunaDB Cloud yourself. Create an admin key and set FAUNA_ROOT_KEY environment variable to it's secret. Then run rake spec:

export FAUNA_ROOT_KEY='kqnPAbijGhkgAAC03-36hjCvcTnWf4Pl8w97UE1HeWo'
rake spec

To run a single test, use e.g. ruby test/client_test.rb.

Coverage is automatically run as part of the tests. After running tests, check coverage/index.html for the coverage report. If using jruby, use JRUBY_OPTS="--debug" bundle exec rake spec to ensure coverage is generated correctly.

Tests can also be run via a Docker container with FAUNA_ROOT_KEY="your-cloud-secret" make docker-test (an alternate Alpine-based Ruby image can be provided via RUNTIME_IMAGE).

Contributing

GitHub pull requests are very welcome.

LICENSE

Copyright 2017 Fauna, Inc.

Licensed under the Mozilla Public License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License at

http://mozilla.org/MPL/2.0/

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].