Skip to content

Conversation

Copy link

Copilot AI commented Jan 5, 2026

Addresses feedback requesting documentation for the ApiClient base class and its automatic prefix extraction mechanism.

Changes

  • Class-level documentation: Explains ApiClient provides automatic URL prefix configuration by extracting from module hierarchy
  • Method documentation: Documents prefix, prefix=, and initialize with YARD annotations
  • Examples: Shows prefix extraction (Rubyists::Kalshi::Search::Client"search") and custom override pattern
# Base class for API client wrappers that automatically configure URL prefixes
#
# @example Using ApiClient with a Search namespace
#   # For Rubyists::Kalshi::Search::Client, the prefix will be "search"
#   class Search::Client < ApiClient
#     # API calls will automatically use /search/ prefix
#   end
#
# @example Overriding the automatic prefix
#   class CustomClient < ApiClient
#     self.prefix = 'custom_api'
#   end
class ApiClient
  # Automatically extract the URL prefix from the module hierarchy
  #
  # The prefix is derived by taking the second-to-last component of the
  # fully qualified class name and converting it to lowercase. For example:
  #   - Rubyists::Kalshi::Search::Client => "search"
  #   - Rubyists::Kalshi::Market::Client => "market"
  #
  # @return [String] the URL prefix for API calls
  def self.prefix
    @prefix ||= to_s.split('::')[-2].downcase
  end
  
  # ...
end

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: bougyman <6848+bougyman@users.noreply.github.com>
Copilot AI changed the title [WIP] Update path correction for filter_by_sport and ApiClient helper docs: add comprehensive documentation to ApiClient class Jan 5, 2026
Copilot AI requested a review from bougyman January 5, 2026 13:44
@bougyman
Copy link
Member

bougyman commented Jan 5, 2026

This PR includes a commit with an invalid commit message. All commit messages must adhere to the Conventional Commits standard, as enforced by the github action. You'll have to rebase your branch to something without that invalid commit message.

@bougyman
Copy link
Member

bougyman commented Jan 5, 2026

@copilot This PR rejected for not meeting the standard for commit messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants