Simple REST interface for ruby objects.

party_resource is a framework for building ruby objects which interact with a REST api. Built on top of HTTParty.

HTTParty is great for adding a couple of methods that fetch data from an HTTP api, but becomes cumbersome if you have lots of objects that all need to connect to several routes on the api. ActiveResource doesn't give you enough control.


gem install party_resource


For detailed usage instructions, please see the API Documentation.

PartyResource::Connector.add(:library, :base_uri => '')

class Author
  include PartyResource

  property :name
  property :slug

  connect :books, :get => '/authors/:slug/books', :as => Book, :on => :instance

  def initialize(params = {})

class Book
  include PartyResource

  property :title
  property :author, :as => Author

  connect :search, :get => '/search/:query', :with => :query

  def initialize(params = {})

book ='Lord of the Rings')

book.title #=> 'Lord of the Rings Trilogy' #=> Author #=> 'J. R. R. Tolkein'

author = #=> ['Lord of the Rings Trilogy', 'The Hobbit', 'The Silmarillion']


Please use the github issues tracker.

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 (c) 2010 Eden Development (UK) LTD. See LICENSE for details.