Class: Couchy::Server

Inherits:
Object
  • Object
show all
Includes:
Resources::Database, Sphene::Attributes
Defined in:
lib/couchy/server.rb

Constant Summary collapse

ERRORS =
{
  not_found: ResouceNotFound
}.freeze
DEFAULT_PROTOCOL =
"http"
DEFAULT_HOST =
"localhost"
DEFAULT_PORT =
"5984"

Instance Method Summary collapse

Methods included from Resources::Database

#create_database, #delete_database, #get_database

Instance Method Details

#database(name) ⇒ Object



29
30
31
# File 'lib/couchy/server.rb', line 29

def database(name)
  Database.new(name, self)
end

#exec(method, path, data = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/couchy/server.rb', line 22

def exec(method, path, data = {})
  body = request(method, path, data).body_str
  response = Oj.load(body, symbol_keys: true)
  raise_response_errors(response)
  response
end