Simple, effective CouchDB client. Designed from usage.
Ruby
Switch branches/tags
Pull request Compare This branch is 36 commits ahead, 1 commit behind lstoll:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.document
.gitignore
LICENSE
README.md
Rakefile
TODO
VERSION
throne.gemspec

README.md

♚ Throne

The king is here - on his couch, covered in rubies.

Simple library for working with CouchDB

Caution!

This code is in heavy development, in conjunction with a few development projects. This means the API can and probably will change substantially over the next few releases as we work out what fits best. You have been warned.

Basic Usage

Create a database object to work with. Will create the DB if it doesn't exist

Throne.database = "blaster"
Throne::Database.create

Save a new document

doc = Throne::Document.new(:first_name => "Arthur")
doc.save

or

Throne::Document.create(:first_name => "Arthur")

Get a document

Throne::Document.get(doc._id)
  • Note that _id is prefixed with _ just like it is in the database. id will give you the ruby object id.

Save an existing document

doc.save
=> true

Say you want to add some properties in the process of the save

doc.save(:king => true)
=> true

Delete a document

Throne::Document.destroy(doc._id)
=> true

or, with your instance

doc.destroy
=> true

Destroy the database

Throne::Database.destroy

Links

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2009 Lincoln Stoll, Ben Schwarz, Badasses of the universe. See LICENSE for details.