Class: Legate::Tools::CatFacts
- Inherits:
-
Legate::Tool
- Object
- Legate::Tool
- Legate::Tools::CatFacts
- Includes:
- Base::HttpClient
- Defined in:
- lib/legate/tools/cat_facts.rb
Overview
Tool to fetch a random cat fact from an online API.
Constant Summary collapse
- CAT_FACT_BASE_URL =
The base URL for the Cat Fact API.
'https://catfact.ninja'
Instance Attribute Summary
Attributes included from Base::HttpClient
Attributes inherited from Legate::Tool
#description, #name, #parameters
Instance Method Summary collapse
-
#initialize(**options) ⇒ CatFacts
constructor
Initializes the tool instance.
Methods included from Base::HttpClient
#http_delete, #http_get, #http_head, #http_post, #http_put
Methods inherited from Legate::Tool
define_metadata, #execute, inherited, #validate_and_coerce_params, #validate_params
Methods included from Legate::Tool::MetadataDsl
Constructor Details
#initialize(**options) ⇒ CatFacts
Initializes the tool instance. Sets up the HTTP client using the base module.
25 26 27 28 29 30 |
# File 'lib/legate/tools/cat_facts.rb', line 25 def initialize(**) super(**) # Use the base module to set up the client # It handles initialization errors and logging internally. setup_http_client(base_url: CAT_FACT_BASE_URL) end |