Project

nhl_scores

0.0
No commit activity in last 3 years
No release in over 3 years
Use Ruby to grab live/recent NHL scores and upcoming matchup details. This gem ships with a minimal CLI.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.3.7
~> 3.12
~> 3.6

Runtime

~> 0.13
~> 0.19
 Project Readme

NHL Scores

Build Status

Use Ruby to fetch details about recent, current, and upcoming regular season NHL matchups.

Example

Installation

gem install nhl_scores

Usage Details

An instance of the NHLScores::Games class gives you access to NHL game data fetched from this endpoint. Instances of this class are initialized with an array of NHLScores::Game instances in the games attribute. The following methods are at your disposal for interacting with the NHLScores::Games instance.

  • NHLScores::Games#all - Returns an array of all games available via the endpoint
  • NHLScores::Games#recent - Returns an array of games recently completed
  • NHLScores::Games#in_progress - Returns an array of current games (including those in pre-game)
  • NHLScores::Games#upcoming - Returns an array of upcoming games

Each array consists of zero or more instances of the aforementioned NHLScores::Game class. Each game instance has the following properties:

  • id
  • date
  • start_time
  • home_team
  • away_team
  • home_team_score
  • away_team_score
  • status
  • ustv (US television)
  • catv (Canadian television)

The public API also exposes the following methods:

  • NHLScores::Game#winner - Returns the winning team for a completed game
  • NHLScores::Game#loser - Returns the losing team for a completed game
  • NHLScores::Game#winner_score - Returns the winning score for a completed game
  • NHLScores::Game#losing_score - Returns the losing score for a completed game
  • NHLScores::Game#leader - Returns the leading team for a game in progress
  • NHLScores::Game#trailer - Returns the trailing team for a game in progress
  • NHLScores::Game#leader_score - Returns the leading score for a game in progress
  • NHLScores::Game#trailer_score - Returns the trailing score for a game in progress

CLI

This gem comes with a CLI that can be used to fetch details about recent, current, and upcoming games via the command line.

Recent Scores

nhl recent

Current Scores

nhl current

Upcoming Games

nhl upcoming

Narrow the Response

You can use the --team (-t) option with a team abbreviation to narrow your results. The full list of team abbreviation-name mappings can be found in lib/nhl_scores.rb.

nhl upcoming -t pit

Let's go Pens.

License

Copyright (c) 2017 Travis Loncar.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.