MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.
gem install mlb
To ensure the code you're installing hasn't been tampered with, it's recommended that you verify the signature. To do this, you need to add my public key as a trusted certificate (you only need to do this once):
gem cert --add <(curl -Ls https://raw.github.com/sferik/mlb/master/certs/sferik.pem)
Then, install the gem with the high security trust policy:
gem install mlb -P HighSecurity
$ irb >> require 'mlb' >> MLB::Team.all.first.name # => "Arizona Diamondbacks" >> MLB::Team.all.first.league # => "National League" >> MLB::Team.all.first.division # => "National League West" >> MLB::Team.all.first.manager # => "Bob Melvin" >> MLB::Team.all.first.wins # => 82 >> MLB::Team.all.first.losses # => 80 >> MLB::Team.all.first.founded # => 1998 >> MLB::Team.all.first.mascot # => nil >> MLB::Team.all.first.ballpark # => "Chase Field" >> MLB::Team.all.first.logo_url # => "http://img.freebase.com/api/trans/image_thumb/wikipedia/images/en_id/13104064" >> MLB::Team.all.first.players.first.name # => "Alex Romero" >> MLB::Team.all.first.players.first.number # => 28 >> MLB::Team.all.first.players.first.position # => "Right fielder"
Supported Ruby Versions
This library aims to support and is tested against the following Ruby implementations:
If something doesn't work on one of these interpreters, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.
If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.
MLB was built with the following tools:
Copyright (c) 2010-2013 Erik Michaels-Ober. See LICENSE for details.