class SleeperRb::Resources::League
This class represents a Fantasy Football League
and is the access point for associated resources. All attributes are lazily loaded and cache their value based on the API response.
Attributes
Public Class Methods
SleeperRb::Utilities::Cache::new
# File lib/sleeper_rb/resources/league.rb, line 143 def initialize(opts = {}) raise ArgumentError unless opts[:league_id] super end
Public Instance Methods
Retrieves the Avatar
instance for the league.
@return [SleeperRb::Resources::Avatar
]
# File lib/sleeper_rb/resources/league.rb, line 49
Returns all drafts for the league
@return [SleeperRb::Resources::DraftArray
]
# File lib/sleeper_rb/resources/league.rb, line 128 cached_association :drafts do retrieve_drafts! end
Returns matchups for the League
for the given week.
@return [SleeperRb::Resources::League::MatchupArray
]
# File lib/sleeper_rb/resources/league.rb, line 110 cached_association :matchups do |week| retrieve_matchups!(week) end
Retrieves the available roster positions for the league.
@return [Array<SleeperRb::Utilities::RosterPosition
>]
# File lib/sleeper_rb/resources/league.rb, line 61
Retrieves rosters for the League
.
@return [SleeperRb::Resources::League::RosterArray
]
# File lib/sleeper_rb/resources/league.rb, line 90 cached_association :rosters do retrieve_rosters! end
Retrieves the scoring settings for the league.
@return [SleeperRb::Resources::League::ScoringSettings
]
# File lib/sleeper_rb/resources/league.rb, line 55
Returns the non-scoring settings for the league.
@return [SleeperRb::Resources::League::Settings
]
# File lib/sleeper_rb/resources/league.rb, line 71 cached_attr :total_rosters, :status, :sport, :season_type, :season, :previous_league_id, :name, :league_id, :draft_id, avatar: ->(id) { Resources::Avatar.new(avatar_id: id) }, scoring_settings: ->(settings) { ScoringSettings.new(settings) }, roster_positions: lambda { |array| array.map do |pos| SleeperRb::Utilities::RosterPosition.new(pos) end
Returns all traded draft picks for the League
.
@return [SleeperRb::Resources::TradedPickArray
]
# File lib/sleeper_rb/resources/league.rb, line 119 cached_association :traded_picks do retrieve_traded_picks! end
Returns all transactions for the League
for a given week.
@return [SleeperRb::Resources::League::TransactionArray
]
# File lib/sleeper_rb/resources/league.rb, line 139 cached_association :transactions do |week| retrieve_transactions!(week) end
Retrieves users for the League
.
@return [SleeperRb::Resources::UserArray
]
# File lib/sleeper_rb/resources/league.rb, line 99 cached_association :users do retrieve_users! end