Class: Analysand::ViewResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/analysand/view_response.rb

Overview

A subclass of Response with additional view-specific accessors: total_rows, offset, and rows.

Instance Attribute Summary

Attributes inherited from Response

#body, #response

Instance Method Summary collapse

Methods inherited from Response

#initialize

Methods included from StatusCodePredicates

#code, #conflict?, #not_found?, #success?, #unauthorized?

Methods included from ResponseHeaders

#cookies, #etag, #session_cookie

Constructor Details

This class inherits a constructor from Analysand::Response

Instance Method Details

#docsObject



20
21
22
# File 'lib/analysand/view_response.rb', line 20

def docs
  rows.map { |r| r['doc'] }.compact
end

#keysObject



24
25
26
# File 'lib/analysand/view_response.rb', line 24

def keys
  rows.map { |r| r['key'] }.compact
end

#offsetObject



12
13
14
# File 'lib/analysand/view_response.rb', line 12

def offset
  body['offset']
end

#rowsObject



16
17
18
# File 'lib/analysand/view_response.rb', line 16

def rows
  body['rows']
end

#total_rowsObject



8
9
10
# File 'lib/analysand/view_response.rb', line 8

def total_rows
  body['total_rows']
end