Class: Legate::Tools::CatFacts

Inherits:
Legate::Tool show all
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

#http_base_url, #http_client

Attributes inherited from Legate::Tool

#description, #name, #parameters

Instance Method Summary collapse

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

included

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(**options)
  super(**options)
  # 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