Class: Hobix::Publish::Ping
- Inherits:
-
BasePublish
- Object
- BasePlugin
- BasePublish
- Hobix::Publish::Ping
- Defined in:
- lib/hobix/publish/ping.rb
Instance Method Summary collapse
-
#initialize(weblog, urls) ⇒ Ping
constructor
A new instance of Ping.
- #publish(pages) ⇒ Object
- #watch ⇒ Object
Methods inherited from BasePlugin
Constructor Details
#initialize(weblog, urls) ⇒ Ping
Returns a new instance of Ping.
22 23 24 25 26 |
# File 'lib/hobix/publish/ping.rb', line 22 def initialize( weblog, urls ) @title = weblog.title @link = weblog.link @urls = urls end |
Instance Method Details
#publish(pages) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/hobix/publish/ping.rb', line 30 def publish( pages ) @urls.each do |u| link = @link.to_s u, link = u.keys.first, u.values.first if Hash === u puts "pinging #{ u }..." u = URI::parse( u ) begin server = XMLRPC::Client.new( u.host, u.path, u.port ) begin result = server.call( "weblogUpdates.ping", @title, link ) rescue XMLRPC::FaultException => e puts "Error: " puts e.faultCode puts e.faultString end rescue Exception => e puts "Error: #{ e. }" end end end |
#watch ⇒ Object
27 28 29 |
# File 'lib/hobix/publish/ping.rb', line 27 def watch ['index'] end |