This gem is the Ruby client library that helps connect Ruby applications to the FusionAuth (https://fusionauth.io) Identity and User Management platform.
Add this line to your application’s Gemfile:
gem 'fusionauth_client'
And then execute:
bundle
Or install it yourself as:
gem install fusionauth_client
Once the gem is installed, you can call FusionAuth APIs.
require 'fusionauth/fusionauth_client'
require 'securerandom'
require 'pp'
# Construct the FusionAuth Client
client = FusionAuth::FusionAuthClient.new(
'REPLACE_ME',
'http://localhost:9011'
)
application_id = '85a03867-dccf-4882-adde-1a79aeec50df'
# Create a user + registration
id = SecureRandom.uuid
response = client.register(id, {
user: {
firstName: 'Ruby',
lastName: 'User',
email: '[email protected]',
password: 'password'
},
registration: {
applicationId: application_id,
data: {
foo: 'bar'
},
preferredLanguages: %w(en fr),
roles: %w(dev)
}
})
#pp response
if response.success_response
pp response.success_response
else
if response.exception
# if we can't connect
print response.exception
end
print "status: #{response.status}"
print response.error_response
exit
end
Documentation can be found at doc.
If you have a question or support issue regarding this client library, we’d love to hear from you.
If you have a paid edition with support included, please open a ticket in your account portal. Learn more about paid editions here.
Otherwise, please post your question in the community forum.
Bug reports and pull requests are welcome on GitHub at https://github.com/FusionAuth/fusionauth-ruby-client.
All issues filed in this repository must abide by the [FusionAuth community guidelines](https://fusionauth.io/community/forum/topic/1000/code-of-conduct).
This code is available as open source under the terms of the Apache v2.0 License.