Sha256: 8ec1bee48d6830b57cb819548e3f826f6cad10fed09494fb288c327d6ad43b4c

Contents?: true

Size: 672 Bytes

Versions: 2

Compression:

Stored size: 672 Bytes

Contents

require "net/http"
require "cgi"

module Sitemap

  module Ping

    SEARCH_ENGINES = {
      "Google"  => "http://www.google.com/webmasters/tools/ping?sitemap=%s",
      "Yahoo!"  => "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=%s",
      "Ask.com" => "http://submissions.ask.com/ping?sitemap=%s",
      "Bing"    => "http://www.bing.com/webmaster/ping.aspx?siteMap=%s"
    }

    def self.send_request(file_path = false)
      SEARCH_ENGINES.each do |name, url|
        request = url % CGI.escape(file_path || Sitemap::Generator.instance.file_url)
        Net::HTTP.get(URI.parse(request))
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sitemap-0.1b2 lib/sitemap/ping.rb
sitemap-0.1b lib/sitemap/ping.rb