Class: Dbla::Response

Inherits:
AbstractResponse show all
Defined in:
lib/dbla/response.rb

Instance Attribute Summary

Attributes inherited from AbstractResponse

#blacklight_config, #document_model, #documents, #limit, #request_params, #start, #total

Instance Method Summary collapse

Methods inherited from AbstractResponse

#aggregations, #grouped?, #header, #more_like, #params, #rows, #sort

Constructor Details

#initialize(data, request_params, options = {}) ⇒ Response

Returns a new instance of Response.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dbla/response.rb', line 4

def initialize(data, request_params, options = {})
  super(force_to_utf8(data))
  @request_params = request_params
  self.document_model = options[:solr_document_model] || options[:document_model] || Item
  self.blacklight_config = options[:blacklight_config]
  if data
    @total = data['count']
    @documents = (data['docs'] || []).map {|d| document_model.new(d,self)}
    @start = data['start']
    @limit = data['limit']
  end
end