Class: Seo::McpClients
- Inherits:
-
Object
- Object
- Seo::McpClients
- Defined in:
- app/services/seo/mcp_clients.rb
Overview
Factory for API clients used by SEO services.
Provides lazy-loaded, cached clients for Ahrefs and Google Search Console.
Class Method Summary collapse
-
.ahrefs ⇒ Seo::AhrefsMcpClient
Get the Ahrefs MCP client Uses direct HTTP client for reliability.
-
.gsc ⇒ Seo::GscApiClient
Get the Google Search Console API client.
-
.reset! ⇒ Object
Clear cached clients.
-
.reset_ahrefs! ⇒ Object
Reset and rebuild the Ahrefs client.
Class Method Details
.ahrefs ⇒ Seo::AhrefsMcpClient
Get the Ahrefs MCP client
Uses direct HTTP client for reliability
21 22 23 24 25 26 |
# File 'app/services/seo/mcp_clients.rb', line 21 def ahrefs @ahrefs_mutex ||= Mutex.new @ahrefs_mutex.synchronize do @ahrefs ||= Seo::AhrefsMcpClient.new end end |
.gsc ⇒ Seo::GscApiClient
Get the Google Search Console API client
40 41 42 |
# File 'app/services/seo/mcp_clients.rb', line 40 def gsc @gsc ||= Seo::GscApiClient.new end |
.reset! ⇒ Object
Clear cached clients
45 46 47 48 |
# File 'app/services/seo/mcp_clients.rb', line 45 def reset! reset_ahrefs! @gsc = nil end |
.reset_ahrefs! ⇒ Object
Reset and rebuild the Ahrefs client
29 30 31 32 33 34 35 |
# File 'app/services/seo/mcp_clients.rb', line 29 def reset_ahrefs! @ahrefs_mutex ||= Mutex.new @ahrefs_mutex.synchronize do @ahrefs&.close rescue nil @ahrefs = nil end end |