require 'xmlrpc'
require 'xmlrpc/rack_server'

class Ping
  def self.call(env)
    server = XMLRPC::RackServer.new
    server.add_introspection
    server.add_handler('weblogUpdates', self.new)
    server.call(env)
  end

  def ping(title, url)
    feed = Feed.find_by_url(url) || Feed.find_by_feed_url(url)

    if feed
      SyncFeedJob.perform_later(feed.id)
      { flerror: false, message: 'Ok'}
    else
      { flerror: true, message: 'Unknown feed'}
    end
  end

  def extendedPing(title, url, changed_url, feed_url, tags)
    feed = Feed.find_by_url(url) || Feed.find_by_feed_url(feed_url)
    if feed
      SyncFeedJob.perform_later(feed.id)
      { flerror: false, message: 'Ok'}
    else
      { flerror: true, message: 'Unknown feed'}
    end
  end
end

require 'xmlrpc'
require 'xmlrpc/rack_server'

class Ping
  def self.call(env)
    server = XMLRPC::RackServer.new
    server.add_introspection
    server.add_handler('weblogUpdates', self.new)
    server.call(env)
  end

  def ping(title, url)
    feed = Feed.find_by_url(url) || Feed.find_by_feed_url(url)

    if feed
      SyncFeedJob.perform_later(feed)
      { flerror: false, message: 'Ok'}
    else
      { flerror: true, message: 'Unknown feed'}
    end
  end

  def extendedPing(title, url, changed_url, feed_url, tags)
    feed = Feed.find_by_url(url) || Feed.find_by_feed_url(feed_url)
    if feed
      SyncFeedJob.perform_later(feed)
      { flerror: false, message: 'Ok'}
    else
      { flerror: true, message: 'Unknown feed'}
    end
  end
end

Send the feed, not the id
Send the feed, not the id
