alexistoulotte / roh_my_golf
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Wed Oct 14 02:35:44 -0700 2009 | |
| |
MIT-LICENSE | Fri Oct 09 03:36:43 -0700 2009 | |
| |
README.mdown | Mon Mar 01 11:24:59 -0800 2010 | |
| |
Rakefile | Fri Oct 09 03:36:43 -0700 2009 | |
| |
init.rb | Fri Oct 09 04:05:39 -0700 2009 | |
| |
lib/ | Thu Dec 31 02:04:41 -0800 2009 | |
| |
spec/ | Thu Dec 31 02:04:41 -0800 2009 |
README.mdown
RohMyGolf
Description
Ruby API for OhMyGolf! service.
Usage
First: login
session = RohMyGolf::Session.new
session.login('email@example.com', 'password')
Retrieving rounds
# retrieving first round
round = session.rounds.first
# retrieving players array of this round
round.players
# here the name of the course
round.course
# retrieving the par of first hole (3, 4 or 5)
round.holes.first.par
# retrieving the handicap of third hole (1 to 18)
round.holes.third.handicap
Need some stats?
# retrieving stats of Alexis Toulotte on last round
stats = session.rounds.last.stats(:player => 'Alexis Toulotte')
# or from beginning with a player regexp...
stats = session.stats(:player => /alexis/i)
# or for a specific course
stats = session.stats(:course => /apremont/i, :after => 1.week.ago)
# or for a specific round
stats = session.rounds.last.stats(:player => /alexis/i)
# then you will have a lot of methods, examples:
stats.under_or_equal_to_par_count
stats.over_par_percentage
stats.under_double_bogey_count
stats.net
stats.strokes
stats.net_average
stats.best
stats.worst
Need to retrieve, rounds, holes, scores or stats easily?
# rounds in St. Andrews course
session.query.rounds(:course => /andrew/i)
# holes having a handicap lower than 5.
session.query.holes(:handicap_lower_than => 5).scores
# scores after 1 month ago
session.query.scores(:after => 1.month.ago).first.birdie?
# stats for par 3 or 4
session.query.stats(:par_lower_than => 5).under_or_equal_to_bogey_percentage
Need to export data?
# session, rounds, holes,... can be converted to yaml.
session.to_yaml
