Class: CurationConcerns::AdminSetService

Inherits:
Object
  • Object
show all
Defined in:
app/services/curation_concerns/admin_set_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, search_builder = default_search_builder) ⇒ AdminSetService

Returns a new instance of AdminSetService.

Parameters:

  • context (#repository, #blacklight_config, #current_ability)


8
9
10
11
# File 'app/services/curation_concerns/admin_set_service.rb', line 8

def initialize(context, search_builder = default_search_builder)
  @context = context
  @search_builder = search_builder
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'app/services/curation_concerns/admin_set_service.rb', line 3

def context
  @context
end

#search_builderObject (readonly)

Returns the value of attribute search_builder.



3
4
5
# File 'app/services/curation_concerns/admin_set_service.rb', line 3

def search_builder
  @search_builder
end

Instance Method Details

#search_results(access) ⇒ Object

Parameters:

  • access (Symbol)

    :read or :edit



21
22
23
24
# File 'app/services/curation_concerns/admin_set_service.rb', line 21

def search_results(access)
  response = context.repository.search(builder(access))
  response.documents
end

#select_options(access = :read) ⇒ Object

Parameters:

  • access (Symbol) (defaults to: :read)

    :read or :edit



14
15
16
17
18
# File 'app/services/curation_concerns/admin_set_service.rb', line 14

def select_options(access = :read)
  search_results(access).map do |element|
    [element.to_s, element.id]
  end
end