Method: Cloudant::Client#view

Defined in:
lib/cloudant/client.rb

#view(ddoc, view, *opts) ⇒ Object

Use an existing view. Accepts an options hash containing valid args for a query string. If no options are given the returned value will be the value of the view’s reduce function, if it has one, or rows containing keys, ids, and values if not.



170
171
172
173
174
175
# File 'lib/cloudant/client.rb', line 170

def view(ddoc,view,*opts)
  q  = "#{database}/_design/#{ddoc}/_view/#{view}"
  q << build_query_string(opts.first,"view") if opts && opts.any? && opts.first.is_a?(Hash)

  @conn.query({url_path: q, method: :get})
end