Skip to content

Instantly share code, notes, and snippets.

@nesquena
Created February 2, 2009 11:21
Show Gist options
  • Save nesquena/56886 to your computer and use it in GitHub Desktop.
Save nesquena/56886 to your computer and use it in GitHub Desktop.
# controller when you post an update
Ping.notify
# in config/initializers/ping.rb
PING_SERVICES = ["http://rpc.technorati.com/rpc/ping", "http://blogsearch.google.com/ping/RPC2"]
PING_BLOG_NAME = 'Danish Khan\'s Blog'
PING_BLOG_URL = 'http://danishkhan.herokugarden.com'
class Ping
def self.notify
PING_SERVICES.each{|service|
begin
server = XMLRPC::Client.new2(URI.parse(service).to_s)
result = server.call("weblogUpdates.ping", PING_BLOG_NAME, PING_BLOG_URL)
rescue => detail
logger.info("ping failed for server #{service} (#{detail})")
end
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment