Class: Vayacondios::Server::StashesHandler

Inherits:
DocumentHandler show all
Defined in:
lib/vayacondios/server/handlers/stashes_handler.rb

Instance Attribute Summary

Attributes inherited from DocumentHandler

#database, #log

Instance Method Summary collapse

Methods inherited from DocumentHandler

#action_successful, #base_create, #base_delete, #base_retrieve, #base_search, #base_update, #call, #initialize

Constructor Details

This class inherits a constructor from Vayacondios::Server::DocumentHandler

Instance Method Details

#delete(params, query) ⇒ Object

Delete many stashes that match a query.

Parameters:

  • params (Hash)

    routing information like ‘organization`, `topic,`, or `id`

  • query (Hash)

    a search query

  • document (Hash)

    the body of the request containing a search query and an update



40
41
42
43
44
45
46
# File 'lib/vayacondios/server/handlers/stashes_handler.rb', line 40

def delete(params, query)
  raise Goliath::Validation::BadRequestError.new 'Query cannot be empty' if query.empty?
  Stash.destroy(params, query) do |request, filter|
    database.call(:remove, request, filter)
  end
  action_successful
end

#retrieve(params, query) ⇒ Object

Search for stashes matching a given query.

Parameters:

  • params (Hash)

    routing information like ‘organization`, `topic,`, or `id`

  • query (Hash)

    a search query



19
20
21
22
23
# File 'lib/vayacondios/server/handlers/stashes_handler.rb', line 19

def retrieve(params, query)
  stashes = Stash.search(params, query) do |request, filter, options|
    database.call(:search, request, filter, options)
  end
end