source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/abstract_notification.rb | Ruby | apache-2.0 | 197 | main | 3,042 | # frozen_string_literal: true
module Hyrax
module Workflow
# @abstract A notification that happens when a state transition occurs. Subclass AbstractNotification to create a notification.
# @example
# module Hyrax
# module Workflow
# class LocalApprovedNotification < AbstractNotificatio... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/object_in_workflow_decorator.rb | Ruby | apache-2.0 | 197 | main | 719 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# Decorates objects with attributes with their workflow state.
class ObjectInWorkflowDecorator < Hyrax::ModelDecorator
delegate_all
##
# @!attribute [w] workflow
# @return [Sipity::Workflow]
# @!attribute [w] w... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/deposited_notification.rb | Ruby | apache-2.0 | 197 | main | 625 | # frozen_string_literal: true
module Hyrax
module Workflow
class DepositedNotification < AbstractNotification
private
def subject
I18n.t('hyrax.notifications.workflow.deposited.subject')
end
def message
I18n.t('hyrax.notifications.workflow.deposited.message',
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/deactivate_object.rb | Ruby | apache-2.0 | 197 | main | 557 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# This is a built in function for workflow, setting the +#state+
# of the target to the Fedora +inactive+ status URI
#
# @param target [#state] an instance of a model with a +#state+ property;
# e.g. a {Hyrax::Work}
#
# @r... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/state_machine_generator.rb | Ruby | apache-2.0 | 197 | main | 3,713 | # frozen_string_literal: true
module Hyrax
module Workflow
# Imports a single action for a workflow, including all of the adjacent states,
# permissions and notifications
class StateMachineGenerator
def self.generate_from_schema(workflow:, name:, **keywords)
new(
workflow: workflow... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/pending_review_notification.rb | Ruby | apache-2.0 | 197 | main | 642 | # frozen_string_literal: true
module Hyrax
module Workflow
class PendingReviewNotification < AbstractNotification
private
def subject
I18n.t('hyrax.notifications.workflow.pending_review.subject')
end
def message
I18n.t('hyrax.notifications.workflow.pending_review.message'... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/notification_generator.rb | Ruby | apache-2.0 | 197 | main | 2,364 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for writing the database records for the given :workflow and :notification_configuration.
class NotificationGenerator
# @api public
#
# @param workflow [Sipity::Workflow]
# @param notification_configuration [Hyrax... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/fixity/missing_content_error.rb | Ruby | apache-2.0 | 197 | main | 271 | # frozen_string_literal: true
module Hyrax
module Fixity
##
# @note this inherits `Ldp::NotFonud` for backwards compatibility.
# This should be a `RuntimeError` or `ArgumentError` in Hyrax 4.0.
class MissingContentError < Ldp::NotFound; end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/fixity/active_fedora_fixity_service.rb | Ruby | apache-2.0 | 197 | main | 552 | # frozen_string_literal: true
module Hyrax
module Fixity
##
# Wraps `ActiveFedora::FixityService` to avoid leaking Fedora-specific errors.
#
# @see ActiveFedora::FixityService
class ActiveFedoraFixityService < ActiveFedora::FixityService
##
# @raise MissingContentError
# @see Act... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collection_types/permissions_service.rb | Ruby | apache-2.0 | 197 | main | 16,202 | # frozen_string_literal: true
module Hyrax
module CollectionTypes
class PermissionsService
# @api public
#
# Ids of collection types that a user can create or manage
#
# @param roles [String] type of access, Hyrax::CollectionTypeParticipant::MANAGE_ACCESS and/or Hyrax::CollectionType... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collection_types/create_service.rb | Ruby | apache-2.0 | 197 | main | 8,856 | # frozen_string_literal: true
module Hyrax
module CollectionTypes
# @api public
#
# Responsible for creating a CollectionType. If no params are given,the default user collection is assumed as defined by:
#
# * Hyrax::CollectionType::USER_COLLECTION_MACHINE_ID
# * Hyrax::CollectionType::USER_CO... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/flexible_schema_validators/sort_properties_validator.rb | Ruby | apache-2.0 | 197 | main | 1,617 | # frozen_string_literal: true
module Hyrax
module FlexibleSchemaValidators
class SortPropertiesValidator
attr_reader :profile, :sort_properties
def initialize(profile, warnings)
@profile = profile
@warnings = warnings
@sort_properties = find_sort_properties
end
d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/flexible_schema_validators/schema_validator.rb | Ruby | apache-2.0 | 197 | main | 1,151 | # frozen_string_literal: true
module Hyrax
module FlexibleSchemaValidators
# Handles JSON schema validation for flexible metadata profiles
class SchemaValidator
def initialize(schemer, profile, errors)
@schemer = schemer
@profile = profile
@errors = errors
end
def v... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/flexible_schema_validators/core_metadata_validator.rb | Ruby | apache-2.0 | 197 | main | 7,727 | # frozen_string_literal: true
module Hyrax
module FlexibleSchemaValidators
##
# @api private
#
# Validates the core metadata properties of a flexible metadata profile.
class CoreMetadataValidator
##
# @param profile [Hash] the flexible metadata profile
# @param errors [Array<Str... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/flexible_schema_validators/class_validator.rb | Ruby | apache-2.0 | 197 | main | 4,599 | # frozen_string_literal: true
module Hyrax
module FlexibleSchemaValidators
# Handles class-related validations for flexible metadata profiles
class ClassValidator
# @param profile [Hash] M3 profile data
# @param required_classes [Array<String>] Foundational classes that must be present
# @p... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/flexible_schema_validators/existing_records_validator.rb | Ruby | apache-2.0 | 197 | main | 3,367 | # frozen_string_literal: true
module Hyrax
module FlexibleSchemaValidators
# Validates that classes with existing records in the repository are not removed from the profile.
class ExistingRecordsValidator
# @param profile [Hash] M3 profile data
# @param required_classes [Array<String>] Foundation... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/system_stats.rb | Ruby | apache-2.0 | 197 | main | 2,745 | # frozen_string_literal: true
module Hyrax
module Statistics
# A class that retrieves system level statistics about the system
#
# @attr_reader [Integer] limit limits the results returned from top_depositors and top_formats
# Default is 5, maximum is 20, minimum is 5
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/term_query.rb | Ruby | apache-2.0 | 197 | main | 1,992 | # frozen_string_literal: true
module Hyrax
module Statistics
# An abstract class for running a query against the Solr terms component
# you must implement `index_key` in the concrete class.
#
# WARNING: you must use a term that isn't parsed (i.e. use _sim instead of _tesim)
class TermQuery
#... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/over_time.rb | Ruby | apache-2.0 | 197 | main | 1,561 | # frozen_string_literal: true
module Hyrax
module Statistics
# An abstract class for generating cumulative graphs
# you must provide a `relation` method in the concrete class
class OverTime
# @param [Fixnum] delta_x change in x (in days)
# @param [Time] x_min minimum date
# @param [Time]... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/query_service.rb | Ruby | apache-2.0 | 197 | main | 1,935 | # frozen_string_literal: true
module Hyrax
module Statistics
##
# @deprecated for removal in 6.0.0
class QueryService
extend Deprecation
self.deprecation_horizon = 'hyrax version 6.0.0'
deprecation_deprecate :initialize
# query to find works created during the time range
# @... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/valkyrie_query_service.rb | Ruby | apache-2.0 | 197 | main | 1,974 | # frozen_string_literal: true
module Hyrax
module Statistics
class ValkyrieQueryService < QueryService
# query to find works created during the time range
# @param [DateTime] start_datetime starting date time for range query
# @param [DateTime] end_datetime ending date time for range query
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/collections/over_time.rb | Ruby | apache-2.0 | 197 | main | 314 | # frozen_string_literal: true
module Hyrax
module Statistics
module Collections
class OverTime < Statistics::OverTime
private
def relation
AbstractTypeRelation
.new(allowable_types: Hyrax::ModelRegistry.collection_classes)
end
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/users/over_time.rb | Ruby | apache-2.0 | 197 | main | 953 | # frozen_string_literal: true
module Hyrax
module Statistics
module Users
class OverTime < Statistics::OverTime
# Overridden to do a noncumulative query
def points
Enumerator.new(size) do |y|
x = @x_min
while x <= @x_max
y.yield [@x_output.call... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/depositors/summary.rb | Ruby | apache-2.0 | 197 | main | 2,293 | # frozen_string_literal: true
module Hyrax
module Statistics
module Depositors
##
# Gather information about the depositors who have contributed to the repository
class Summary
# @api public
# @param [Time] start_date optionally specify the start date to gather the stats from
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/file_sets/by_format.rb | Ruby | apache-2.0 | 197 | main | 271 | # frozen_string_literal: true
module Hyrax
module Statistics
module FileSets
class ByFormat < Statistics::TermQuery
private
# Returns 'file_format_sim'
def index_key
"file_format_sim"
end
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/works/by_depositor.rb | Ruby | apache-2.0 | 197 | main | 254 | # frozen_string_literal: true
module Hyrax
module Statistics
module Works
class ByDepositor < Statistics::TermQuery
private
def index_key
DepositSearchBuilder.depositor_field
end
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/works/over_time.rb | Ruby | apache-2.0 | 197 | main | 545 | # frozen_string_literal: true
module Hyrax
module Statistics
module Works
class OverTime < Statistics::OverTime
def points
Enumerator.new(size) do |y|
x = @x_min
while x <= @x_max
y.yield [@x_output.call(x), point(@x_min, x)]
x += @delta_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/works/by_resource_type.rb | Ruby | apache-2.0 | 197 | main | 240 | # frozen_string_literal: true
module Hyrax
module Statistics
module Works
class ByResourceType < Statistics::TermQuery
private
def index_key
"resource_type_sim"
end
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/statistics/works/count.rb | Ruby | apache-2.0 | 197 | main | 2,789 | # frozen_string_literal: true
module Hyrax
module Statistics
module Works
class Count
attr_reader :start_date, :end_date
# @api public
# Retrieves the count of works in the system filtered by the start_date and end_date if present
#
# @param [Time] start_date Filters... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_collections_by_type.rb | Ruby | apache-2.0 | 197 | main | 1,306 | # frozen_string_literal: true
module Hyrax
module CustomQueries
# @example
# collection_type = Hyrax::CollectionType.find(1)
#
# Hyrax.custom_queries.find_collections_by_type(global_id: Hyrax::GlobalID(collection_type))
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queri... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_by_date_range.rb | Ruby | apache-2.0 | 197 | main | 1,480 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
class FindByDateRange
def self.queries
[:find_by_date_range]
end
def initialize(query_service:)
@query_service = query_service
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_models_by_access.rb | Ruby | apache-2.0 | 197 | main | 1,401 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
class FindModelsByAccess
def self.queries
[:find_models_by_access]
end
def initialize(query_service:)
@query_service = query_service
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_count_by.rb | Ruby | apache-2.0 | 197 | main | 1,192 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
class FindCountBy
def self.queries
[:find_count_by]
end
def initialize(query_service:)
@query_service = query_service
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_by_property_value.rb | Ruby | apache-2.0 | 197 | main | 4,024 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# Finds resources for arbitrary properties using the Solr index.
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
class FindByPropertyValue
def self.queries
[:find_ids_by_property_pairs,
:f... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_access_control.rb | Ruby | apache-2.0 | 197 | main | 886 | # frozen_string_literal: true
module Hyrax
module CustomQueries
# @example
# Hyrax.custom_queries.find_access_control_for(resource: resource)
class FindAccessControl
def self.queries
[:find_access_control_for]
end
def initialize(query_service:)
@query_service = query_s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_ids_by_model.rb | Ruby | apache-2.0 | 197 | main | 2,196 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
class FindIdsByModel
def self.queries
[:find_ids_by_model]
end
def initialize(query_service:, query_rows: 1_000)
@query_service = que... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_file_metadata.rb | Ruby | apache-2.0 | 197 | main | 3,281 | # frozen_string_literal: true
module Hyrax
module CustomQueries
##
# Provide custom queries for finding Hyrax::FileMetadata
#
# @example
# Hyrax.custom_queries.find_file_metadata_by(id: valkyrie_id)
# Hyrax.custom_queries.find_file_metadata_by_alternate_identifier(alternate_identifier: alt... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/find_many_by_alternate_ids.rb | Ruby | apache-2.0 | 197 | main | 983 | # frozen_string_literal: true
module Hyrax
module CustomQueries
class FindManyByAlternateIds
# Use:
# Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: ids)
def self.queries
[:find_many_by_alternate_ids]
end
attr_reader :query_service
def initialize(qu... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/child_collections_navigator.rb | Ruby | apache-2.0 | 197 | main | 1,375 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to the child collections in the resource.
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.0.0
class ChildCollectionsNavigator
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb | Ruby | apache-2.0 | 197 | main | 1,350 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to the parent collections of the resource.
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.0.0
class ParentCollectionsNavigator
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb | Ruby | apache-2.0 | 197 | main | 1,309 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to the child filesets in the resource.
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.4.0
class ChildFileSetsNavigator
#... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb | Ruby | apache-2.0 | 197 | main | 1,677 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to the child filesets in the resource.
#
# @deprecated use Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator instead
# @see https://github.com/samvera/valkyrie/wiki... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/child_works_navigator.rb | Ruby | apache-2.0 | 197 | main | 1,273 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to the child works in the resource.
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.0.0
class ChildWorksNavigator
# Defin... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/find_files.rb | Ruby | apache-2.0 | 197 | main | 3,119 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# @example
# Hyrax.custom_queries.find_files(file_set: file_set_resource)
# Hyrax.custom_queries.find_original_file(file_set: file_set_resource)
# Hyrax.custom_queries.find_extracted_text(file_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/collection_members.rb | Ruby | apache-2.0 | 197 | main | 1,379 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Find members of collections and collections for members
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.0.0
class CollectionMembers
##
# @... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb | Ruby | apache-2.0 | 197 | main | 2,032 | # frozen_string_literal: true
module Hyrax
module CustomQueries
module Navigators
##
# Navigate from a resource to it's parent work.
#
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @since 3.4.0
class ParentWorkNavigator
# Define the queries t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/action/create_valkyrie_work.rb | Ruby | apache-2.0 | 197 | main | 3,190 | # frozen_string_literal: true
module Hyrax
module Action
##
# @since 5.0.0
# @api public
#
# Encapsulating the logic of several interacting objects. Namely the idea of using a form to
# {#validate} given parameters then to {#perform} the action by leveraging the {#transactions}'s
# {#tra... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/works/migration_service.rb | Ruby | apache-2.0 | 197 | main | 1,440 | # frozen_string_literal: true
module Hyrax
module Works
class MigrationService
# @api public
#
# Migrate data stored in FCrepo from one predicate to another
# The main use case is where the predicate used for a specific property is changed.
# Data already stored in Fedora under t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/works/managed_works_service.rb | Ruby | apache-2.0 | 197 | main | 891 | # frozen_string_literal: true
module Hyrax
module Works
module ManagedWorksService
# @api public
#
# Count of works the current user can manage.
#
# @param scope [Object] Typically a controller object that responds to `repository`, `can?`, `blacklight_config`, `current_ability`
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/trophy_cleanup_listener.rb | Ruby | apache-2.0 | 197 | main | 686 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for object deleted events and cleans up associated members
class TrophyCleanupListener
# Called when 'object.deleted' event is published
# @param [Dry::Events::Event] event
# @return [void]
def on_object_dele... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/file_listener.rb | Ruby | apache-2.0 | 197 | main | 1,219 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to Files ({Valkyrie::StorageAdapter::File})
class FileListener
##
# Called when 'file.characterized' event is published;
# allows post-characterization handling, like derivatives generation.
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/file_metadata_listener.rb | Ruby | apache-2.0 | 197 | main | 1,031 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to {Hyrax::FileMetadata}
class FileMetadataListener
##
# Called when 'file.metadata.updated' event is published; reindexes a
# {Hyrax::FileSet} when a file claiming to be its `pcdm_use:OriginalFi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/member_cleanup_listener.rb | Ruby | apache-2.0 | 197 | main | 1,029 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for resource deleted events and cleans up associated members
class MemberCleanupListener
# Called when 'object.deleted' event is published
# @param [Dry::Events::Event] event
# @return [void]
def on_object_de... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/active_fedora_acl_index_listener.rb | Ruby | apache-2.0 | 197 | main | 984 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Reindexes resources when their ACLs are updated
#
# Hyrax's `Ability` behavior depends on the index being up-to-date as
# concerns-their read/write users/groups, and visibility.
class ActiveFedoraACLIndexListener
##
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/workflow_listener.rb | Ruby | apache-2.0 | 197 | main | 1,475 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for object lifecycle events that require workflow changes and
# manages workflow accordingly.
class WorkflowListener
##
# @!attribute [rw] factory
# @return [#create]
attr_accessor :factory
##
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/acl_index_listener.rb | Ruby | apache-2.0 | 197 | main | 692 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Reindexes resources when their ACLs are updated.
#
# Hyrax's `Ability` behavior depends on the index being up-to-date as
# concerns-their read/write users/groups, and visibility.
class ACLIndexListener
##
# Re-index ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/object_lifecycle_listener.rb | Ruby | apache-2.0 | 197 | main | 1,168 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to the PCDM Object lifecycles.
class ObjectLifecycleListener
##
# Called when 'object.deleted' event is published
# @param [Dry::Events::Event] event
# @return [void]
def on_object_de... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/batch_notification_listener.rb | Ruby | apache-2.0 | 197 | main | 725 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to batch activity and creates notifications
class BatchNotificationListener
##
# Notify requesting users of batch success/failure
#
# Called when 'batch.created' event is published
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb | Ruby | apache-2.0 | 197 | main | 1,200 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to Hydra Works FileSets and sends
# notifications where needed.
class FileSetLifecycleNotificationListener
##
# Send a notification to the depositor for failed checksum audits.
#
# Call... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/metadata_index_listener.rb | Ruby | apache-2.0 | 197 | main | 4,482 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Reindexes resources when their metadata is updated.
#
# @note This listener makes no attempt to avoid reindexing when no metadata
# has actually changed, or when real metadata changes won't impact the
# indexed data. We trus... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/file_set_lifecycle_listener.rb | Ruby | apache-2.0 | 197 | main | 735 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# Listens for events related to Hydra Works FileSets
class FileSetLifecycleListener
##
# Called when 'file.set.attached' event is published
# @param [Dry::Events::Event] event
# @return [void]
def on_file_set_att... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners/proxy_deposit_listener.rb | Ruby | apache-2.0 | 197 | main | 1,035 | # frozen_string_literal: true
module Hyrax
module Listeners
##
# @deprecated transfer requests are now carried out synchronously during
# object save
#
## Listens for deposit events, and checks for proxy situations. When a user
# deposits an item `on_behalf_of` another, ensures transfer is ha... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/google.rb | Ruby | apache-2.0 | 197 | main | 8,793 | # frozen_string_literal: true
require 'oauth2'
require 'signet/oauth_2/client'
module Hyrax
module Analytics
# rubocop:disable Metrics/ModuleLength
module Google
extend ActiveSupport::Concern
# rubocop:disable Metrics/BlockLength
class_methods do
# Loads configuration options from ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/results.rb | Ruby | apache-2.0 | 197 | main | 2,422 | # frozen_string_literal: true
module Hyrax
module Analytics
class Results
require 'csv'
attr_accessor :results
def initialize(results)
@results ||= results
end
def all
results.inject(0) { |sum, a| sum + a[1] }
end
def day(date = Time.zone.today)
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/matomo.rb | Ruby | apache-2.0 | 197 | main | 7,645 | # frozen_string_literal: true
# rubocop:disable Metrics/ModuleLength
module Hyrax
module Analytics
module Matomo
extend ActiveSupport::Concern
# rubocop:disable Metrics/BlockLength
class_methods do
# Loads configuration options from config/analytics.yml. Expected structure:
# `... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4.rb | Ruby | apache-2.0 | 197 | main | 7,459 | # frozen_string_literal: true
require 'oauth2'
begin
require "google/analytics/data/v1beta"
rescue LoadError
$stderr.puts "Unable to load 'google/analytics/data/v1beta'; this is okay unless you are trying to do analytics reporting."
end
module Hyrax
module Analytics
# rubocop:disable Metrics/ModuleLength
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4/events.rb | Ruby | apache-2.0 | 197 | main | 816 | # frozen_string_literal: true
module Hyrax
module Analytics
module Ga4
class Events < Hyrax::Analytics::Ga4::Base
def initialize(start_date:,
end_date:,
dimensions: [{ name: 'eventName' }, { name: 'contentType' }, { name: 'contentId' }],
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4/events_daily.rb | Ruby | apache-2.0 | 197 | main | 1,249 | # frozen_string_literal: true
module Hyrax
module Analytics
module Ga4
class EventsDaily < Hyrax::Analytics::Ga4::Base
def initialize(start_date:,
end_date:,
dimensions: [{ name: 'date' }, { name: 'eventName' }, { name: 'contentType' }, { name: 'contentI... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4/visits_daily.rb | Ruby | apache-2.0 | 197 | main | 532 | # frozen_string_literal: true
module Hyrax
module Analytics
module Ga4
class VisitsDaily < Hyrax::Analytics::Ga4::Base
def initialize(start_date:, end_date:, dimensions: [{ name: 'date' }, { name: 'newVsReturning' }], metrics: [{ name: 'sessions' }])
super
end
def new_visi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4/visits.rb | Ruby | apache-2.0 | 197 | main | 1,060 | # frozen_string_literal: true
module Hyrax
module Analytics
module Ga4
class Visits < Hyrax::Analytics::Ga4::Base
def initialize(start_date:, end_date:, dimensions: [{ name: 'newVsReturning' }], metrics: [{ name: 'sessions' }])
super
end
def new_visits
unwrap_met... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/ga4/base.rb | Ruby | apache-2.0 | 197 | main | 2,591 | # frozen_string_literal: true
module Hyrax
module Analytics
module Ga4
class Base
attr_reader :start_date, :end_date, :dimensions, :metrics
def initialize(start_date:,
end_date:,
dimensions: [],
metrics: [])
@sta... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/google/events.rb | Ruby | apache-2.0 | 197 | main | 1,531 | # frozen_string_literal: true
module Hyrax
module Analytics
module Google
module Events
extend Legato::Model
metrics :total_events
dimensions :event_category, :event_action, :event_label
# Filter by event id
filter :for_id, &->(id) { matches(:eventLabel, id) }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/google/visits_daily.rb | Ruby | apache-2.0 | 197 | main | 1,525 | # frozen_string_literal: true
module Hyrax
module Analytics
module Google
module VisitsDaily
extend Legato::Model
dimensions :date, :user_type
metrics :sessions
filter(:returning) { |_user_type| matches(:userType, 'Returning Visitor') }
filter(:new_visit) { |_user_t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/google/visits.rb | Ruby | apache-2.0 | 197 | main | 1,224 | # frozen_string_literal: true
module Hyrax
module Analytics
module Google
module Visits
extend Legato::Model
dimensions :user_type
metrics :sessions
def self.results_array(response)
results = []
response.to_a.each do |result|
results.push([re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/analytics/google/events_daily.rb | Ruby | apache-2.0 | 197 | main | 2,930 | # frozen_string_literal: true
module Hyrax
module Analytics
module Google
module EventsDaily
extend Legato::Model
metrics :total_events
dimensions :date, :event_category, :event_action
# Filter by event id
filter :for_id, &->(id) { matches(:eventLabel, id) }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/collection_member_search_service.rb | Ruby | apache-2.0 | 197 | main | 2,532 | # frozen_string_literal: true
module Hyrax
module Collections
##
# Retrieves collection members
class CollectionMemberSearchService < Hyrax::SearchService
##
# @param scope [#repository] Typically a controller object which responds to :repository
# @param [::Collection] collection
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/nested_collection_query_service.rb | Ruby | apache-2.0 | 197 | main | 5,373 | # frozen_string_literal: true
module Hyrax
module Collections
##
# A query service handling nested collection queries.
module NestedCollectionQueryService
##
# @api public
#
# What possible collections can be nested within the given parent collection?
#
# @param parent ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/collection_member_service.rb | Ruby | apache-2.0 | 197 | main | 8,785 | # frozen_string_literal: true
module Hyrax
module Collections
##
# Retrieves collection members
class CollectionMemberService
##
# @param scope [#repository] Typically a controller object which responds to :repository
# @param [::Collection] collection
# @param [ActionController::P... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/search_service.rb | Ruby | apache-2.0 | 197 | main | 2,086 | # frozen_string_literal: true
module Hyrax
module Collections
class SearchService
include Blacklight::Configurable
def initialize(session, user_key)
@session = session
@user_key = user_key
self.class.copy_blacklight_config_from(::CatalogController)
end
# self.sear... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/permissions_service.rb | Ruby | apache-2.0 | 197 | main | 15,607 | # frozen_string_literal: true
module Hyrax
module Collections
# rubocop:disable Metrics/ClassLength
class PermissionsService
# @api private
#
# IDs of collections/or admin_sets a user can access based on participant roles.
#
# @param access [Array<String>] one or more types of ac... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/nested_collection_persistence_service.rb | Ruby | apache-2.0 | 197 | main | 1,676 | # frozen_string_literal: true
module Hyrax
module Collections
module NestedCollectionPersistenceService
# @api public
#
# Responsible for persisting the relationship between the parent and the child.
# @see Hyrax::Collections::NestedCollectionQueryService
#
# @param parent [Hyr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/permissions_create_service.rb | Ruby | apache-2.0 | 197 | main | 4,784 | # frozen_string_literal: true
module Hyrax
module Collections
class PermissionsCreateService
class << self
# @api public
#
# Set the default permissions for a (newly created) collection
#
# @param collection [#collection_type_gid || Hyrax::AdministrativeSet] the colle... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections/managed_collections_service.rb | Ruby | apache-2.0 | 197 | main | 912 | # frozen_string_literal: true
module Hyrax
module Collections
module ManagedCollectionsService
# @api public
#
# Count of collections the current user can manage.
#
# @param scope [Object] Typically a controller object that responds to `repository`, `can?`, `blacklight_config`, `curr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/characterization/file_set_description.rb | Ruby | apache-2.0 | 197 | main | 1,113 | # frozen_string_literal: true
module Hyrax
module Characterization
##
# @api public
class FileSetDescription
include Hydra::Works::MimeTypes
##
# @!attribute [rw] file_set
# @return [Hyrax::FileSet]
attr_accessor :file_set
delegate :mime_type, to: :primary_file
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/characterization/valkyrie_characterization_service.rb | Ruby | apache-2.0 | 197 | main | 4,653 | # frozen_string_literal: true
class Hyrax::Characterization::ValkyrieCharacterizationService
##
# @api public
# @param [Hyrax::FileMetadata] metadata which has properties to recieve characterization values
# @param [Valkyrie::StorageAdapter::StreamFile] source to run characterization against
# @param [Hash]... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/uploaders/hyrax/avatar_uploader.rb | Ruby | apache-2.0 | 197 | main | 380 | # frozen_string_literal: true
class Hyrax::AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
include CarrierWave::Compatibility::Paperclip
version :medium do
process resize_to_limit: [300, 300]
end
version :thumb do
process resize_to_limit: [100, 100]
end
def extensio... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/uploaders/hyrax/uploaded_file_uploader.rb | Ruby | apache-2.0 | 197 | main | 698 | # frozen_string_literal: true
module Hyrax
class UploadedFileUploader < CarrierWave::Uploader::Base
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
(configured_upload_path / model.class.name.undersco... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/components/hyrax/dropdown_facet_field_component.rb | Ruby | apache-2.0 | 197 | main | 890 | # frozen_string_literal: true
module Hyrax
class DropdownFacetFieldComponent < Blacklight::FacetFieldListComponent
def facet_item_presenters
return to_enum(:facet_item_presenters) unless block_given?
@facet_field.paginator.items.each do |item|
skipped = facet_config.skip_item&.call(item)
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/builders/hyrax/form_builder.rb | Ruby | apache-2.0 | 197 | main | 698 | # frozen_string_literal: true
module Hyrax
class FormBuilder < SimpleForm::FormBuilder
def input_label(attribute_name, options = {})
options = options.dup
options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *ATTRIBUTE_COMPONENTS)
options = @defau... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/builders/hyrax/manifest_helper.rb | Ruby | apache-2.0 | 197 | main | 1,108 | # frozen_string_literal: true
module Hyrax
class ManifestHelper
include Rails.application.routes.url_helpers
include ActionDispatch::Routing::PolymorphicRoutes
def initialize(hostname)
@hostname = hostname
end
def polymorphic_url(record, opts = {})
opts[:host] ||= @hostname
sup... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/builders/hyrax/bootstrap_breadcrumbs_builder.rb | Ruby | apache-2.0 | 197 | main | 1,262 | # frozen_string_literal: true
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions.
#
# BootstrapBreadcrumbsBuilder accepts a limited set of options:
#
# You can use it with the :builder... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/lease_helper.rb | Ruby | apache-2.0 | 197 | main | 1,674 | # frozen_string_literal: true
module Hyrax
module LeaseHelper
def assets_with_expired_leases
@assets_with_expired_leases ||= LeaseService.assets_with_expired_leases
end
def assets_under_lease
@assets_under_lease ||= LeaseService.assets_under_lease
end
def assets_with_deactivated_leas... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/permissions_helper.rb | Ruby | apache-2.0 | 197 | main | 322 | # frozen_string_literal: true
module Hyrax
module PermissionsHelper
def help_text(file)
capture_content(file)
end
private
def capture_content(file)
capture do
render file
end
end
def help_icon
tag.i '', 'aria-hidden': true, class: 'help-icon'
end
end
en... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/ability_helper.rb | Ruby | apache-2.0 | 197 | main | 1,660 | # frozen_string_literal: true
module Hyrax
module AbilityHelper
def visibility_options(variant)
options = [
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED,
Hydra::AccessControls::AccessRight::V... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/work_form_helper.rb | Ruby | apache-2.0 | 197 | main | 3,702 | # frozen_string_literal: true
module Hyrax
module WorkFormHelper
##
# @todo this implementation hits database backends (solr) and is invoked
# from views. refactor to avoid
# @return [Array<Array<String, String, Hash>] options for the admin set drop down.
def admin_set_options
return @adm... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/file_set_helper.rb | Ruby | apache-2.0 | 197 | main | 1,542 | # frozen_string_literal: true
module Hyrax::FileSetHelper
##
# @todo inline the "workflow restriction" into the `can?(:download)` check.
#
# @param file_set [#id]
#
# @return [Boolean] whether to display the download link for the given file
# set
def display_media_download_link?(file_set:)
Hyrax.c... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/attributes_helper.rb | Ruby | apache-2.0 | 197 | main | 3,538 | # frozen_string_literal: true
module Hyrax
module AttributesHelper
def view_options_for(presenter)
model_name = presenter.model.model_name.klass.to_s
if presenter.respond_to?(:flexible?) && presenter.flexible?
Hyrax::Schema.m3_schema_loader.view_definitions_for(schema: model_name, version: pr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/facets_helper.rb | Ruby | apache-2.0 | 197 | main | 323 | # frozen_string_literal: true
module Hyrax
module FacetsHelper
# Methods in this module are from Blacklight::FacetsHelperBehavior, blacklight v6.24.0
# This module is used to ensure Hyrax facet views that rely on deprecated Blacklight helper methods are still functional
include Blacklight::Facet
end
e... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/workflows_helper.rb | Ruby | apache-2.0 | 197 | main | 1,749 | # frozen_string_literal: true
module Hyrax
module WorkflowsHelper
# Does a workflow restriction exist for the given :object and
# given :ability?
#
# @note If the object responds to a :workflow_restriction?, we'll
# use that answer.
#
# This method doesn't answer what kind of restric... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/dashboard_helper_behavior.rb | Ruby | apache-2.0 | 197 | main | 2,024 | # frozen_string_literal: true
module Hyrax
module DashboardHelperBehavior
def on_the_dashboard?
params[:controller].match(%r{^hyrax/dashboard|hyrax/my})
end
# @param user [User]
# @return [Integer] number of works that the user deposited
def number_of_works(user = current_user)
Hyrax:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.