Skip to content

Instantly share code, notes, and snippets.

@savonarola
Created March 23, 2009 13:06
Show Gist options
  • Select an option

  • Save savonarola/83540 to your computer and use it in GitHub Desktop.

Select an option

Save savonarola/83540 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'activeresource'
require 'active_support'
class Contact < ActiveResource::Base
self.site = "http://openmsg:8890"
self.format = :json
self.prefix = "/msg/users/:user_id/"
self.primary_key = "contact_id"
end
contact_id = 1234
contact = Contact.new( :contact_id => contact_id, :group_id => 4444 )
contact.prefix_options = { :user_id => 123 }
puts contact.save.inspect
puts contact.id
contact = Contact.find(contact_id, :params => { :user_id => 123 } )
puts contact.inspect
puts
contact.group_id = 3333
puts contact.save.inspect
puts
puts Contact.find(contact_id, :params => { :user_id => 123 } ).inspect
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment