Sha256: 08de7fbd6dccb2654a6f8bb94b5693e7ee40fd05470d05e1cfedc44b2a81a400

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

require "net/http"
require "cgi"

module Sitemap

  module Ping

    SEARCH_ENGINES = {
      "Google"  => "http://www.google.com/webmasters/tools/ping?sitemap=%s",
      "Bing"    => "http://www.bing.com/webmaster/ping.aspx?siteMap=%s",
      "Yandex"    => "http://webmaster.yandex.ru/wmconsole/sitemap_list.xml?host=%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.3.3 lib/sitemap/ping.rb
sitemap-0.3.2 lib/sitemap/ping.rb