User Management API
Client library for the User Management App API
Installation
Add the gem to your Gemfile (note the tag)
gem 'user_management_api', git: '[email protected]:mpc/user_management_api.git', tag: 'v0.0.15'
Configuration
There are four ways to configure the gem, and they can be used interchangeably.
1. Application or environment configuration files.
In config/application.rb or config/environments/
config.user_management_api.KEY = VALUE
2. Initializer
In config/initializers/mpc_shib_auth.rb
UserManagementApi::Config.configure do |config|
config.KEY = VALUE
end
3. Anywhere else
From anywhere
UserManagementApi::Config.KEY = VALUE
4. Constructor
Any configuration can be overridden by passing values into the constructor:
UserManagementApi::Client.new('http://someserver.com', '111-TOKEN-0000')
Configuration Options
base_uri
Base URL of the target User Management App. Should not include any path information. Ex: http://localhost:3000
access_token
Access token used in all requests made to the API
Usage
Provided the base_uri and token have been configured, a client can be created without any constructor parameters: UserManagementApi::Client.new
Client Methods
Registrations
user_registrations(unique_id)user_registration(project, unique_id)search_registrations(project, criteria = {})set_registration_custom_attributes(project, unique_id, attributes)
URLs
create_account_url(project, return_url = nil)- Create new user account with project registrationcreate_registration_url(project, return_url = nil)- Create new registration for existing, logged in useredit_registration_url(project, return_url = nil)- Edit existing registration for logged in userrenew_registration_url(project = nil, return_url = nil)- Renew all registrations for given user (with brand of optional project)forgot_password_urlchange_password_url(return_url = nil)
Registration Groups
owned_registration_groups(project, user_unique_id)enrolled_registration_groups(project, user_unique_id)
Users
users_by_email(emails)user(unique_id)create_user(user)update_user(user)