Class: Helios::Sitemap::IndexNowService

Inherits:
Object
  • Object
show all
Defined in:
lib/helios/sitemap/index_now_service.rb

Defined Under Namespace

Classes: IndexNowError

Constant Summary collapse

ENDPOINT =
"https://api.indexnow.org/IndexNow"

Class Method Summary collapse

Class Method Details

.submit_urls(urls) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/helios/sitemap/index_now_service.rb', line 14

def submit_urls(urls)
  raise IndexNowError, "URLs array cannot be empty" if urls.blank?

  payload = build_payload(urls)
  make_request(payload)
rescue IndexNowError
  raise
rescue StandardError => e
  Rails.logger.error "IndexNow: Unexpected error - #{e.class}: #{e.message}"
  false
end