Class: Sequencescape::Search::MultipleResultHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/sequencescape/search.rb

Overview

The response from the server contains the JSON for each of the resources found. We simply need to be able to create the resources from each of these.

Instance Method Summary collapse

Constructor Details

#initialize(api, model) ⇒ MultipleResultHandler

Returns a new instance of MultipleResultHandler.



42
43
44
# File 'lib/sequencescape/search.rb', line 42

def initialize(api,model)
  @api, @model = api, model
end

Instance Method Details

#redirection(json, &block) ⇒ Object



46
47
48
49
50
# File 'lib/sequencescape/search.rb', line 46

def redirection(json, &block)
  items = json['searches'].map(&method(:new))
  size = json['size']
  MultipleResultPaged.new(items, size)
end