Class: YFantasy::Game
- Inherits:
-
BaseResource
- Object
- BaseResource
- YFantasy::Game
- Defined in:
- lib/y_fantasy/resources/game.rb,
lib/y_fantasy/resources/game/game_week.rb,
lib/y_fantasy/resources/game/position_type.rb
Overview
Represents a Yahoo Fantasy Game (e.g. NFL, NBA, MLB). A game is the top-level sports resource and contains leagues, which contain teams.
Defined Under Namespace
Classes: GameWeek, PositionType
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
The general code for this game (eg. “nfl”, “nba”).
-
#current_week ⇒ Integer?
readonly
The current week number of the game.
-
#game_id ⇒ String
readonly
The ID for this game (for Game resource, this is the same as game_key).
-
#game_key ⇒ String
readonly
The unique key for this game.
-
#game_weeks ⇒ Array<GameWeek>?
readonly
Array of game weeks for this game.
-
#groups ⇒ Array<Group>?
readonly
Array of groups for this game (e.g. NFL Survival).
-
#has_schedule ⇒ Boolean?
readonly
Whether this game has a schedule.
-
#is_contest_over ⇒ Boolean?
readonly
Whether the contest is over.
-
#is_contest_reg_active ⇒ Boolean?
readonly
Whether contest registration is active.
-
#is_game_over ⇒ Boolean
readonly
Whether this game’s season is over.
-
#is_offseason ⇒ Boolean
readonly
Whether this game is in the offseason.
-
#is_registration_over ⇒ Boolean
readonly
Whether registration for this game is over.
-
#leagues ⇒ Array<League>?
readonly
Array of leagues belonging to this game.
-
#name ⇒ String
readonly
The name of the game (eg. “Football”, “Baseball”).
-
#position_types ⇒ Array<PositionType>?
readonly
Array of position types for this game.
-
#roster_positions ⇒ Array<RosterPosition>?
readonly
Array of roster positions for this game.
-
#season ⇒ Integer
readonly
The year of the season.
-
#stat_categories ⇒ Array<StatCategory>?
readonly
Array of stat categories for this game.
-
#type ⇒ String
readonly
The type of game (eg. “full”).
-
#url ⇒ String
readonly
The URL to the game’s home page.
Class Method Summary collapse
-
.find_all_by_code(codes, with: [], **options) ⇒ Array<Game>
Finds all games by their code(s).
Methods inherited from BaseResource
collection_name, dependent?, find, find_all, #key, resource_name
Methods included from Subresourceable
Instance Attribute Details
#code ⇒ String (readonly)
Returns The general code for this game (eg. “nfl”, “nba”).
30 |
# File 'lib/y_fantasy/resources/game.rb', line 30 option :code |
#current_week ⇒ Integer? (readonly)
Returns The current week number of the game.
60 |
# File 'lib/y_fantasy/resources/game.rb', line 60 option :current_week, optional: true |
#game_id ⇒ String (readonly)
Returns The ID for this game (for Game resource, this is the same as game_key).
22 |
# File 'lib/y_fantasy/resources/game.rb', line 22 option :game_id |
#game_key ⇒ String (readonly)
Returns The unique key for this game.
18 |
# File 'lib/y_fantasy/resources/game.rb', line 18 option :game_key |
#game_weeks ⇒ Array<GameWeek>? (readonly)
Returns Array of game weeks for this game.
78 |
# File 'lib/y_fantasy/resources/game.rb', line 78 option :game_weeks, optional: true, type: array_of(GameWeek) |
#groups ⇒ Array<Group>? (readonly)
Returns Array of groups for this game (e.g. NFL Survival).
94 |
# File 'lib/y_fantasy/resources/game.rb', line 94 option :groups, optional: true, type: array_of(Group) |
#has_schedule ⇒ Boolean? (readonly)
Returns Whether this game has a schedule.
72 |
# File 'lib/y_fantasy/resources/game.rb', line 72 option :has_schedule, optional: true, type: Types::Params::Bool |
#is_contest_over ⇒ Boolean? (readonly)
Returns Whether the contest is over.
68 |
# File 'lib/y_fantasy/resources/game.rb', line 68 option :is_contest_over, optional: true, type: Types::Params::Bool |
#is_contest_reg_active ⇒ Boolean? (readonly)
Returns Whether contest registration is active.
64 |
# File 'lib/y_fantasy/resources/game.rb', line 64 option :is_contest_reg_active, optional: true, type: Types::Params::Bool |
#is_game_over ⇒ Boolean (readonly)
Returns Whether this game’s season is over.
50 |
# File 'lib/y_fantasy/resources/game.rb', line 50 option :is_game_over, type: Types::Params::Bool |
#is_offseason ⇒ Boolean (readonly)
Returns Whether this game is in the offseason.
54 |
# File 'lib/y_fantasy/resources/game.rb', line 54 option :is_offseason, type: Types::Params::Bool |
#is_registration_over ⇒ Boolean (readonly)
Returns Whether registration for this game is over.
46 |
# File 'lib/y_fantasy/resources/game.rb', line 46 option :is_registration_over, type: Types::Params::Bool |
#leagues ⇒ Array<League>? (readonly)
Returns Array of leagues belonging to this game.
98 |
# File 'lib/y_fantasy/resources/game.rb', line 98 option :leagues, optional: true, type: array_of(League) |
#name ⇒ String (readonly)
Returns The name of the game (eg. “Football”, “Baseball”).
26 |
# File 'lib/y_fantasy/resources/game.rb', line 26 option :name |
#position_types ⇒ Array<PositionType>? (readonly)
Returns Array of position types for this game.
82 |
# File 'lib/y_fantasy/resources/game.rb', line 82 option :position_types, optional: true, type: array_of(PositionType) |
#roster_positions ⇒ Array<RosterPosition>? (readonly)
Returns Array of roster positions for this game.
86 |
# File 'lib/y_fantasy/resources/game.rb', line 86 option :roster_positions, optional: true, type: array_of(RosterPosition) |
#season ⇒ Integer (readonly)
Returns The year of the season.
42 |
# File 'lib/y_fantasy/resources/game.rb', line 42 option :season, type: Types::Coercible::Integer |
#stat_categories ⇒ Array<StatCategory>? (readonly)
Returns Array of stat categories for this game.
90 |
# File 'lib/y_fantasy/resources/game.rb', line 90 option :stat_categories, optional: true, type: array_of(StatCategory) |
#type ⇒ String (readonly)
Returns The type of game (eg. “full”).
34 |
# File 'lib/y_fantasy/resources/game.rb', line 34 option :type |
#url ⇒ String (readonly)
Returns The URL to the game’s home page.
38 |
# File 'lib/y_fantasy/resources/game.rb', line 38 option :url |
Class Method Details
.find_all_by_code(codes, with: [], **options) ⇒ Array<Game>
Finds all games by their code(s)
121 122 123 124 125 126 |
# File 'lib/y_fantasy/resources/game.rb', line 121 def self.find_all_by_code(codes, with: [], **) subresources = Transformations::T.wrap_in_array(with) SubresourceValidator.validate!(self, subresources) data = YFantasy::Api::Client.get(:games, game_codes: codes, subresources: subresources, **) Transformations::CollectionTransformer.new(:games).call(data) end |