Class: Fantasydata::Client

Inherits:
Object
  • Object
show all
Includes:
API::BoxScore, API::ByeWeeks, API::Fantasy, API::Game, API::News, API::PlayerDetails, API::PlayerStat, API::Schedule, API::Stadium, API::Standings, API::Team, API::Week, Configurable
Defined in:
lib/fantasydata/client.rb

Constant Summary

Constants included from API::Utils

API::Utils::API_KEY_CANNOT_CALL_THIS_METHOD, API::Utils::INVALID_PARAMETER, API::Utils::MISSING_OR_INVALID_KEY, API::Utils::MISSING_PARAMETER, API::Utils::RATE_LIMIT_EXCEEDED, API::Utils::SUCCESS

Instance Attribute Summary

Attributes included from Configurable

#api_key, #connection_options, #endpoint, #middleware

Instance Method Summary collapse

Methods included from Configurable

#configure, #credentials?, keys, #reset!

Methods included from API::Week

#week_current, #week_last_completed, #week_upcoming

Methods included from API::Standings

#standings_by_year

Methods included from API::Stadium

#stadiums

Methods included from API::Schedule

#schedule_by_year

Methods included from API::Team

#teams_active, #teams_by_year

Methods included from API::PlayerStat

#player_game_stat_by_player, #player_game_stat_by_player_projection, #player_game_stats_by_delta, #player_game_stats_by_week, #player_game_stats_by_week_and_team, #player_game_stats_by_week_and_team_projection

Methods included from API::PlayerDetails

#player_details_available, #player_details_by_player_id, #player_details_by_team, #player_details_free_agents

Methods included from API::News

#news_by_player_id, #news_by_team, #news_recent

Methods included from API::Fantasy

#daily_fantasy_defense_game_projected_stats, #daily_fantasy_defense_game_stats, #daily_fantasy_defense_season_projected_stats, #daily_fantasy_defense_season_stats, #daily_fantasy_players_for_day, #daily_fantasy_points_for_day, #fantasy_players_adp

Methods included from API::BoxScore

#box_score_individual_game, #box_scores_active, #box_scores_delta, #box_scores_delta_current_week, #box_scores_final, #box_scores_live, #box_scores_week

Methods included from API::ByeWeeks

#bye_weeks_for_season

Methods included from API::Game

#game_stats_by_season, #game_stats_by_week, #games_in_progress?

Constructor Details

#initialize(options = {}) ⇒ Fantasydata::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})


37
38
39
40
41
# File 'lib/fantasydata/client.rb', line 37

def initialize(options={})
  Fantasydata::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Fantasydata.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#get(path, params = {}) ⇒ Object

Perform an HTTP GET request



44
45
46
# File 'lib/fantasydata/client.rb', line 44

def get(path, params={})
  request(:get, path, params)
end