Module: Sitemap::Ping

Defined in:
lib/sitemap/ping.rb,
lib/sitemap/ping/version.rb

Overview

Utility for sending “ping” update requests over the network

Constant Summary collapse

VERSION =

The version of this gem.

'0.2.1'.freeze

Class Method Summary collapse

Class Method Details

.ping_sitemap(engine, sitemap_url) ⇒ Object

Pings the specified engine to request an update of your site's sitemap_url. Valid values for engine include :google and :bing.

Returns a Net::HTTPResponse.

ping_sitemap(:google, "https://example.com/sitemap.xml")
# => #<Net::HTTPOK 200 OK readbody=true>
ping_sitemap(:bing, "https://example.com/another_sitemap.xml")
# => #<Net::HTTPOK 200 OK readbody=true>

30
31
32
33
# File 'lib/sitemap/ping.rb', line 30

def ping_sitemap(engine, sitemap_url)
  uri = URI(ENGINE_BASEURLS[engine] + sitemap_url)
  Net::HTTP.get_response(uri)
end