Class: CouchDB::Client
- Inherits:
-
Object
- Object
- CouchDB::Client
- Defined in:
- lib/couchdb/client.rb,
lib/couchdb/client/version.rb
Constant Summary collapse
- VERSION =
"1.0.3"
Class Method Summary collapse
Instance Method Summary collapse
- #all_dbs ⇒ Object
-
#db(name, doc_class = Document) ⇒ Object
(also: #[])
Public: Get a Database with the given name.
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #head(path, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/couchdb/client.rb', line 7 def initialize( = {}) = self.class..merge () @connection = establish_connection end |
Class Method Details
.default_options ⇒ Object
3 4 5 |
# File 'lib/couchdb/client.rb', line 3 def self. {:host => 'localhost', :port => 5984} end |
Instance Method Details
#all_dbs ⇒ Object
12 13 14 |
# File 'lib/couchdb/client.rb', line 12 def all_dbs get '_all_dbs' end |
#db(name, doc_class = Document) ⇒ Object Also known as: []
Public: Get a Database with the given name.
17 18 19 |
# File 'lib/couchdb/client.rb', line 17 def db(name, doc_class = Document) DataBase.new self, name, doc_class end |
#delete(path, options = {}) ⇒ Object
35 36 37 |
# File 'lib/couchdb/client.rb', line 35 def delete(path, = {}) send_http_request :delete, path, end |
#get(path, options = {}) ⇒ Object
23 24 25 |
# File 'lib/couchdb/client.rb', line 23 def get(path, = {}) send_http_request :get, path, end |
#head(path, options = {}) ⇒ Object
39 40 41 |
# File 'lib/couchdb/client.rb', line 39 def head(path, = {}) send_http_request :head, path, end |
#post(path, options = {}) ⇒ Object
31 32 33 |
# File 'lib/couchdb/client.rb', line 31 def post(path, = {}) send_http_request :post, path, {:headers => {'Content-Type' => 'application/json'}}.merge!() end |
#put(path, options = {}) ⇒ Object
27 28 29 |
# File 'lib/couchdb/client.rb', line 27 def put(path, = {}) send_http_request :put, path, {:headers => {'Content-Type' => 'application/json'}}.merge!() end |