OpenAccess::APC
This gem provides tools for managing open access article processing charge (APC) funding applications at Lancaster University.
Researchers are expected to create publication records in the Pure research information system before making an PC funding application. This gem retrieves these records from Pure to support the process of selecting publications for funding.
Installation
Add this line to your application's Gemfile:
gem 'openaccess-apc'
And then execute:
$ bundle
Or install it yourself as:
$ gem install openaccess-apc
Usage
Configuration
require 'openaccess-apc'
OpenAccess::APC.configure do |config|
# Use LDAP for user resolution
# The attribute supplying the Pure user ID
config[:ldap][:attribute_pure_id] = 'uolOwnerCid'
# The attribute supplying the single-sign-on username
config[:ldap][:attribute_username] = 'uid'
# The LDAP service username and password
config[:ldap][:auth][:password] = 'ldap-service-password'
config[:ldap][:auth][:username] = 'ldap-service-username'
# The LDAP base for searches
config[:ldap][:base] = 'ou=users,dc=lancs,dc=ac,dc=uk'
# The LDAP server
config[:ldap][:host] = '<LDAP-server>'
# Pure
config[:pure][:password] = 'Pure web service password'
config[:pure][:url] = 'https://<Pure-server>/ws/rest'
config[:pure][:username] = 'Pure web service username'
end
Get Pure person ID
username = ENV['REMOTE_USER']
begin
person_uuid = OpenAccess::APC.person(username)
rescue OpenAccess::APC::Exceptions::UserNotFound
# Raised when the user can't be resolved in Pure
end
Get publications summary
By default, publications created in Pure within the last 6 months with workflow status 'forApproval' or 'approved'.
pubs = OpenAccess::APC.publications_for_person(person_uuid)
# => [
# {
# created: 'date created in Pure: YYYY-MM-DD',
# description: 'publication description',
# dois: ['doi1', 'doi2', ...],
# subtitle: 'publication subtitle',
# title: 'publication title',
# translated_subtitle: 'translated subtitle',
# translated_title: 'translated title',
# uuid: 'publication UUID',
# workflow_state: 'approved'|'entryInProgress'|'forApproval'|
# 'forRevalidation'
# },
# { ... },
# ]
To limit by creation date and workflow state:
pubs = OpenAccess::API.publications_for_person(person_uuid,
created_start: '2017-01-01',
created_end: '2017-12-31',
workflow_states: ['forApproval'])
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/lulibrary/openaccess-apc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the OpenAccess::APC project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.