Created: 2012-03-24 17:36
Updated: 2016-01-01 08:09
License: mit


This gem uses the YAHOO Sports API to retrieve stats for NBA players


Add this line to your application's Gemfile:

gem 'yahoo_nba'

And then execute:

$ bundle

Or install it yourself as:

$ gem install yahoo_nba


This gem assists in retrieving player keys and player stats using the Yahoo Sports API.

require 'yahoo_nba'
query = 'your_consumer_key', 'your_consumer_secret'

(to obtain a key, go to

To get a hash with all the player keys:

player_keys_hash = query.get_all_player_keys_hash

The hash will be in the format:

{"Player Name"=>"key123", "Player2 Name"=> "key234"}

To get nba player stats:


To get an invidual player's stats:

query.get_player_stats_hash_with_player_name("LeBron James")

The hash will be in the format returned by the Yahoo Sports API.
Note: There will be a request to the Yahoo API for each player so it will take a while to get the stats for all the players.

For more information see:


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more