Project

cricketer

0.01
No commit activity in last 3 years
No release in over 3 years
Parses live scores and game data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 10.0
~> 3.2.0
~> 2.9.3

Runtime

 Project Readme

Cricketer

Cricketer is a Ruby gem for parsing cricket match JSON from ESPNCricinfo.com. It is not intended for commercial use.

Cricketer currently creates Ruby objects for some, but not all, of the JSON data available for a given match. These include information about the score, the current (or latest) status of the match, the players, the ground and some game details. Future versions will have more objects, but the current version provides the raw JSON of all match data published.

Installation

Add this line to your application's Gemfile:

gem 'cricketer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cricketer

Usage

To use Cricketer, you need to know the ID number of a match from espncricinfo.com. For example, the ID for this match is 656399. Pass that ID into the Match constructor:

irb(main):001:0> require 'cricketer'
irb(main):002:0> match = Cricketer::Match.create(656399)
irb(main):003:0> match.description
=> "ICC Cricket World Cup, 1st Match, Pool A: New Zealand v Sri Lanka at Christchurch, Feb 14, 2015"
irb(main):004:0> match.current_status
=> "New Zealand won by 98 runs"
irb(main):005:0> match.team1
=> #<OpenStruct name="New Zealand", id="5", abbrev="NZ">

Contributing

  1. Fork it ( https://github.com/dwillis/cricketer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request