Module: Sitemap::Ping

Defined in:
lib/sitemap/ping.rb

Constant Summary collapse

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"
}

Class Method Summary collapse

Class Method Details

.send_request(file_path = false) ⇒ Object



14
15
16
17
18
19
# File 'lib/sitemap/ping.rb', line 14

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