Class: YahooSports::NFL

Inherits:
Base
  • Object
show all
Defined in:
lib/yahoo_sports/nfl.rb

Class Method Summary collapse

Class Method Details

.get_homepage_games(state = "") ⇒ Array<OpenStruct>

Get the NFL scoreboard games. Includes recently completed, live and upcoming games.

Source: sports.yahoo.com/nfl

Game struct has the following keys:

game.date   # date of game; includes time if preview
game.team1  # visiting team
game.team2  # home team
game.score1 # team1's score, if live or final
game.score2 # team2's score, if live or final
game.state  # live, final or preview
game.tv     # TV station showing the game, if preview and available

Parameters:

  • state (String) (defaults to: "")

    Optionally filter for the given state (“live”, “final”, or “preview”)

Returns:

  • (Array<OpenStruct>)

    list of games



23
24
25
# File 'lib/yahoo_sports/nfl.rb', line 23

def self.get_homepage_games(state = "")
    super("nfl", state)
end

.get_team_stats(str) ⇒ OpenStruct

Retrieves team information for the team

Source: sports.yahoo.com/nfl/teams/<team>

Team struct has the following keys:

team.name       # full team name
team.standing   # current standing
team.position   # position in the conference
team.last5      # previous games results
team.next5      # upcoming scheduled games
team.live       # struct describing in-progress game, if available

Games in the last5 and next5 lists have the following keys:

game.date       # date of game
game.team       # full team name
game.status     # score for completed games (e.g. "L 20 - 23")
game.away       # boolean value indicating an away game

Parameters:

  • str (String)

    3-letter team code or partial team name

Returns:

  • (OpenStruct)

    team info



48
49
50
# File 'lib/yahoo_sports/nfl.rb', line 48

def self.get_team_stats(str)
    super("nfl", str)
end