/fantasydata

Wrapper of the Fantasy Data API - NFL Data

Primary LanguageRubyMIT LicenseMIT

Fantasydata

Gem VersionBuild StatusCode ClimateTest Coverage

A Ruby interface to the Fantasy Data API. The Fantasy Data API delivery historical and up to the second NFL, NBA and MLB data. This gem currently only supports the NFL Data but could be expanded to include the others as well. Details about the API can be found here: https://developer.fantasydata.com/documentation. For a Implementation guide check out this page: http://fantasydata.com/resources/implementation-guide.aspx.

Supported Rubies

The following Ruby versions are tested in Travis CI:

  • 2.2.2
  • 2.2.0
  • 2.1.5
  • 2.0.0
  • 1.9.3
  • jruby-19mode
  • rbx-18mode
  • rbx-19mode

Gem Dependencies

Installing this gem also installs the following gems:

  • faraday HTTP client lib that provides a common interface over many adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle.
  • multi_json A common interface to multiple JSON libraries, including Oj, Yajl, the JSON gem (with C-extensions), the pure-Ruby JSON gem, NSJSONSerialization, gson.rb, JrJackson, and OkJson.

Installation

Add this line to your application's Gemfile:

gem 'fantasydata'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fantasydata

Usage

Go to Fantasy Data and sign up for an account to get an API Key.

Then copy and paste in your API keys:

Fantasydata.configure do |config|
  config.api_key =       'YOUR_API_KEY'
end

If you are using Fantasydata with a Rails application then a good location for the key would be to create an initializer, for example you could place the above code in /config/initializers/fantasydata.rb.

You can now use Fantasydata like this:

Fantasydata.current_week

Contributing

  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

Inspiration

This gem relied heavily on the Echowrap gem to follow best practices around the structure of the gem, tests and documentation.