Sha256: 9f094d265adce7b86014f3794cc6bc07ce8749e04c749c9f61e320e46493fd0b
Contents?: true
Size: 948 Bytes
Versions: 3
Compression:
Stored size: 948 Bytes
Contents
module Adminpanel module Sitemap extend ActiveSupport::Concern include Rails.application.routes.url_helpers included do after_create :ping_engines after_update :ping_engines after_destroy :ping_engines end def ping_urls { google: "http://www.google.com/webmasters/tools/ping?sitemap=%s", ask: "http://submissions.ask.com/ping?sitemap=%s", bing: "http://www.bing.com/webmaster/ping.aspx?siteMap=%s" } end def ping_engines logger.info Time.now ping_urls.each do |name, url| request = url % CGI.escape("#{root_url}/sitemap.xml") logger.info " Pinging #{name} with #{request}" if Rails.env == "production" response = Net::HTTP.get_response(URI.parse(request)) logger.info " #{response.code}: #{response.message}" logger.info " Body: #{response.body}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adminpanel-2.1.5 | app/models/concerns/adminpanel/sitemap.rb |
adminpanel-2.1.3 | app/models/concerns/adminpanel/sitemap.rb |
adminpanel-2.1.2 | app/models/concerns/adminpanel/sitemap.rb |