Skip to content

Instantly share code, notes, and snippets.

@mcansky
Created June 17, 2010 22:56
Show Gist options
  • Select an option

  • Save mcansky/442916 to your computer and use it in GitHub Desktop.

Select an option

Save mcansky/442916 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# test for webservice
require 'rubygems'
require 'active_resource'
puts "Starting ..."
class Linkz < ActiveResource::Base
self.site = "http://localhost:4001/links/new"
self.timeout = 5
self.user = "ryan@some.com"
self.password = "password"
end
a_link = Linkz.new(:url => "http://arbousier.info",
:tags => "google:design:web",
:author => "ange")
begin
a_link.save
rescue ActiveResource::ResourceConflict
puts "link already in"
rescue ActiveResource::UnauthorizedAccess
puts "You are not authorized"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment