module Sports::Butler

Constants

DEFAULT_API
DEFAULT_SPORT
VERSION

Initial Release Version: January 2022

Supported Sports:

Supported APIs:

Public Class Methods

get(url:, sport: nil, api_name: nil, filters: {}, headers: {}) click to toggle source

Sports::Butler direct API call without Endpoint Classes

# File lib/sports/butler.rb, line 29
def get(url:, sport: nil, api_name: nil, filters: {}, headers: {})
  Api.get(url: url, sport: sport, api_name: api_name, filters: filters, headers: headers)
end
new(sport: DEFAULT_SPORT, api_name: DEFAULT_API) click to toggle source

Sports::Butler Object build

# File lib/sports/butler.rb, line 20
def new(sport: DEFAULT_SPORT, api_name: DEFAULT_API)
  if Sports::Butler::Configuration.valid_sport_api?(sport, api_name)
    "Sports::Butler::#{sport.to_s.capitalize}".constantize.new(sport: sport, api_name: api_name)
  else
    text_error_sport_api
  end
end
show_endpoints() click to toggle source

Sports::Butler show all endpoints in console output (info)

# File lib/sports/butler.rb, line 34
def show_endpoints
  Sports::Butler::Utility.endpoints
end

Private Class Methods

text_error_sport_api() click to toggle source
# File lib/sports/butler.rb, line 40
def text_error_sport_api
  text  = "Invalid sport / api parameter. "
  text += "Available sports: #{Sports::Butler::Configuration::AVAILABLE_SPORTS.join(', ')}. "
  text += "Available apis: #{Sports::Butler::Configuration::AVAILABLE_APIS.join(', ')}"
  text
end