A Rails Engine for integrating with Orcid. It leverages the Devise MultiAuth plugin for negotiating the interaction with orcid.org.
Note: While this is part of ProjectHydra, this gem is not dependent on any of the Hydra components.
Associate ORCID with your user account for the application by:
Authentication
Interacting with ORCID Profile Works:
The functionality exists, but it will be a bit bumpy to implement. Plans are to improve the integration with Version 1.0.0 of the Orcid gem.
To fully interact with the Orcid remote services, you will need to register your ORCID application profile.
Add this line to your application's Gemfile:
gem 'orcid'
And then execute:
$ bundle
If bundle fails, you may need to install Qt.
And then install by running the following:
$ rails generate orcid:install
Note: It will prompt you for your Orcid application secrets.
You will also need to update your devise configuration in your routes.
From something like this:
devise_for :users
To:
devise_for :users, controllers: { omniauth_callbacks: 'devise/multi_auth/omniauth_callbacks' }
You may find it helpful to review the help text, as there are a few options for the generator.
$ rails generate orcid:install -h
In order to facilitate integration of this ORCID gem into your application, a widget has been provided to offer these functions:
The widget is contained in the partial app/views/orcid/profile_connections/_orcid_connector.html.erb
.
An example use of the partial is shown below.
# The `if defined?(Orcid)` could be viewed as a courtesy.
# Don't attempt to render this partial if the Orcid gem is not being used.
if defined?(Orcid)
<%= render partial: 'orcid/profile_connections/orcid_connector', locals: {default_search_text: current_user.name } %>
end
To customize the labels, review the ./config/locales/orcid.en.yml
file.
Your application which will interface with ORCID must be registered with ORCID. Note that you will want to register your production application separately from the development sandbox.
Within a day or so, you will receive an email with an attached xml file containing the client-id and client-secret which must be used in the application.yml file discussed below.
You must enter the same URL for the application home page on the form as you would enter into your browser. For example, if you specify "https://localhost:3000" on the ORCID registration form, then you MUST invoke your application via the browser with "https://localhost:3000" in order for all of the ORCID functionality to work.
For development work in particular, there are multiple ways to specify the local machine: 127.0.0.1, ::1, 192.168.1.1, and localhost. It is strongly recommended that you use 'localhost' in the ORCID form's URL for your application and when invoking your application from the browser rather than using any IP address for your local machine.
Read more about the ORCID Sandbox.
Customize the sample application.yml file by first copying it to config/application.yml and opening it for editing.
$ cp config/application.yml.sample config/application.yml
Run rake
to generate the dummy app and run the offline tests.
To run the online tests, you'll need ORCID application credentials:
Run the online tests with
$ rake spec:online
Not all of the tests run. There are a few very long running tests that run.
$ ORCID_APP_ID=<YOUR ORCID APP ID> \
ORCID_APP_SECRET=<YOUR ORCID APP SECRET> \
MAILINATOR_API_KEY=<YOUR MAILINATOR KEY> \
ORCID_CLAIMED_PROFILE_ID=<AN ORCID PROFILE YOUR APP HAS ALREADY CLAIMED> \
ORCID_CLAIMED_PROFILE_PASSWORD=<THE PASSWORD FOR THE ALREADY CLAIMED ORCID> \
bundle exec rake spec:jenkins
By setting all of the above environment variables, you will run tests that will:
Orcid uses Semantic Versioning 2.0.0