Class: Sequencescape::Search
- Inherits:
-
Api::Resource
- Object
- Api::Resource
- Sequencescape::Search
- Defined in:
- lib/sequencescape/search.rb
Defined Under Namespace
Classes: BaseHandler, MultipleResultHandler, SingleResultHandler
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) all(model, criteria)
When performing a search for all records we need to provide the model (as in 'api.plate') that we expect to be returned.
Methods included from Api::Actions
#has_create_action, #has_update_action
Methods included from Api::Composition
Methods included from Api::Associations
Methods included from Api::Resource::Attributes
Methods included from Api::Resource::Json
Methods included from Api::Resource::ErrorHandling
Methods included from Api::Resource::Modifications
#initialize, #save!, #update_attributes!
Methods included from Api::Resource::InstanceMethods
Methods included from Api::Resource::ActiveModel
Class Method Details
+ (Object) search_action(name)
43 44 45 46 47 48 49 50 |
# File 'lib/sequencescape/search.rb', line 43 def self.search_action(name) line = __LINE__ + 1 class_eval(%Q{ def #{name}(criteria) api.create(actions.#{name}, { 'search' => criteria }, SingleResultHandler.new(api)) end }, __FILE__, line) end |
Instance Method Details
- (Object) all(model, criteria)
When performing a search for all records we need to provide the model (as in 'api.plate') that we expect to be returned. So there is a limitation at the moment that the results can only belong to the same model hierarchy.
58 59 60 |
# File 'lib/sequencescape/search.rb', line 58 def all(model, criteria) api.create(actions.all, { 'search' => criteria }, MultipleResultHandler.new(model)) end |