Class: Player

Inherits:
Object
  • Object
show all
Extended by:
API::Request
Defined in:
lib/player.rb

Class Method Summary collapse

Methods included from API::Request

base_url, build_url, headers, request_service

Class Method Details

.allObject

returns daily fantasy players with salaries by ADP



7
8
9
# File 'lib/player.rb', line 7

def self.all
    request_service('FantasyPlayers')
end

.daily_playersObject

returns players and projections for the current week



34
35
36
# File 'lib/player.rb', line 34

def self.daily_players
    request_service('DailyFantasyPlayers', CoreExtensions::Fantasy::Date.current_date)
end

.fantasy_points(options = {}) ⇒ Object

returns players and points scored for the week



39
40
41
# File 'lib/player.rb', line 39

def self.fantasy_points options = {}
    request_service('DailyFantasyPoints', CoreExtensions::Fantasy::Date.current_date)
end

.inactiveObject

returns inactive players



19
20
21
# File 'lib/player.rb', line 19

def self.inactive
    self.injuries(5).select { |player| player['DeclaredInactive'] if player['DeclaredInactive'] == true}
end

.injuries(week) ⇒ Object

returns players with injuries



14
15
16
# File 'lib/player.rb', line 14

def self.injuries week
    request_service('Injuries', [CoreExtensions::Fantasy::Date.last_season, week])
end

.news(id) ⇒ Object

returns news about a player



24
25
26
# File 'lib/player.rb', line 24

def self.news id
    request_service('NewsByPlayerID', id)
end

.player_projections_by_game(id, week) ⇒ Object

returns player projections by game



54
55
56
# File 'lib/player.rb', line 54

def self.player_projections_by_game id, week
    request_service('PlayerGameProjectionStatsByPlayerID', [CoreExtensions::Fantasy::Date.last_season, week, id])
end

.player_projections_by_player(id) ⇒ Object

returns player projections by player



64
65
66
# File 'lib/player.rb', line 64

def self.player_projections_by_player id
    request_service('PlayerSeasonProjectionStatsByPlayerID', [CoreExtensions::Fantasy::Date.regular_season, id])
end

.player_projections_by_seasonObject

returns player projections for season



59
60
61
# File 'lib/player.rb', line 59

def self.player_projections_by_season
    request_service('PlayerSeasonProjectionStats', CoreExtensions::Fantasy::Date.regular_season)
end

.point_leaders(position, type) ⇒ Object

returns league leaders in fantasy points based on position



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

def self.point_leaders position, type
    request_service('SeasonLeagueLeaders', [CoreExtensions::Fantasy::Date.last_season, position, type])
end

.point_leaders_by_week(position, week) ⇒ Object

retuns league leaders by week in fantasy points by position



49
50
51
# File 'lib/player.rb', line 49

def self.point_leaders_by_week position, week
    request_service('GameLeagueLeaders', [CoreExtensions::Fantasy::Date.last_season, week, position, 'FantasyPoints'])
end

.recent_newsObject

returns recent news



29
30
31
# File 'lib/player.rb', line 29

def self.recent_news
    request_service('News')
end