- Implement a Rails Engine with
engine_name
defined - Expect host application to use
mount
if they want to inherit routes
Example:
module Hydra
module ActiveFedora | |
module Associations | |
class DirectlyContainsOneAssociation < SingularAssociation #:nodoc: | |
# Finds objects contained by the container predicate (either the configured has_member_relation or ldp:contains) | |
# TODO: Refactor this to use solr. Requires indexing ActiveFedora::File objects into solr, including their RDF.type and, if possible, the id of their container | |
def find_target | |
query_node = if container_predicate = options[:has_member_relation] | |
owner | |
else |
container_predicate = ::RDF::URI.new("http://example.com/hasFiles") | |
options = {type: ::RDF::URI.new("http://example.com/primaryFile") } | |
# This works but is inefficient | |
contained_uris = query_node.resource.query(predicate: container_predicate).map { |r| r.object.to_s } | |
contained_objects = contained_uris.map { |object_uri| klass.find(klass.uri_to_id(object_uri)) } | |
filtered_objects = contained_objects.select {|o| o.metadata_node.type.include?(options[:type]) } | |
return filtered_objects.first | |
# Tried this, but it doesn't work |
<http://127.0.0.1:8983/fedora/rest/dev/df/93/78/f3/df9378f3-480a-4ad8-8ee7-7c3a100ac263> <http://www.iana.org/assignments/link-relations/first> <http://127.0.0.1:8983/fedora/rest/dev/df/93/78/f3/df9378f3-480a-4ad8-8ee7-7c3a100ac263/related_objects/c0a7d413-47a2-4ebf-aa14-3384e8af86bd>; | |
<http://www.iana.org/assignments/link-relations/last> <http://127.0.0.1:8983/fedora/rest/dev/df/93/78/f3/df9378f3-480a-4ad8-8ee7-7c3a100ac263/related_objects/c0a7d413-47a2-4ebf-aa14-3384e8af86bd> . | |
<http://127.0.0.1:8983/fedora/rest/dev/df/93/78/f3/df9378f3-480a-4ad8-8ee7-7c3a100ac263/related_objects/c0a7d413-47a2-4ebf-aa14-3384e8af86bd/fcr:export?format=jcr/xml> <http://purl.org/dc/elements/1.1/format> <http://fedora.info/definitions/v4/repository#jcr/xml> . | |
<http://fedora.info/definitions/v4/repository#jcr/xml> <http://www.w3.org/2000/01/rdf-schema#label> "jcr/xml" . | |
<http://127.0.0.1:8983/fedora/rest/dev/df/93/78/f3/df9378f3-480a-4ad8-8ee7-7c3a100ac263/related_objects/c0a7d413-47a2-4ebf-aa14-3384e8af86bd> a <http://www |
When I update to rely on the latest hydra-works instead of relying on commit 4164209 (see Gemfile.extra), the tests for derivative creation break.
For example:
This line https://github.com/projecthydra/sufia/blob/pcdm/spec/services/create_derivatives_service_spec.rb#L27
it 'lacks a thumbnail' do
expect(@generic_file.thumbnail).not_to have_content
end
# spec/support/matchers/api_responses.rb | |
# | |
# RSpec matchers for API default JSON responses. | |
# Creates a matcher like respond_forbidden or respond_not_found corresponding to each of the Api::V1.default_responses | |
# Accepts optional overrides to the expected response body. | |
# @example Override the description expected in the JSON body of a :forbidden response | |
# expect(response).to respond_forbidden(description:"You can't create for that identity") | |
::Api::V1.default_responses.each_pair do |response_type,default_response_body| | |
RSpec::Matchers.define "respond_#{response_type.to_s}".to_sym do |expectation_options| |