{"id":18298735,"url":"https://github.com/fusionauth/fusionauth-ruby-client","last_synced_at":"2025-04-10T01:14:18.601Z","repository":{"id":41142892,"uuid":"146031331","full_name":"FusionAuth/fusionauth-ruby-client","owner":"FusionAuth","description":"Ruby client library for FusionAuth","archived":false,"fork":false,"pushed_at":"2025-04-09T20:42:09.000Z","size":1096,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-04-10T01:14:11.427Z","etag":null,"topics":["fusionauth","fusionauth-client","rest-client","ruby"],"latest_commit_sha":null,"homepage":"https://fusionauth.io","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FusionAuth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-24T19:21:48.000Z","updated_at":"2025-04-07T23:12:47.000Z","dependencies_parsed_at":"2023-12-05T17:39:46.424Z","dependency_job_id":"12c90466-0b8e-4304-85c3-997e8c26d7d2","html_url":"https://github.com/FusionAuth/fusionauth-ruby-client","commit_stats":{"total_commits":302,"total_committers":12,"mean_commits":"25.166666666666668","dds":0.3211920529801324,"last_synced_commit":"7535c02840ecdbc8d8d97a90301841f62c259909"},"previous_names":[],"tags_count":178,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FusionAuth","download_url":"https://codeload.github.com/FusionAuth/fusionauth-ruby-client/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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":["fusionauth","fusionauth-client","rest-client","ruby"],"created_at":"2024-11-05T15:06:51.962Z","updated_at":"2025-04-10T01:14:18.583Z","avatar_url":"https://github.com/FusionAuth.png","language":"Ruby","readme":"# FusionAuth Ruby Client ![semver 2.0.0 compliant](http://img.shields.io/badge/semver-2.0.0-brightgreen.svg?style=flat-square)\n\n## Intro\n\n\u003c!--\ntag::forDocSite[]\n--\u003e\n\nThis gem is the Ruby client library that helps connect Ruby applications\nto the FusionAuth (\u003chttps://fusionauth.io\u003e) Identity and User Management\nplatform.\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n    gem 'fusionauth_client'\n\nAnd then execute:\n\n    bundle\n\nOr install it yourself as:\n\n    gem install fusionauth_client\n\n\n## Examples\n\n### Set Up\n\nFirst, you have to make sure you have a running FusionAuth instance. If you don't have one already, the easiest way to install FusionAuth is [via Docker](https://fusionauth.io/docs/get-started/download-and-install/docker), but there are [other ways](https://fusionauth.io/docs/get-started/download-and-install). By default, it'll be running on `localhost:9011`.\n\nThen, you have to [create an API Key](https://fusionauth.io/docs/apis/authentication#managing-api-keys) in the admin UI to allow calling API endpoints.\n\nYou are now ready to use this library!\n\n### Response Handling\n\nAfter every request is made, you need to check for any errors and handle them. To avoid cluttering things up, we'll omit the error handling in the next examples, but you should do something like the following.\n\n```ruby\nrequire 'fusionauth/fusionauth_client'\nrequire 'pp'\n\n# actual code\n\ndef handle_response(response)\n  if response.was_successful\n    pp response.success_response\n  else\n    print \"status: #{response.status}\"\n    if response.exception\n      # if we can't connect\n      print response.exception\n    end\n    print response.error_response\n    exit 1\n  end\nend\n```\n\n### Create the Client\n\nTo make requests to the API, first you need to create a `FusionAuthClient` instance with [the API Key created](https://fusionauth.io/docs/apis/authentication#managing-api-keys) and the server address where FusionAuth is running.\n\n```ruby\nrequire 'fusionauth/fusionauth_client'\n\n# Construct the FusionAuth Client\nclient = FusionAuth::FusionAuthClient.new(\n  '\u003cpaste the API Key you generated here\u003e',\n  'http://localhost:9011' # or change this to whatever address FusionAuth is running on\n)\n```\n\n### Create an Application\n\nTo create an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use the `createApplication()` method.\n\n```ruby\nresponse = client.create_application(\n    '', # Leave this empty to automatically generate the UUID\n    {\n        :application =\u003e {\n            :name =\u003e 'ChangeBank',\n        }\n    }\n)\n\nhandle_response(response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#create-an-application)\n\n### Adding Roles to an Existing Application\n\nTo add [roles to an Application](https://fusionauth.io/docs/get-started/core-concepts/applications#roles), use `createApplicationRole()`.\n\n```ruby\nresponse = client.create_application_role(\n    'd564255e-f767-466b-860d-6dcb63afe4cc', # Existing Application Id\n    '', # Role Id - Leave this empty to automatically generate the UUID\n    {\n        :role =\u003e {\n            :name =\u003e 'customer',\n            :description =\u003e 'Default role for regular customers',\n            :isDefault =\u003e true,\n        }\n    }\n)\n\nhandle_response(response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#create-an-application-role)\n\n### Retrieve Application Details\n\nTo fetch details about an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use `retrieveApplication()`.\n\n```ruby\nresponse = client.retrieve_application(\n    'd564255e-f767-466b-860d-6dcb63afe4cc'\n)\n\nhandle_response(response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#retrieve-an-application)\n\n### Delete an Application\n\nTo delete an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use `deleteApplication()`.\n\n```ruby\nresponse = client.delete_application(\n    'd564255e-f767-466b-860d-6dcb63afe4cc'\n)\n\nhandle_response(response)\n# Note that response.success_response will be empty\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#delete-an-application)\n\n### Lock a User\n\nTo [prevent a User from logging in](https://fusionauth.io/docs/get-started/core-concepts/users), use `deactivateUser()`.\n\n```ruby\nresponse = client.deactivate_user(\n    'fa0bc822-793e-45ee-a7f4-04bfb6a28199',\n)\n\nhandle_response(response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/users#delete-a-user)\n\n### Registering a User\n\nTo [register a User in an Application](https://fusionauth.io/docs/get-started/core-concepts/users#registrations), use `register()`.\n\nThe code below also adds a `customer` role and a custom `appBackgroundColor` property to the User Registration.\n\n```ruby\nresponse = client.register(\n    'fa0bc822-793e-45ee-a7f4-04bfb6a28199',\n    {\n        :registration =\u003e {\n            :applicationId =\u003e 'd564255e-f767-466b-860d-6dcb63afe4cc',\n            :roles =\u003e [\n                'customer',\n            ],\n            :data =\u003e {\n                :appBackgroundColor =\u003e '#096324',\n            },\n        },\n    }\n)\n\nhandle_response(response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/registrations#create-a-user-registration-for-an-existing-user)\n\n# Documentation\n\nDocumentation can be found at\n[doc](https://github.com/FusionAuth/fusionauth-ruby-client/tree/master/doc).\n\n\u003c!--\nend::forDocSite[]\n--\u003e\n\n## Questions and support\n\n\nIf you find any bugs in this library, [please open an issue](https://github.com/FusionAuth/fusionauth-ruby-client/issues). Note that changes to the `FusionAuthClient` class have to be done on the [FusionAuth Client Builder repository](https://github.com/FusionAuth/fusionauth-client-builder/blob/master/src/main/client/ruby.client.ftl), which is responsible for generating that file.\n\nBut if you have a question or support issue, we'd love to hear from you.\n\nIf you have a paid plan with support included, please [open a ticket in your account portal](https://account.fusionauth.io/account/support/). Learn more about [paid plan here](https://fusionauth.io/pricing).\n\nOtherwise, please [post your question in the community forum](https://fusionauth.io/community/forum/).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/FusionAuth/fusionauth-ruby-client.\n\nNote: if you want to change the `FusionAuthClient` class, you have to do it on the [FusionAuth Client Builder repository](https://github.com/FusionAuth/fusionauth-client-builder/blob/master/src/main/client/ruby.client.ftl), which is responsible for generating all client libraries we support.\n\n## License\n\nThis code is available as open source under the terms of the [Apache v2.0 License](https://opensource.org/blog/license/apache-2-0).\n\n\n## Upgrade Policy\n\nThis library is built automatically to keep track of the FusionAuth API, and may also receive updates with bug fixes, security patches, tests, code samples, or documentation changes.\n\nThese releases may also update dependencies, language engines, and operating systems, as we\\'ll follow the deprecation and sunsetting policies of the underlying technologies that it uses.\n\nThis means that after a dependency (e.g. language, framework, or operating system) is deprecated by its maintainer, this library will also be deprecated by us, and will eventually be updated to use a newer version.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusionauth%2Ffusionauth-ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-ruby-client/lists"}