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.



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

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

Instance Method Details

#redirection(json) ⇒ Object



48
49
50
51
52
# File 'lib/sequencescape/search.rb', line 48

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