Class: WingedCouch::Queries::BaseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/winged_couch/queries/base_builder.rb

Overview

Class for building low-level queries to CouchDB database

Examples:

builder = WingedCouch::BaseBuilder.new
builder.
 with_database(Profile.database).
 with_path("/_design/winged-couch/all").
 with_param("limit", 100).
 with_http_method("get").
 perform
# => { "count" => 100, "records" => [...] }

Instance Method Summary collapse

Instance Method Details

#perform(options = {}) ⇒ Hash

Performs http request with specified parameters

Returns:

  • (Hash)

    response

See Also:

  • #with_database
  • #with_path
  • #with_param
  • #with_http_method

32
33
34
35
# File 'lib/winged_couch/queries/base_builder.rb', line 32

def perform(options = {})
  validate
  HTTP.send(http_method, base_path.join(path), params)
end

#resetObject


38
39
40
# File 'lib/winged_couch/queries/base_builder.rb', line 38

def reset
  @params = {}
end