Class: Hyrax::CollectionMemberService

Inherits:
Object
  • Object
show all
Includes:
Blacklight::Configurable, Blacklight::SearchHelper
Defined in:
app/services/hyrax/collection_member_service.rb

Overview

Returns a list of solr documents for collections the item is a part of

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item, ability) ⇒ CollectionMemberService

Returns a new instance of CollectionMemberService.


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

def initialize(item, ability)
  @item = item
  @current_ability = ability
end

Instance Attribute Details

#current_abilityObject (readonly)

Returns the value of attribute current_ability


10
11
12
# File 'app/services/hyrax/collection_member_service.rb', line 10

def current_ability
  @current_ability
end

#itemObject (readonly)

Returns the value of attribute item


10
11
12
# File 'app/services/hyrax/collection_member_service.rb', line 10

def item
  @item
end

Class Method Details

.run(item, ability) ⇒ Object

Parameters:


17
18
19
# File 'app/services/hyrax/collection_member_service.rb', line 17

def self.run(item, ability)
  new(item, ability).list_collections
end

Instance Method Details

#collection_search_builderObject


32
33
34
# File 'app/services/hyrax/collection_member_service.rb', line 32

def collection_search_builder
  @collection_search_builder ||= ParentCollectionSearchBuilder.new([:include_item_ids, :add_paging_to_solr, :add_access_controls_to_solr_params], self)
end

#list_collectionsObject


26
27
28
29
30
# File 'app/services/hyrax/collection_member_service.rb', line 26

def list_collections
  query = collection_search_builder.rows(1000)
  resp = repository.search(query)
  resp.documents
end