class Puree::Query::Person
Add the creation and modification dates to the selection criteria for publications
Constants
- OPTS
Maps keyword arguments to Pure query parameters The query parameter is either a String (the name of the parameter) or a Proc which accepts the keyword argument name, value and query parameter hash and modifies the query hash as required.
Public Class Methods
Adds whitelisted keyword arguments to the supplied query parameter hash @param params [Hash] the query parameters hash @return [void]
# File lib/openaccess/apc.rb, line 101 def self.query_params(params, **opts) OPTS.each do |opt, param| next unless opts[opt] if param.is_a?(Proc) param.call(opt, opts[opt], params) else params[param] = opts[opt] end end end
Public Instance Methods
Returns an array of publication UUIDs for the given person's UUID @param (see publications_extended
) @return [Array<String>] the array of publication UUIDs
# File lib/openaccess/apc.rb, line 85 def publication_uuids_extended(uuid:, limit:, **opts) params = { 'associatedPersonUuids.uuid' => uuid, 'rendering' => :system, 'window.size' => (limit || 5).to_s, 'window.offset' => (opts[:offset] || 0).to_s } self.class.query_params(params, **opts) headers response = @req.get(build_publication_url, params: params) extract_publication_uuids(make_doc(response.body)) end
Returns an array of publications for the given person's UUID @param uuid [String] the person UUID @param limit [Integer] the number of results to return @param opts [Hash] the options hash @option opts [String] :uuid the person UUID owning the publications @option opts [Numeric] :limit the maximum number of results to return @option opts [Numeric] :offset the start of the result set @option opts [String] :created_start the creation start date @option opts [String] :created_end the creation end date @option opts [String] :modified_start the modification start date @option opts [String] :modified_end the modification end date @option opts [Array<String>] :order_by the list of fields to sort the
result set. Each field can be prefixed by '+' (ascending sort) or '-' (descending sort); the default is ascending.
@option opts [String] :published_start the publication start date @option opts [String] :published_end the publication end date @option opts [Array<String>] :workflow_states the valid workflow
states (:approved|:entryInProgress|:forApproval|:forRevalidation)
@return [Array<Puree::Model::Publication] the array of publications
# File lib/openaccess/apc.rb, line 71 def publications_extended(uuid:, limit:, **opts) uuids = publication_uuids_extended(uuid: uuid, limit: limit, **opts) publications = [] uuids.each do |u| publication_extractor = Puree::Extractor::Publication.new(@config) publication = publication_extractor.find uuid: u publications << publication if publication end publications end