Module: OpenAccess::APC
- Includes:
- Exceptions
- Defined in:
- lib/openaccess/apc.rb,
lib/openaccess/apc/version.rb,
lib/openaccess/apc/exceptions.rb
Overview
Methods for managing open access article publishing charges (APCs)
Defined Under Namespace
Modules: Exceptions
Constant Summary collapse
- VERSION =
'0.2.0'.freeze
Class Method Summary collapse
-
.configure {|config| ... } ⇒ void
Sets the module configuration.
-
.person(username = nil, employee_id: nil) ⇒ String
Returns the Pure person UUID given a network username.
-
.publications_for_person(username, **opts) ⇒ Object
Returns an array of publication summary details for the N most recent funding-eligible publications.
Class Method Details
.configure {|config| ... } ⇒ void
This method returns an undefined value.
Sets the module configuration
160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/openaccess/apc.rb', line 160 def self.configure # Get user-supplied configuration from the block yield(@config) # LDAP client for person resolution @ldap = configure_ldap # Pure clients @person_extractor = Puree::Extractor::Person.new(@config[:pure]) @person_query = Puree::Query::Person.new(@config[:pure]) end |
.person(username = nil, employee_id: nil) ⇒ String
Returns the Pure person UUID given a network username
175 176 177 178 179 180 181 |
# File 'lib/openaccess/apc.rb', line 175 def self.person(username = nil, employee_id: nil) employee_id ||= person_employee_id(username) person = @person_extractor.find_by_id(employee_id: employee_id) return person.uuid unless person.nil? raise UserNotFound, 'No user for employee ID: ' \ "#{employee_id} (username: #{username})" end |
.publications_for_person(username, **opts) ⇒ Object
Returns an array of publication summary details for the N most recent funding-eligible publications
193 194 195 196 197 198 |
# File 'lib/openaccess/apc.rb', line 193 def self.publications_for_person(username, **opts) person_uuid = person(username) publications_criteria(opts) pubs = @person_query.publications_extended(uuid: person_uuid, **opts) publications_summary(pubs[0..opts[:results]]) end |