Created
November 11, 2009 15:10
-
-
Save karmi/232016 to your computer and use it in GitHub Desktop.
Ultra minimal Ruby interface to CouchDB with HTTParty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'httparty' | |
require 'ostruct' | |
class Post < OpenStruct | |
def self.database_name; "sofa"; end | |
include HTTParty | |
format :json | |
base_uri "localhost:5984/#{database_name}" | |
def self.find(id) | |
new get('/'+id) | |
end | |
end | |
post = Post.find('New-post') | |
puts post.title | |
puts post.tags.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment