{"id":18728766,"url":"https://github.com/rubyonworld/faunadb-ruby","last_synced_at":"2025-06-16T00:04:52.903Z","repository":{"id":174007907,"uuid":"542156295","full_name":"RubyOnWorld/faunadb-ruby","owner":"RubyOnWorld","description":"All API requests pass through a Fauna::Client. Creating a client requires either an admin key, server key, client key, or a token.","archived":false,"fork":false,"pushed_at":"2022-09-27T17:09:01.000Z","size":778,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T20:32:47.525Z","etag":null,"topics":["admin","api","db","fauna","faunadb","key"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubyOnWorld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-27T15:25:41.000Z","updated_at":"2022-09-27T17:58:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"5bc538bb-709b-4481-810f-185ecb885316","html_url":"https://github.com/RubyOnWorld/faunadb-ruby","commit_stats":null,"previous_names":["rubyonworld/faunadb-ruby"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RubyOnWorld/faunadb-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Ffaunadb-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Ffaunadb-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Ffaunadb-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Ffaunadb-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyOnWorld","download_url":"https://codeload.github.com/RubyOnWorld/faunadb-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Ffaunadb-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260072390,"owners_count":22954908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin","api","db","fauna","faunadb","key"],"created_at":"2024-11-07T14:24:17.411Z","updated_at":"2025-06-16T00:04:52.865Z","avatar_url":"https://github.com/RubyOnWorld.png","language":"Ruby","readme":"# Commmunity-supported Ruby Driver for [FaunaDB](https://fauna.com)\n\nFaunaDB'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 product@fauna.com 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).\n\n[![Coverage Status](https://img.shields.io/codecov/c/github/fauna/faunadb-ruby/master.svg?maxAge=21600)](https://codecov.io/gh/fauna/faunadb-ruby/branch/master)\n[![Gem Version](https://img.shields.io/gem/v/fauna.svg?maxAge=21600)](https://rubygems.org/gems/fauna)\n[![License](https://img.shields.io/badge/license-MPL_2.0-blue.svg?maxAge=2592000)](https://raw.githubusercontent.com/fauna/faunadb-ruby/master/LICENSE)\n\n## Installation\n\nThe FaunaDB ruby driver is distributed as a gem. Install it via:\n\n    $ gem install fauna\n\nOr if you use Bundler, add it to your application's `Gemfile`:\n\n    gem 'fauna'\n\nAnd then execute:\n\n    $ bundle\n\n## Documentation\n\nThe driver documentation is [hosted on GitHub Pages](https://fauna.github.io/faunadb-ruby/).\n\nPlease see the [FaunaDB Documentation](https://fauna.com/documentation) for\na complete API reference, or look in\n[`/test`](https://github.com/fauna/faunadb-ruby/tree/master/test) for more\nexamples.\n\n## Compatibility\n\nTested and compatible with the following ruby versions:\n\n* MRI 1.9.3\n* MRI 2.2.3\n* Jruby 1.7.19\n\n## Basic Usage\n\nFirst, require the gem:\n\n```ruby\nrequire 'fauna'\n```\n\n### Creating a Client\n\nAll API requests pass through a `Fauna::Client`. Creating a client\nrequires either an admin key, server key, client key, or a token.\n\n```ruby\nserver_key = 'ls8AkXLdakAAAALPAJFy3LvQAAGwDRAS_Prjy6O8VQBfQAlZzwAA'\n```\n\nNow we can make a database-level client:\n\n```ruby\n$fauna = Fauna::Client.new(secret: server_key)\n```\n\nYou can optionally configure an `observer` on the client. To ease\ndebugging, we provide a simple logging observer at\n`Fauna::ClientLogger.logger`, which you can configure as such:\n\n```ruby\nrequire 'logger'\nlogger = Logger.new(STDERR)\nobserver = Fauna::ClientLogger.logger { |log| logger.debug(log) }\n\n$fauna = Fauna::Client.new(\n  secret: server_key,\n  observer: observer)\n```\n\n### Using the Client\n\nNow that we have a client, we can start performing queries:\n\n```ruby\n# Create a class\n$fauna.query { create ref('classes'), name: 'users' }\n\n# Create an instance of the class\ntaran = $fauna.query do\n  create ref('classes/users'), data: { email: 'taran@example.com' }\nend\n\n# Update the instance\ntaran = $fauna.query do\n  update taran[:ref], data: {\n    name: 'Taran',\n    profession: 'Pigkeeper'\n  }\nend\n\n# Page through a set\npigkeepers = Fauna::Query.expr { match(ref('indexes/users_by_profession'), 'Pigkeeper') }\noracles = Fauna::Query.expr { match(ref('indexes/users_by_profession'), 'Oracle') }\n\n$fauna.query { paginate(union(pigkeepers, oracles)) }\n\n# Delete the user\n$fauna.query { delete taran[:ref] }\n```\n\n## Running Tests\n\nYou can run tests against FaunaDB Cloud yourself.\n[Create an admin key](https://fauna.com/account/keys) and set\n`FAUNA_ROOT_KEY` environment variable to it's secret. Then run `rake spec`:\n\n```bash\nexport FAUNA_ROOT_KEY='kqnPAbijGhkgAAC03-36hjCvcTnWf4Pl8w97UE1HeWo'\nrake spec\n```\n\nTo run a single test, use e.g. `ruby test/client_test.rb`.\n\nCoverage is automatically run as part of the tests. After running tests, check\n`coverage/index.html` for the coverage report. If using jruby, use\n`JRUBY_OPTS=\"--debug\" bundle exec rake spec` to ensure coverage is generated\ncorrectly.\n\nTests can also be run via a Docker container with\n`FAUNA_ROOT_KEY=\"your-cloud-secret\" make docker-test` (an alternate\nAlpine-based Ruby image can be provided via `RUNTIME_IMAGE`).\n\n## Contributing\n\nGitHub pull requests are very welcome.\n\n## LICENSE\n\nCopyright 2017 [Fauna, Inc.](https://fauna.com/)\n\nLicensed under the Mozilla Public License, Version 2.0 (the\n\"License\"); you may not use this software except in compliance with\nthe License. You may obtain a copy of the License at\n\n[http://mozilla.org/MPL/2.0/](http://mozilla.org/MPL/2.0/)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Ffaunadb-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyonworld%2Ffaunadb-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Ffaunadb-ruby/lists"}