Class: Hyrax::Collections::CollectionMemberService

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/collections/collection_member_service.rb

Overview

Responsible for retrieving collection members

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope:, collection:, params:) ⇒ CollectionMemberService

Returns a new instance of CollectionMemberService.

Parameters:

  • scope (#repository)

    Typically a controller object which responds to :repository

  • (Collection)
  • query (ActionController::Parameters)

    params


11
12
13
14
15
# File 'app/services/hyrax/collections/collection_member_service.rb', line 11

def initialize(scope:, collection:, params:)
  @scope = scope
  @collection = collection
  @params = params
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection


5
6
7
# File 'app/services/hyrax/collections/collection_member_service.rb', line 5

def collection
  @collection
end

#paramsObject (readonly)

Returns the value of attribute params


5
6
7
# File 'app/services/hyrax/collections/collection_member_service.rb', line 5

def params
  @params
end

#scopeObject (readonly)

Returns the value of attribute scope


5
6
7
# File 'app/services/hyrax/collections/collection_member_service.rb', line 5

def scope
  @scope
end

Instance Method Details

#available_member_subcollectionsBlacklight::Solr::Response

Collections which are members of the given collection

Returns:

  • (Blacklight::Solr::Response)

    to 50 solr documents


21
22
23
# File 'app/services/hyrax/collections/collection_member_service.rb', line 21

def available_member_subcollections
  query_solr(query_builder: subcollections_search_builder, query_params: params_for_subcollections)
end

#available_member_work_idsBlacklight::Solr::Response

Work ids of the works which are members of the given collection

Returns:

  • (Blacklight::Solr::Response)

37
38
39
# File 'app/services/hyrax/collections/collection_member_service.rb', line 37

def available_member_work_ids
  query_solr_with_field_selection(query_builder: work_ids_search_builder, fl: 'id')
end

#available_member_worksBlacklight::Solr::Response

Works which are members of the given collection

Returns:

  • (Blacklight::Solr::Response)

29
30
31
# File 'app/services/hyrax/collections/collection_member_service.rb', line 29

def available_member_works
  query_solr(query_builder: works_search_builder, query_params: params)
end