class SleeperRb::Resources::Player
A specific NFL player with general information about roster position, physical attributes, team, etc.
Attributes
active[R]
age[R]
birth_city[R]
birth_country[R]
birth_date[R]
birth_state[R]
college[R]
depth_chart_order[R]
depth_chart_position[R]
espn_id[R]
fantasy_data_id[R]
first_name[R]
full_name[R]
gsis_id[R]
hashtag[R]
height[R]
high_school[R]
injury_body_part[R]
injury_notes[R]
injury_start_date[R]
injury_status[R]
last_name[R]
metadata[R]
news_updated[R]
number[R]
pandascore_id[R]
player_id[R]
practice_description[R]
practice_participation[R]
rotowire_id[R]
sport[R]
sportradar_id[R]
stats_id[R]
status[R]
swish_id[R]
team[R]
weight[R]
yahoo_id[R]
years_exp[R]
Public Class Methods
all()
click to toggle source
Ensuring there is one source of players so the heavy endpoint need not be called frequently.
@return [SleeperRb::Resources::PlayerArray
]
# File lib/sleeper_rb/resources/player.rb, line 16 def all @all ||= PlayerArray.new(player_hashes.reduce([]) do |array, (_player_id, player_hash)| array << new(player_hash) end) end
player_hashes()
click to toggle source
# File lib/sleeper_rb/resources/player.rb, line 32 def player_hashes @player_hashes ||= retrieve_players! end
refresh()
click to toggle source
Resets the values for all players.
@return [self]
# File lib/sleeper_rb/resources/player.rb, line 26 def refresh @all = nil @player_hashes = nil self end
Public Instance Methods
fantasy_positions()
click to toggle source
All fantasy positions for which the player is eligible.
@return [Array<SleeperRb::Utilities::RosterPosition
>]
# File lib/sleeper_rb/resources/player.rb, line 162
position()
click to toggle source
Primary position for the player.
@return [SleeperRb::Utilities::RosterPosition
]
# File lib/sleeper_rb/resources/player.rb, line 173 cached_attr :hashtag, :depth_chart_position, :status, :sport, :number, :injury_start_date, :weight, :practice_participation, :sportradar_id, :team, :last_name, :college, :fantasy_data_id, :full_name, :injury_status, :player_id, :height, :age, :stats_id, :birth_country, :espn_id, :first_name, :active, :depth_chart_order, :years_exp, :rotowire_id, :rotoworld_id, :yahoo_id, :pandascore_id, :news_updated, :birth_city, :birth_date, :injury_notes, :gsis_id, :birth_state, :swish_id, :high_school, :metadata, :injury_body_part, :practice_description, fantasy_positions: ->(array) { array&.map { |pos| SleeperRb::Utilities::RosterPosition.new(pos) } }, position: ->(pos) { pos ? SleeperRb::Utilities::RosterPosition.new(pos) : nil }