Bling - a Ruby interface for ping XML-RPC weblog ping servers.
This module has one method: Bling::ping. Please see Bling::ping for usage examples.
Bling can also be called directly from the command line, like so:
$ ./bling.rb server_name server_url
So if my weblog’s name is "My First Weblog", and the URL of my weblog is "example.com/", the command would look like this:
$ ./bling.rb 'My First Weblog' 'http://example.com/'
Don‘t forget to quote your blog name if it’s got spaces, otherwise bad things will happen…
Oh yeah, if you run Bling from the command-line, it will honor the ‘http_proxy’ environment variable, and it’ll check ‘BLING_SERVER’ for an optional weblog ping server, and ‘BLING_TIMEOUT’ for an optional timeout value.
| VERSION | = | '0.1.0' | module version | |
| DEFAULT_SERVER | = | 'http://rpc.pingomatic.com/' | default XML-RPC server |
Bling::ping - Send a weblog ping for the given weblog.
Examples:
# Here's a simple example:
Bling.ping('Pablotron', 'http://pablotron.org/')
# Here's a slightly more elaborate example; a ping with error
# reporting. Also, most weblog servers return some sort of
# response string (like "okay!", or "thanks for using blahping!"),
# so if we get one of those we'll print it out here too.
result = nil
begin
result = Bling.ping('Raggle.org', 'http://raggle.org/')
rescue Bling::Error => err
result = "ERROR: #{err}"
end
puts "Result: #{result}"
# And finally, the complex mega-example: ping a different blogping
# server, through an HTTP proxy server, with a really long
# 240-second timeout:
site_name, site_url = 'Paul Duncan', 'http://paulduncan.org/'
ping_url = 'http://www.syndic8.com/xmlrpc.php',
proxy_url = 'http://proxy.home.pablotron.org:3128/'
begin
result = Bling.ping(site_name, site_url, ping_url, proxy_url, 240)
rescue Bling::Error => err
result = "ERROR: #{err}"
end
puts "Result: #{result}"