Class: Sequencescape::Search
- Inherits:
-
Api::Resource
- Object
- Api::Resource
- Sequencescape::Search
- Defined in:
- lib/sequencescape/search.rb
Defined Under Namespace
Classes: BaseHandler, MultipleResultHandler, MultipleResultPaged, SingleResultHandler
Class Method Summary collapse
Instance Method Summary collapse
-
#all(model, criteria = {}) ⇒ Object
When performing a search for all records we need to provide the model (as in ‘api.plate’) that we expect to be returned.
Methods inherited from Api::Resource
#initialize, is_a_proxied_model?
Methods included from Api::Resource::Attributes
Methods included from Api::Resource::Groups
Methods included from Api::Associations
Methods included from Api::Composition
Methods included from Api::Actions
Methods included from Api::Resource::Json
#as_json, #changed?, #coerce_to, included
Methods included from Api::ErrorHandling
Methods included from Api::Resource::Modifications
#initialize, #save!, #update_attributes!
Methods included from Api::Resource::InstanceMethods
Methods included from Api::Resource::ActiveModel
Constructor Details
This class inherits a constructor from Sequencescape::Api::Resource
Class Method Details
.search_action(name) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/sequencescape/search.rb', line 62 def self.search_action(name) line = __LINE__ + 1 class_eval(" def #{name}(criteria = {}) api.create(actions.#{name}, { 'search' => criteria }, SingleResultHandler.new(api)) end ", __FILE__, line) end |
Instance Method Details
#all(model, criteria = {}) ⇒ Object
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.
79 80 81 |
# File 'lib/sequencescape/search.rb', line 79 def all(model, criteria = {}) api.create(actions.all, { 'search' => criteria }, MultipleResultHandler.new(api, model)) end |