├── .gitignore ├── Gemfile ├── LICENSE ├── README ├── README.md ├── README.rdoc ├── Rakefile ├── db └── db_structure.sql ├── doc ├── classes │ ├── AtBat.html │ ├── AtBat.src │ │ ├── M000112.html │ │ └── M000113.html │ ├── Batter.html │ ├── Batter.src │ │ ├── M000147.html │ │ ├── M000148.html │ │ ├── M000149.html │ │ └── M000150.html │ ├── BattingAppearance.html │ ├── BattingAppearance.src │ │ ├── M000218.html │ │ ├── M000219.html │ │ └── M000220.html │ ├── BattingStats.html │ ├── BattingStats.src │ │ └── M000165.html │ ├── BoxScore.html │ ├── BoxScore.src │ │ ├── M000052.html │ │ ├── M000053.html │ │ ├── M000054.html │ │ ├── M000055.html │ │ ├── M000056.html │ │ └── M000057.html │ ├── CacheFetcher.html │ ├── CacheFetcher.src │ │ ├── M000145.html │ │ └── M000146.html │ ├── Coach.html │ ├── Coach.src │ │ └── M000130.html │ ├── DataDownloader.html │ ├── DataDownloader.src │ │ ├── M000099.html │ │ ├── M000100.html │ │ ├── M000101.html │ │ ├── M000102.html │ │ ├── M000103.html │ │ ├── M000104.html │ │ ├── M000105.html │ │ ├── M000106.html │ │ ├── M000107.html │ │ ├── M000108.html │ │ ├── M000109.html │ │ ├── M000110.html │ │ └── M000111.html │ ├── Event.html │ ├── Event.src │ │ └── M000222.html │ ├── EventLog.html │ ├── EventLog.src │ │ ├── M000114.html │ │ ├── M000115.html │ │ ├── M000116.html │ │ ├── M000117.html │ │ ├── M000118.html │ │ ├── M000119.html │ │ ├── M000120.html │ │ └── M000121.html │ ├── Game.html │ ├── Game.src │ │ ├── M000189.html │ │ ├── M000190.html │ │ ├── M000191.html │ │ ├── M000192.html │ │ ├── M000193.html │ │ ├── M000194.html │ │ ├── M000195.html │ │ ├── M000196.html │ │ ├── M000197.html │ │ ├── M000198.html │ │ ├── M000199.html │ │ ├── M000200.html │ │ ├── M000201.html │ │ ├── M000202.html │ │ ├── M000203.html │ │ ├── M000204.html │ │ ├── M000205.html │ │ ├── M000206.html │ │ ├── M000207.html │ │ ├── M000208.html │ │ ├── M000209.html │ │ ├── M000210.html │ │ ├── M000211.html │ │ ├── M000212.html │ │ ├── M000213.html │ │ ├── M000214.html │ │ ├── M000215.html │ │ ├── M000216.html │ │ └── M000217.html │ ├── GameStatus.html │ ├── Gameday.html │ ├── Gameday.src │ │ ├── M000263.html │ │ ├── M000264.html │ │ └── M000265.html │ ├── GamedayFetcher.html │ ├── GamedayFetcher.src │ │ ├── M000021.html │ │ ├── M000022.html │ │ ├── M000023.html │ │ ├── M000024.html │ │ ├── M000025.html │ │ ├── M000026.html │ │ ├── M000027.html │ │ ├── M000028.html │ │ ├── M000029.html │ │ ├── M000030.html │ │ ├── M000031.html │ │ ├── M000032.html │ │ ├── M000033.html │ │ ├── M000034.html │ │ ├── M000035.html │ │ ├── M000036.html │ │ ├── M000037.html │ │ ├── M000038.html │ │ ├── M000039.html │ │ ├── M000040.html │ │ ├── M000041.html │ │ ├── M000042.html │ │ ├── M000043.html │ │ ├── M000044.html │ │ ├── M000045.html │ │ ├── M000046.html │ │ ├── M000047.html │ │ ├── M000048.html │ │ ├── M000049.html │ │ ├── M000050.html │ │ └── M000051.html │ ├── GamedayLocalFetcher.html │ ├── GamedayLocalFetcher.src │ │ ├── M000233.html │ │ ├── M000234.html │ │ ├── M000235.html │ │ ├── M000236.html │ │ ├── M000237.html │ │ ├── M000238.html │ │ ├── M000239.html │ │ ├── M000240.html │ │ ├── M000241.html │ │ ├── M000242.html │ │ ├── M000243.html │ │ ├── M000244.html │ │ ├── M000245.html │ │ ├── M000246.html │ │ ├── M000247.html │ │ ├── M000248.html │ │ ├── M000249.html │ │ ├── M000250.html │ │ ├── M000251.html │ │ ├── M000252.html │ │ ├── M000253.html │ │ ├── M000254.html │ │ ├── M000255.html │ │ ├── M000256.html │ │ ├── M000257.html │ │ ├── M000258.html │ │ ├── M000259.html │ │ ├── M000260.html │ │ ├── M000261.html │ │ └── M000262.html │ ├── GamedayParser.html │ ├── GamedayParser.src │ │ ├── M000226.html │ │ ├── M000227.html │ │ ├── M000228.html │ │ ├── M000229.html │ │ ├── M000230.html │ │ ├── M000231.html │ │ └── M000232.html │ ├── GamedayPathBuilder.html │ ├── GamedayRemoteFetcher.html │ ├── GamedayRemoteFetcher.src │ │ ├── M000067.html │ │ ├── M000068.html │ │ ├── M000069.html │ │ ├── M000070.html │ │ ├── M000071.html │ │ ├── M000072.html │ │ ├── M000073.html │ │ ├── M000074.html │ │ ├── M000075.html │ │ ├── M000076.html │ │ ├── M000077.html │ │ ├── M000078.html │ │ ├── M000079.html │ │ ├── M000080.html │ │ ├── M000081.html │ │ ├── M000082.html │ │ ├── M000083.html │ │ ├── M000084.html │ │ ├── M000085.html │ │ ├── M000086.html │ │ ├── M000087.html │ │ ├── M000088.html │ │ ├── M000089.html │ │ ├── M000090.html │ │ ├── M000091.html │ │ ├── M000092.html │ │ ├── M000093.html │ │ ├── M000094.html │ │ ├── M000095.html │ │ ├── M000096.html │ │ └── M000097.html │ ├── GamedayUrlBuilder.html │ ├── GamedayUrlBuilder.src │ │ ├── M000003.html │ │ ├── M000004.html │ │ ├── M000005.html │ │ ├── M000006.html │ │ ├── M000007.html │ │ ├── M000008.html │ │ ├── M000009.html │ │ ├── M000010.html │ │ ├── M000011.html │ │ ├── M000012.html │ │ ├── M000013.html │ │ ├── M000014.html │ │ ├── M000015.html │ │ ├── M000016.html │ │ ├── M000017.html │ │ ├── M000018.html │ │ ├── M000019.html │ │ └── M000020.html │ ├── GamedayUtil.html │ ├── GamedayUtil.src │ │ ├── M000136.html │ │ ├── M000137.html │ │ ├── M000138.html │ │ ├── M000139.html │ │ ├── M000140.html │ │ ├── M000141.html │ │ ├── M000142.html │ │ ├── M000143.html │ │ └── M000144.html │ ├── Hip.html │ ├── Hip.src │ │ └── M000129.html │ ├── Hitchart.html │ ├── Hitchart.src │ │ ├── M000001.html │ │ └── M000002.html │ ├── Inning.html │ ├── Inning.src │ │ └── M000188.html │ ├── LineScore.html │ ├── LineScore.src │ │ ├── M000065.html │ │ └── M000066.html │ ├── Media.html │ ├── Media.src │ │ └── M000221.html │ ├── MediaHighlight.html │ ├── MediaHighlight.src │ │ └── M000225.html │ ├── MediaMobile.html │ ├── MediaMobile.src │ │ └── M000164.html │ ├── OpponentStats.html │ ├── OpponentStats.src │ │ └── M000098.html │ ├── Pitch.html │ ├── Pitch.src │ │ ├── M000127.html │ │ └── M000128.html │ ├── Pitcher.html │ ├── Pitcher.src │ │ ├── M000158.html │ │ ├── M000159.html │ │ ├── M000160.html │ │ ├── M000161.html │ │ ├── M000162.html │ │ └── M000163.html │ ├── PitchingAppearance.html │ ├── PitchingAppearance.src │ │ ├── M000151.html │ │ ├── M000152.html │ │ ├── M000153.html │ │ ├── M000154.html │ │ ├── M000155.html │ │ ├── M000156.html │ │ └── M000157.html │ ├── Player.html │ ├── Player.src │ │ ├── M000058.html │ │ ├── M000059.html │ │ ├── M000060.html │ │ ├── M000061.html │ │ ├── M000062.html │ │ ├── M000063.html │ │ └── M000064.html │ ├── Players.html │ ├── Players.src │ │ ├── M000186.html │ │ └── M000187.html │ ├── Roster.html │ ├── Roster.src │ │ ├── M000122.html │ │ ├── M000123.html │ │ ├── M000124.html │ │ ├── M000125.html │ │ └── M000126.html │ ├── Schedule.html │ ├── Schedule.src │ │ ├── M000131.html │ │ ├── M000132.html │ │ ├── M000133.html │ │ ├── M000134.html │ │ └── M000135.html │ ├── ScheduleGame.html │ ├── ScheduleGame.src │ │ └── M000224.html │ ├── Scoreboard.html │ ├── Scoreboard.src │ │ └── M000223.html │ ├── Team.html │ └── Team.src │ │ ├── M000166.html │ │ ├── M000167.html │ │ ├── M000168.html │ │ ├── M000169.html │ │ ├── M000170.html │ │ ├── M000171.html │ │ ├── M000172.html │ │ ├── M000173.html │ │ ├── M000174.html │ │ ├── M000175.html │ │ ├── M000176.html │ │ ├── M000177.html │ │ ├── M000178.html │ │ ├── M000179.html │ │ ├── M000180.html │ │ ├── M000181.html │ │ ├── M000182.html │ │ ├── M000183.html │ │ ├── M000184.html │ │ └── M000185.html ├── created.rid ├── files │ └── lib │ │ ├── at_bat_rb.html │ │ ├── batter_rb.html │ │ ├── batting_appearance_rb.html │ │ ├── box_score_rb.html │ │ ├── boxscore_html_erb.html │ │ ├── cache_fetcher_rb.html │ │ ├── coach_rb.html │ │ ├── data_downloader_rb.html │ │ ├── event_log_rb.html │ │ ├── event_rb.html │ │ ├── eventlog_html_erb.html │ │ ├── game_rb.html │ │ ├── game_status_rb.html │ │ ├── gameday_config_yml.html │ │ ├── gameday_fetcher_rb.html │ │ ├── gameday_local_fetcher_rb.html │ │ ├── gameday_parser_rb.html │ │ ├── gameday_path_builder_rb.html │ │ ├── gameday_rb.html │ │ ├── gameday_remote_fetcher_rb.html │ │ ├── gameday_url_builder_rb.html │ │ ├── gameday_util_rb.html │ │ ├── hip_rb.html │ │ ├── hitchart_rb.html │ │ ├── inning_rb.html │ │ ├── line_score_rb.html │ │ ├── media_highlight_rb.html │ │ ├── media_mobile_rb.html │ │ ├── media_rb.html │ │ ├── pitch_rb.html │ │ ├── pitcher_rb.html │ │ ├── pitching_appearance_rb.html │ │ ├── player_rb.html │ │ ├── players_rb.html │ │ ├── roster_rb.html │ │ ├── schedule_game_rb.html │ │ ├── schedule_rb.html │ │ ├── scoreboard_rb.html │ │ └── team_rb.html ├── fr_class_index.html ├── fr_file_index.html ├── fr_method_index.html ├── index.html ├── logo.png └── rdoc-style.css ├── gameday_api.gemspec ├── lib ├── gameday_api.rb └── gameday_api │ ├── .DS_Store │ ├── at_bat.rb │ ├── batter.rb │ ├── batting_appearance.rb │ ├── box_score.rb │ ├── boxscore.html.erb │ ├── cache_fetcher.rb │ ├── coach.rb │ ├── data_downloader.rb │ ├── db_importer.rb │ ├── event.rb │ ├── event_log.rb │ ├── eventlog.html.erb │ ├── game.rb │ ├── game_status.rb │ ├── gameday.rb │ ├── gameday_config.yml │ ├── gameday_fetcher.rb │ ├── gameday_local_fetcher.rb │ ├── gameday_parser.rb │ ├── gameday_path_builder.rb │ ├── gameday_remote_fetcher.rb │ ├── gameday_url_builder.rb │ ├── gameday_util.rb │ ├── hip.rb │ ├── hitchart.rb │ ├── import_data.rb │ ├── inning.rb │ ├── line_score.rb │ ├── media.rb │ ├── media_highlight.rb │ ├── media_mobile.rb │ ├── pitch.rb │ ├── pitcher.rb │ ├── pitchfx_db_manager.rb │ ├── pitching_appearance.rb │ ├── pitching_line.rb │ ├── player.rb │ ├── players.rb │ ├── roster.rb │ ├── schedule.rb │ ├── schedule_game.rb │ ├── schedules │ ├── 1877SKED.TXT │ ├── 1878SKED.TXT │ ├── 1879SKED.TXT │ ├── 1880SKED.TXT │ ├── 1881SKED.TXT │ ├── 1882SKED.TXT │ ├── 1883SKED.TXT │ ├── 1884SKED.TXT │ ├── 1885SKED.TXT │ ├── 1886SKED.TXT │ ├── 1887SKED.TXT │ ├── 1888SKED.TXT │ ├── 1889SKED.TXT │ ├── 1890SKED.TXT │ ├── 1891SKED.TXT │ ├── 1892SKED.TXT │ ├── 1893SKED.TXT │ ├── 1894SKED.TXT │ ├── 1895SKED.TXT │ ├── 1896SKED.TXT │ ├── 1897SKED.TXT │ ├── 1898SKED.TXT │ ├── 1899SKED.TXT │ ├── 1900SKED.TXT │ ├── 1901SKED.TXT │ ├── 1902SKED.TXT │ ├── 1903SKED.TXT │ ├── 1904SKED.TXT │ ├── 1905SKED.TXT │ ├── 1906SKED.TXT │ ├── 1907SKED.TXT │ ├── 1908SKED.TXT │ ├── 1909SKED.TXT │ ├── 1910SKED.TXT │ ├── 1911SKED.TXT │ ├── 1912SKED.TXT │ ├── 1913SKED.TXT │ ├── 1914SKED.TXT │ ├── 1915SKED.TXT │ ├── 1916SKED.TXT │ ├── 1917SKED.TXT │ ├── 1918SKED.TXT │ ├── 1919SKED.TXT │ ├── 1920SKED.TXT │ ├── 1921SKED.TXT │ ├── 1922SKED.TXT │ ├── 1923SKED.TXT │ ├── 1924SKED.TXT │ ├── 1925SKED.TXT │ ├── 1926SKED.TXT │ ├── 1927SKED.TXT │ ├── 1928SKED.TXT │ ├── 1929SKED.TXT │ ├── 1930SKED.TXT │ ├── 1931SKED.TXT │ ├── 1932SKED.TXT │ ├── 1933SKED.TXT │ ├── 1934SKED.TXT │ ├── 1935SKED.TXT │ ├── 1936SKED.TXT │ ├── 1937SKED.TXT │ ├── 1938SKED.TXT │ ├── 1939SKED.TXT │ ├── 1940SKED.TXT │ ├── 1941SKED.TXT │ ├── 1942SKED.TXT │ ├── 1943SKED.TXT │ ├── 1944SKED.TXT │ ├── 1945SKED.TXT │ ├── 1946SKED.TXT │ ├── 1947SKED.TXT │ ├── 1948SKED.TXT │ ├── 1949SKED.TXT │ ├── 1950SKED.TXT │ ├── 1951SKED.TXT │ ├── 1952SKED.TXT │ ├── 1953SKED.TXT │ ├── 1954SKED.TXT │ ├── 1955SKED.TXT │ ├── 1956SKED.TXT │ ├── 1957SKED.TXT │ ├── 1958SKED.TXT │ ├── 1959SKED.TXT │ ├── 1960SKED.TXT │ ├── 1961SKED.TXT │ ├── 1962SKED.TXT │ ├── 1963SKED.TXT │ ├── 1964SKED.TXT │ ├── 1965SKED.TXT │ ├── 1966SKED.TXT │ ├── 1967SKED.TXT │ ├── 1968SKED.TXT │ ├── 1969SKED.TXT │ ├── 1970SKED.TXT │ ├── 1971SKED.TXT │ ├── 1972SKED.TXT │ ├── 1973SKED.TXT │ ├── 1974SKED.TXT │ ├── 1975SKED.TXT │ ├── 1976SKED.TXT │ ├── 1977SKED.TXT │ ├── 1978SKED.TXT │ ├── 1979SKED.TXT │ ├── 1980SKED.TXT │ ├── 1981SKED.TXT │ ├── 1982SKED.TXT │ ├── 1983SKED.TXT │ ├── 1984SKED.TXT │ ├── 1985SKED.TXT │ ├── 1986SKED.TXT │ ├── 1987SKED.TXT │ ├── 1988SKED.TXT │ ├── 1989SKED.TXT │ ├── 1990SKED.TXT │ ├── 1991SKED.TXT │ ├── 1992SKED.TXT │ ├── 1993SKED.TXT │ ├── 1994SKED.TXT │ ├── 1995SKED.TXT │ ├── 1996SKED.TXT │ ├── 1997SKED.TXT │ ├── 1998SKED.TXT │ ├── 1999SKED.TXT │ ├── 2000SKED.TXT │ ├── 2001SKED.TXT │ ├── 2002SKED.TXT │ ├── 2003SKED.TXT │ ├── 2004SKED.TXT │ ├── 2005SKED.TXT │ ├── 2006SKED.TXT │ ├── 2007SKED.TXT │ ├── 2008SKED.TXT │ ├── 2009SKED.TXT │ └── 2010SKED.TXT │ ├── scoreboard.rb │ ├── team.rb │ └── version.rb ├── pkg ├── gameday_api-0.1.0.gem └── gameday_api-0.2.0.gem ├── sample_data ├── batters │ ├── 115229.xml │ ├── 150035.xml │ └── 461834.xml ├── boxscore.xml ├── eventLog.xml ├── game.xml ├── gameday.html ├── inning │ ├── inning_1.xml │ ├── inning_5.xml │ ├── inning_9.xml │ ├── inning_Scores.xml │ └── inning_hit.xml ├── pbp │ ├── batters │ │ ├── 120044.xml │ │ ├── 421124.xml │ │ └── 457133.xml │ └── pitchers │ │ ├── 132220.xml │ │ ├── 458250.xml │ │ └── 547820.xml ├── pitchers │ ├── 124604.xml │ ├── 444382.xml │ └── 465657.xml └── players.xml └── test ├── README ├── boxscore.html ├── test_all_closing_pitchers_for_detroit.rb ├── test_all_starting_pitchers_for_detroit.rb ├── test_boxscore_dump.rb ├── test_get_all_appearances_for_granderson.rb ├── test_get_all_appearances_for_robertson.rb ├── test_get_team_game.rb ├── test_import_tigers_pitchfx_to_db.rb ├── test_leadoff_and_cleanup_hitters.rb ├── test_print_batters_for_game.rb ├── test_print_linescores_for_day.rb ├── test_print_pitchers_for_game.rb ├── test_print_player_card.rb ├── test_show_home_roster.rb ├── test_show_pitch_stats_for_game.rb ├── test_show_scoreboard.rb ├── test_unique_starters.rb └── unit_tests ├── all_tests.rb ├── long_running ├── all_long_running.rb ├── test_batter.rb ├── test_pitcher.rb ├── test_player.rb └── test_team.rb ├── test_batter.rb ├── test_batting_appearance.rb ├── test_boxscore.rb ├── test_event_log.rb ├── test_file.dat ├── test_game.rb ├── test_gameday_fetcher.rb ├── test_gameday_url_builder.rb ├── test_gameday_util.rb ├── test_inning.rb ├── test_media.rb ├── test_pitch.rb ├── test_pitcher.rb ├── test_pitching_appearance.rb ├── test_player.rb ├── test_roster.rb └── test_team.rb /.gitignore: -------------------------------------------------------------------------------- 1 | .svn 2 | lib/tmp/**/* 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in gameday_api.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Timothy Fisher 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GamedayApi 2 | Be sure to checkout my more recent [IMPLEMENTATION IN NODE.JS](https://github.com/timothyf/gameday_api_node) 3 | 4 | ## Installation 5 | 6 | Add this line to your application's Gemfile: 7 | 8 | gem 'gameday_api' 9 | 10 | And then execute: 11 | 12 | $ bundle 13 | 14 | Or install it yourself as: 15 | 16 | $ gem install gameday_api 17 | 18 | ## Usage 19 | 20 | TODO: Write usage instructions here 21 | 22 | ## Contributing 23 | 24 | 1. Fork it 25 | 2. Create your feature branch (`git checkout -b my-new-feature`) 26 | 3. Commit your changes (`git commit -am 'Added some feature'`) 27 | 4. Push to the branch (`git push origin my-new-feature`) 28 | 5. Create new Pull Request 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | require "bundler/gem_tasks" 3 | -------------------------------------------------------------------------------- /doc/classes/BattingAppearance.src/M000219.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_player (BattingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/batting_appearance.rb, line 39
14 |   def get_player
15 |     if !self.player
16 |       # retrieve player object
17 |       player = Player.new
18 |       player.init()
19 |       self.player = player
20 |     end
21 |     self.player
22 |   end
23 | 24 | -------------------------------------------------------------------------------- /doc/classes/BattingAppearance.src/M000220.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_atbats (BattingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/batting_appearance.rb, line 51
14 |   def get_atbats
15 |     
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/BoxScore.src/M000053.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | dump_to_file (BoxScore) 9 | 10 | 11 | 12 | 13 |
# File lib/box_score.rb, line 46
14 |   def dump_to_file
15 |     GamedayUtil.save_file("boxscore.html", to_html('boxscore.html.erb'))
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/BoxScore.src/M000055.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_leadoff_hitters (BoxScore) 9 | 10 | 11 | 12 | 13 |
# File lib/box_score.rb, line 63
14 |   def get_leadoff_hitters
15 |     find_hitters("batter")
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/BoxScore.src/M000056.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_cleanup_hitters (BoxScore) 9 | 10 | 11 | 12 | 13 |
# File lib/box_score.rb, line 71
14 |   def get_cleanup_hitters
15 |     find_hitters("batter[@bo='400']")
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/CacheFetcher.src/M000145.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | new (CacheFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/cache_fetcher.rb, line 6
14 |    def initialize(cache_dir=File.expand_path(File.dirname(__FILE__)) + '/tmp')
15 |       # this is the dir where we store our cache
16 |       @cache_dir = cache_dir
17 |    end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/DataDownloader.src/M000099.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | download_all_for_game (DataDownloader) 9 | 10 | 11 | 12 | 13 |
# File lib/data_downloader.rb, line 19
14 |   def download_all_for_game(gid)
15 |     download_xml_for_game(gid)
16 |     download_batters_for_game(gid)
17 |     download_inning_for_game(gid)
18 |     download_media_for_game(gid)
19 |     download_notification_for_game(gid)
20 |     download_onbase_for_game(gid)
21 |     download_pitchers_for_game(gid)
22 |   end
23 | 24 | -------------------------------------------------------------------------------- /doc/classes/DataDownloader.src/M000111.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | tmp_fetch_pages_for_game (DataDownloader) 9 | 10 | 11 | 12 | 13 |
# File lib/data_downloader.rb, line 186
14 |   def tmp_fetch_pages_for_game(gid)
15 |     write_file(get_gid_path(gid) + "/batters.html", GamedayFetcher.fetch_batters_page(gid))
16 |     write_file(get_gid_path(gid) + "/pitchers.html", GamedayFetcher.fetch_pitchers_page(gid))
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/EventLog.src/M000118.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | dump (EventLog) 9 | 10 | 11 | 12 | 13 |
# File lib/event_log.rb, line 71
14 |   def dump
15 |         (1..@max_inning).each do |inning|
16 |                 dump_inning(inning.to_s)
17 |         end
18 |   end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/EventLog.src/M000120.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | dump_to_file (EventLog) 9 | 10 | 11 | 12 | 13 |
# File lib/event_log.rb, line 88
14 |   def dump_to_file
15 |     GamedayUtil.save_file("eventlog.html", self.to_html('eventlog.html.erb'))
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000192.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | set_innings (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 126
14 |     def set_innings(element)
15 |       element.elements.each("linescore/inning") { |element|
16 |          @away_innings << element.attributes['away']
17 |          @home_innings << element.attributes['home']
18 |       }
19 |     end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000198.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_rosters (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 225
14 |   def get_rosters
15 |     if !self.rosters
16 |       players = Players.new
17 |       players.load_from_id(self.gid)
18 |       self.rosters = players.rosters
19 |     end
20 |     self.rosters
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000199.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_eventlog (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 235
14 |   def get_eventlog
15 |     if !@eventlog
16 |       @eventlog = EventLog.new
17 |       @eventlog.load_from_id(@gid)
18 |     end
19 |     @eventlog
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000200.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_boxscore (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 245
14 |   def get_boxscore
15 |     if !@boxscore
16 |       box = BoxScore.new
17 |       box.load_from_id(self.gid)
18 |       @boxscore = box
19 |     end
20 |     @boxscore
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000201.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | dump_boxscore (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 256
14 |   def dump_boxscore
15 |     if self.gid
16 |       bs = get_boxscore
17 |       GamedayUtil.save_file("boxscore.html", bs.to_html('boxscore.html.erb'))
18 |     else
19 |       puts "No data for input specified"
20 |     end
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000203.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_starting_pitchers (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 285
14 |   def get_starting_pitchers
15 |     results = []
16 |     results << get_pitchers('away')[0]
17 |     results << get_pitchers('home')[0]
18 |   end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000208.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_lineups (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 353
14 |   def get_lineups
15 |     results = []
16 |     results << get_batters('away')
17 |     results << get_batters('home')
18 |   end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000209.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_pitching (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 363
14 |   def get_pitching
15 |     results = []
16 |     results << get_pitchers('away')
17 |     results << get_pitchers('home')
18 |   end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000210.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_winner (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 371
14 |   def get_winner
15 |     ls = get_boxscore.linescore
16 |     if ls.home_team_runs > ls.away_team_runs
17 |       return home_team_abbrev
18 |     else
19 |       return visit_team_abbrev
20 |     end
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000211.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_score (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 384
14 |   def get_score
15 |     results = []
16 |     ls = get_boxscore.linescore
17 |     results << ls.away_team_runs
18 |     results << ls.home_team_runs
19 |     results
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000212.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_attendance (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 394
14 |   def get_attendance
15 |     game_info = get_boxscore.game_info
16 |     # parse game_info to get attendance
17 |     game_info[game_info.length-12..game_info.length-7]
18 |   end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000213.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_media (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 401
14 |   def get_media
15 |     if !@media
16 |       @media = Media.new
17 |       @media.load_from_id(@gid) 
18 |     end
19 |     @media
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000216.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_hitchart (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 440
14 |   def get_hitchart
15 |     if !@hitchart
16 |       @hitchart = Hitchart.new
17 |       @hitchart.load_from_gid(@gid)
18 |     end
19 |     @hitchart
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Game.src/M000217.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_num_innings (Game) 9 | 10 | 11 | 12 | 13 |
# File lib/game.rb, line 450
14 |   def get_num_innings
15 |     bs = get_boxscore
16 |     if bs.linescore
17 |       return get_boxscore.linescore.innings.length
18 |     else
19 |       return 0
20 |     end
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Gameday.src/M000263.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | new (Gameday) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday.rb, line 16
14 |   def initialize
15 |     super
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Gameday.src/M000265.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | convert_to_two_digit_str (Gameday) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday.rb, line 47
14 |   def convert_to_two_digit_str(number)
15 |     if number < 10
16 |       return '0'+number.to_s
17 |     else
18 |       return number.to_s
19 |     end
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000021.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetcher (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 57
14 |   def self.fetcher
15 |     GamedayRemoteFetcher
16 |     #GamedayLocalFetcher
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000022.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_epg (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 63
14 |   def self.fetch_epg(year, month, day)
15 |     fetcher.fetch_epg(year, month, day)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000023.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_scoreboard (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 70
14 |   def self.fetch_scoreboard(year, month, day)
15 |     fetcher.fetch_scoreboard(year, month, day)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000024.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_day_highlights (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 75
14 |   def self.fetch_day_highlights(year, month, day)
15 |     fetcher.fetch_day_highlights(year, month, day)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000025.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bench (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 82
14 |   def self.fetch_bench(gid)
15 |     fetcher.fetch_bench(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000026.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bencho (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 89
14 |   def self.fetch_bencho(gid)
15 |     fetcher.fetch_bencho(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000027.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_boxscore (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 96
14 |   def self.fetch_boxscore(gid)
15 |     fetcher.fetch_boxscore(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000028.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_emailsource (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 103
14 |   def self.fetch_emailsource(gid)
15 |     fetcher.fetch_emailsource(gid) 
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000029.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_eventlog (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 110
14 |   def self.fetch_eventlog(gid)
15 |     fetcher.fetch_eventlog(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000030.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_game_xml (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 116
14 |   def self.fetch_game_xml(gid)
15 |     fetcher.fetch_game_xml(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000031.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_game_events (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 121
14 |   def self.fetch_game_events(gid)
15 |     fetcher.fetch_game_events(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000032.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_gamecenter_xml (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 127
14 |   def self.fetch_gamecenter_xml(gid)
15 |     fetcher.fetch_gamecenter_xml(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000033.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_gamedaysyn (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 134
14 |   def self.fetch_gamedaysyn(gid)
15 |     fetcher.fetch_gamedaysyn(gid)  
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000034.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_linescore (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 141
14 |   def self.fetch_linescore(gid)
15 |     fetcher.fetch_linescore(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000035.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_miniscoreboard (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 148
14 |   def self.fetch_miniscoreboard(gid)
15 |     fetcher.fetch_miniscoreboard(gid)   
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000036.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_players (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 154
14 |   def self.fetch_players(gid)
15 |     fetcher.fetch_players(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000037.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_plays (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 161
14 |   def self.fetch_plays(gid)
15 |     fetcher.fetch_plays(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000038.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_batter (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 167
14 |   def self.fetch_batter(gid, pid)
15 |     fetcher.fetch_batter(gid, pid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000039.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_pitcher (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 173
14 |   def self.fetch_pitcher(gid, pid)
15 |     fetcher.fetch_pitcher(gid, pid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000040.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_inningx (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 178
14 |   def self.fetch_inningx(gid, inning_num)
15 |     fetcher.fetch_inningx(gid, inning_num)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000041.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_inning_scores (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 184
14 |   def self.fetch_inning_scores(gid) 
15 |     fetcher.fetch_inning_scores(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000042.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_inning_hit (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 190
14 |   def self.fetch_inning_hit(gid)
15 |     fetcher.fetch_inning_hit(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000043.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_games_page (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 196
14 |   def self.fetch_games_page(year, month, day)
15 |     fetcher.fetch_games_page(year, month, day)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000044.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_batters_page (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 202
14 |   def self.fetch_batters_page(gid)
15 |     fetcher.fetch_batters_page(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000045.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_pitchers_page (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 208
14 |   def self.fetch_pitchers_page(gid)
15 |     fetcher.fetch_pitchers_page(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000046.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_highlights (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 213
14 |   def self.fetch_media_highlights(gid)
15 |     fetcher.fetch_media_highlights(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000047.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_mobile (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 218
14 |   def self.fetch_media_mobile(gid)
15 |     fetcher.fetch_media_mobile(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000048.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_linescore (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 223
14 |   def self.fetch_onbase_linescore(gid)
15 |     fetcher.fetch_onbase_linescore(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000049.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_plays (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 228
14 |   def self.fetch_onbase_plays(gid)
15 |     fetcher.fetch_onbase_plays(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000050.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_inning (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 233
14 |   def self.fetch_notifications_inning(gid, inning)
15 |     fetcher.fetch_notifications_inning(gid, inning)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayFetcher.src/M000051.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_full (GamedayFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_fetcher.rb, line 238
14 |   def self.fetch_notifications_full(gid)
15 |     fetcher.fetch_notifications_full(gid)
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000233.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_epg (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 12
14 |   def self.fetch_epg(year, month, day)
15 |     path = GamedayPathBuilder.build_epg_path(year, month, day)
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000234.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_scoreboard (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 20
14 |   def self.fetch_scoreboard(year, month, day)
15 |     path = GamedayPathBuilder.build_scoreboard_path(year, month, day)
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000235.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_day_highlights (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 26
14 |   def self.fetch_day_highlights(year, month, day)
15 |     path = GamedayPathBuilder.build_day_highlights_path(year, month, day)
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000236.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bench (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 34
14 |   def self.fetch_bench(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/bench.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000237.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bencho (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 42
14 |   def self.fetch_bencho(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/benchO.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000239.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_emailsource (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 59
14 |   def self.fetch_emailsource(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/emailSource.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000244.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_gamedaysyn (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 99
14 |   def self.fetch_gamedaysyn(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/gameday_Syn.xml'
16 |     GamedayUtil.read_file(path)    
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000246.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_miniscoreboard (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 116
14 |   def self.fetch_miniscoreboard(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/miniscoreboard.xml'
16 |     GamedayUtil.read_file(path)   
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000248.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_plays (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 132
14 |   def self.fetch_plays(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/plays.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000254.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_games_page (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 178
14 |   def self.fetch_games_page(year, month, day)
15 |     path = GamedayPathBuilder.build_day_path(year, month, day) + '/games.html'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000255.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_batters_page (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 185
14 |   def self.fetch_batters_page(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/batters.html'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000256.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_pitchers_page (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 192
14 |   def self.fetch_pitchers_page(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/pitchers.html'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000257.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_highlights (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 198
14 |   def self.fetch_media_highlights(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/media/highlights.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000258.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_mobile (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 204
14 |   def self.fetch_media_mobile(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/media/mobile.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000259.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_linescore (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 210
14 |   def self.fetch_onbase_linescore(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/onbase/linescore.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000260.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_plays (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 216
14 |   def self.fetch_onbase_plays(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + '/onbase/plays.xml'
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000261.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_inning (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 222
14 |   def self.fetch_notifications_inning(gid, inning)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + "/notifications/notifications_#{inning}.xml"
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayLocalFetcher.src/M000262.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_full (GamedayLocalFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_local_fetcher.rb, line 228
14 |   def self.fetch_notifications_full(gid)
15 |     path = GamedayPathBuilder.build_game_base_path(gid) + "/notifications/notifications_full.xml"
16 |     GamedayUtil.read_file(path)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000068.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_epg (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 18
14 |   def self.fetch_epg(year, month, day)
15 |     url = GamedayUrlBuilder.build_epg_url(year, month, day)
16 |     fetch(url)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000069.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_scoreboard (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 26
14 |   def self.fetch_scoreboard(year, month, day)
15 |     url = GamedayUrlBuilder.build_scoreboard_url(year, month, day)
16 |     fetch(url)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000070.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_day_highlights (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 32
14 |   def self.fetch_day_highlights(year, month, day)
15 |     url = GamedayUrlBuilder.build_day_highlights_url(year, month, day)
16 |     fetch(url)
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000071.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bench (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 40
14 |   def self.fetch_bench(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/bench.xml'
16 |     fetch(url)   
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000072.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_bencho (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 50
14 |   def self.fetch_bencho(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/benchO.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000074.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_emailsource (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 71
14 |   def self.fetch_emailsource(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/emailSource.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url) 
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000079.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_gamedaysyn (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 119
14 |   def self.fetch_gamedaysyn(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/gameday_Syn.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)    
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000081.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_miniscoreboard (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 140
14 |   def self.fetch_miniscoreboard(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/miniscoreboard.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)   
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000083.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_plays (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 160
14 |   def self.fetch_plays(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/plays.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000089.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_games_page (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 218
14 |   def self.fetch_games_page(year, month, day)
15 |     url = GamedayUrlBuilder.build_day_url(year, month, day)
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000090.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_batters_page (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 227
14 |   def self.fetch_batters_page(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/batters/'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000091.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_pitchers_page (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 236
14 |   def self.fetch_pitchers_page(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/pitchers/'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000092.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_highlights (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 244
14 |   def self.fetch_media_highlights(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/media/highlights.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000093.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_media_mobile (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 252
14 |   def self.fetch_media_mobile(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/media/mobile.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000094.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_linescore (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 260
14 |   def self.fetch_onbase_linescore(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/onbase/linescore.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000095.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_onbase_plays (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 268
14 |   def self.fetch_onbase_plays(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + '/onbase/plays.xml'
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000096.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_inning (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 276
14 |   def self.fetch_notifications_inning(gid, inning)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + "/notifications/notifications_#{inning}.xml"
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayRemoteFetcher.src/M000097.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | fetch_notifications_full (GamedayRemoteFetcher) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_remote_fetcher.rb, line 284
14 |   def self.fetch_notifications_full(gid)
15 |     url = GamedayUrlBuilder.build_game_base_url(gid) + "/notifications/notifications_full.xml"
16 |     fetch(url)
17 |     #fetcher = CacheFetcher.new()
18 |     #return fetcher.fetch(url)
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/GamedayUrlBuilder.src/M000019.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | build_day_url (GamedayUrlBuilder) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_url_builder.rb, line 102
14 |   def self.build_day_url(year, month, day)
15 |     set_date_vars(year, month, day)
16 |     "#{Gameday::GD2_MLB_BASE}/mlb/year_#{@@year}/month_#{@@month}/day_#{@@day}/"
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayUrlBuilder.src/M000020.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | build_month_url (GamedayUrlBuilder) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_url_builder.rb, line 108
14 |   def self.build_month_url(year, month)
15 |     set_date_vars(year, month, nil)
16 |     "#{Gameday::GD2_MLB_BASE}/mlb/year_#{@@year}/month_#{@@month}/"
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/GamedayUtil.src/M000137.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | convert_digit_to_string (GamedayUtil) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_util.rb, line 21
14 |   def self.convert_digit_to_string(digit)
15 |     if digit<10
16 |       return '0' + digit.to_s
17 |     else
18 |       return digit.to_s
19 |     end
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/GamedayUtil.src/M000139.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | read_config (GamedayUtil) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_util.rb, line 44
14 |         def self.read_config
15 |     settings = YAML::load_file(File.expand_path(File.dirname(__FILE__) + "/gameday_config.yml"))
16 |     #settings = YAML::load_file(File.expand_path('gameday_config.yml'))
17 |     set_proxy_info(settings)
18 |         end
19 | 20 | -------------------------------------------------------------------------------- /doc/classes/GamedayUtil.src/M000142.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | read_file (GamedayUtil) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_util.rb, line 76
14 |   def self.read_file(filename)
15 |     
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/GamedayUtil.src/M000143.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | save_file (GamedayUtil) 9 | 10 | 11 | 12 | 13 |
# File lib/gameday_util.rb, line 81
14 |   def self.save_file(filename, data)
15 |     File.open(filename, 'w') {|f| f.write(data) }
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Hitchart.src/M000001.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | new (Hitchart) 9 | 10 | 11 | 12 | 13 |
# File lib/hitchart.rb, line 8
14 |   def initialize
15 |     @hips = []
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/MediaMobile.src/M000164.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | new (MediaMobile) 9 | 10 | 11 | 12 | 13 |
# File lib/media_mobile.rb, line 8
14 |   def initialize(element)
15 |     
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Pitcher.src/M000161.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_pitches (Pitcher) 9 | 10 | 11 | 12 | 13 |
# File lib/pitcher.rb, line 59
14 |   def get_pitches
15 |     results = []
16 |     ab = get_vs_ab
17 |     ab.each do |ab|
18 |       results << ab.pitches
19 |     end
20 |     results.flatten
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Pitcher.src/M000162.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_game (Pitcher) 9 | 10 | 11 | 12 | 13 |
# File lib/pitcher.rb, line 69
14 |   def get_game
15 |     if !@game
16 |       @game = Game.new(@gid)
17 |     end
18 |     @game
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/PitchingAppearance.src/M000152.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | start? (PitchingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/pitching_appearance.rb, line 34
14 |   def start?
15 |     start
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/PitchingAppearance.src/M000153.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | quality_start? (PitchingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/pitching_appearance.rb, line 41
14 |   def quality_start?
15 |     if @inn.to_i >= 6 && @r.to_i < 4
16 |       return true
17 |     end
18 |     return false
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/PitchingAppearance.src/M000155.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_pitches (PitchingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/pitching_appearance.rb, line 63
14 |   def get_pitches
15 |     results = []
16 |     ab = get_vs_ab
17 |     ab.each do |ab|
18 |       results << ab.pitches
19 |     end
20 |     results.flatten
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/PitchingAppearance.src/M000156.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | pitch_count (PitchingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/pitching_appearance.rb, line 73
14 |   def pitch_count
15 |     get_pitches.length
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/PitchingAppearance.src/M000157.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_game (PitchingAppearance) 9 | 10 | 11 | 12 | 13 |
# File lib/pitching_appearance.rb, line 78
14 |   def get_game
15 |     if !@game
16 |       @game = Game.new(@gid)
17 |     end
18 |     @game
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Player.src/M000062.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_team (Player) 9 | 10 | 11 | 12 | 13 |
# File lib/player.rb, line 75
14 |   def get_team
15 |     if !@team_obj
16 |       @team_obj = Team.new(@team_abbrev)
17 |     end
18 |     @team_obj
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Player.src/M000063.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_games_for_season (Player) 9 | 10 | 11 | 12 | 13 |
# File lib/player.rb, line 85
14 |   def get_games_for_season(year)
15 |     if !@games
16 |       @games = get_team.all_games(year)  
17 |     end
18 |     @games
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Roster.src/M000123.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | find_player_by_last_name (Roster) 9 | 10 | 11 | 12 | 13 |
# File lib/roster.rb, line 24
14 |   def find_player_by_last_name(last_name)
15 |     players.each do |player|
16 |       if player.last == last_name
17 |         return player
18 |       end
19 |     end
20 |     nil
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Roster.src/M000124.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | find_player_by_id (Roster) 9 | 10 | 11 | 12 | 13 |
# File lib/roster.rb, line 34
14 |   def find_player_by_id(pid)
15 |     players.each do |player|
16 |       if player.pid == pid
17 |         return player
18 |       end
19 |     end
20 |     nil
21 |   end
22 | 23 | -------------------------------------------------------------------------------- /doc/classes/Roster.src/M000125.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | set_players (Roster) 9 | 10 | 11 | 12 | 13 |
# File lib/roster.rb, line 44
14 |   def set_players(element)
15 |     element.elements.each("player") { |element|
16 |       player = Player.new
17 |       player.init(element, gid)
18 |       self.players << player
19 |     }
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Roster.src/M000126.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | set_coaches (Roster) 9 | 10 | 11 | 12 | 13 |
# File lib/roster.rb, line 53
14 |   def set_coaches(element)
15 |     element.elements.each("coach") { |element|
16 |       coach = Coach.new
17 |       coach.init(element)
18 |       self.coaches << coach
19 |     }
20 |   end
21 | 22 | -------------------------------------------------------------------------------- /doc/classes/Schedule.src/M000131.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | new (Schedule) 9 | 10 | 11 | 12 | 13 |
# File lib/schedule.rb, line 13
14 |   def initialize(year)
15 |     @games = []
16 |     read_file(get_sked_filename(year))
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/Schedule.src/M000132.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_opening_day (Schedule) 9 | 10 | 11 | 12 | 13 |
# File lib/schedule.rb, line 20
14 |   def get_opening_day
15 |     games[0].date
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Schedule.src/M000133.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_season_length (Schedule) 9 | 10 | 11 | 12 | 13 |
# File lib/schedule.rb, line 26
14 |   def get_season_length
15 |     games[games.size-1].home_game_number.to_i
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Schedule.src/M000134.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_sked_filename (Schedule) 9 | 10 | 11 | 12 | 13 |
# File lib/schedule.rb, line 32
14 |   def get_sked_filename(year)
15 |     #'schedules/' + year.to_s + 'SKED.TXT'
16 |     File.expand_path(File.dirname(__FILE__) + '/schedules/' + year.to_s + 'SKED.TXT')
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000167.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | teams (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 73
14 |   def self.teams
15 |     @@abrevs
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000170.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | all_home_games (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 121
14 |   def all_home_games(year)
15 |     games = all_games(year)
16 |     results = games.select {|g| g.home_team_abbrev == @abrev }
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000171.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | all_away_games (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 128
14 |   def all_away_games(year)
15 |     games = all_games(year)
16 |     results = games.select {|g| g.visit_team_abbrev == @abrev }
17 |   end
18 | 19 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000174.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_leadoff_hitters_unique (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 165
14 |   def get_leadoff_hitters_unique(year)
15 |     hitters = get_leadoff_hitters_by_year(year)
16 |     h = {}
17 |     hitters.each {|hitter| h[hitter.batter_name]=hitter}
18 |     h.values
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000176.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_cleanup_hitters_unique (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 192
14 |   def get_cleanup_hitters_unique(year)
15 |     hitters = get_cleanup_hitters_by_year(year)
16 |     h = {}
17 |     hitters.each {|hitter| h[hitter.batter_name]=hitter}
18 |     h.values
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000178.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_starters_unique (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 216
14 |   def get_starters_unique(year)
15 |     pitchers = get_start_pitcher_appearances_by_year(year)
16 |     h = {}
17 |     pitchers.each {|pitcher| h[pitcher.pitcher_name]=pitcher}
18 |     h.values
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000180.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_closers_unique (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 240
14 |   def get_closers_unique(year)
15 |     pitchers = get_close_pitcher_appearances_by_year(year)
16 |     h = {}
17 |     pitchers.each {|pitcher| h[pitcher.pitcher_name]=pitcher}
18 |     h.values
19 |   end
20 | 21 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000182.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | players_for_season (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 269
14 |   def players_for_season(year)
15 |     
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/classes/Team.src/M000183.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | get_games_for_month (Team) 9 | 10 | 11 | 12 | 13 |
# File lib/team.rb, line 275
14 |   def get_games_for_month(year, month)
15 |     
16 |   end
17 | 18 | -------------------------------------------------------------------------------- /doc/created.rid: -------------------------------------------------------------------------------- 1 | Wed, 14 Apr 2010 16:20:22 -0400 2 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 13 | RDoc Documentation 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timothyf/gameday_api/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/doc/logo.png -------------------------------------------------------------------------------- /gameday_api.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | require File.expand_path('../lib/gameday_api/version', __FILE__) 3 | 4 | Gem::Specification.new do |gem| 5 | gem.authors = ["Timothy Fisher"] 6 | gem.email = ["timothyf@gmail.com"] 7 | gem.description = %q{An API for processing live MLB statistics.} 8 | gem.summary = %q{TODO: Write a gem summary} 9 | gem.homepage = %q{http://github.com/timothyf/gameday_api} 10 | 11 | gem.files = `git ls-files`.split($\) 12 | gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } 13 | gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) 14 | gem.name = "gameday_api" 15 | gem.require_paths = ["lib"] 16 | gem.version = GamedayApi::VERSION 17 | end 18 | -------------------------------------------------------------------------------- /lib/gameday_api.rb: -------------------------------------------------------------------------------- 1 | require "gameday_api/version" 2 | 3 | module GamedayApi 4 | # Your code goes here... 5 | end 6 | -------------------------------------------------------------------------------- /lib/gameday_api/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timothyf/gameday_api/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/.DS_Store -------------------------------------------------------------------------------- /lib/gameday_api/at_bat.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/pitch' 2 | 3 | module GamedayApi 4 | # This class represents a single atbat during a single game 5 | class AtBat 6 | 7 | attr_accessor :gid, :inning, :away_team, :home_team 8 | attr_accessor :num, :b, :s, :o, :batter_id, :stand, :b_height, :pitcher_id, :p_throws, :des, :event 9 | attr_accessor :pitches 10 | 11 | def init(element, gid, inning) 12 | @inning = inning 13 | @xml_doc = element 14 | @gid = gid 15 | @num = element.attributes["num"] 16 | @b = element.attributes["b"] 17 | @s = element.attributes["s"] 18 | @o = element.attributes["o"] 19 | @batter_id = element.attributes["batter"] 20 | @stand = element.attributes["stand"] 21 | @b_height = element.attributes["b_height"] 22 | @pitcher_id = element.attributes["pitcher"] 23 | @p_throws = element.attributes["p_throws"] 24 | @des = element.attributes["des"] 25 | @event = element.attributes["event"] 26 | set_pitches(element) 27 | end 28 | 29 | 30 | def set_pitches(element) 31 | @pitches = [] 32 | element.elements.each("pitch") do |element| 33 | pitch = Pitch.new 34 | pitch.init(element) 35 | @pitches << pitch 36 | end 37 | end 38 | 39 | 40 | end 41 | end -------------------------------------------------------------------------------- /lib/gameday_api/cache_fetcher.rb: -------------------------------------------------------------------------------- 1 | require 'net/http' 2 | require 'md5' 3 | 4 | module GamedayApi 5 | class CacheFetcher 6 | 7 | def initialize(cache_dir=File.expand_path(File.dirname(__FILE__)) + '/tmp') 8 | # this is the dir where we store our cache 9 | @cache_dir = cache_dir 10 | end 11 | 12 | 13 | def fetch(url) 14 | file = MD5.hexdigest(url) 15 | file_path = File.join("", @cache_dir, file) 16 | # we check if the file -- a MD5 hexdigest of the URL -- exists 17 | # in the dir. If it does we just read data from the file and return 18 | if !File.exists? file_path 19 | #puts 'Not found in cache' 20 | # if the file does not exist (or if the data is not fresh), we 21 | # make an HTTP request and save it to a file 22 | #puts 'Fetching file from internet...' 23 | File.open(file_path, "w") do |data| 24 | data << Net::HTTP.get_response(URI.parse(url)).body 25 | end 26 | else 27 | #puts 'Using cache' 28 | end 29 | return File.new(file_path) 30 | end 31 | 32 | end 33 | end -------------------------------------------------------------------------------- /lib/gameday_api/coach.rb: -------------------------------------------------------------------------------- 1 | # This class represents a single MLB coach 2 | module GamedayApi 3 | class Coach 4 | 5 | attr_accessor :position, :first, :last, :id, :num 6 | 7 | 8 | def init(element) 9 | self.id = element.attributes['id'] 10 | self.first = element.attributes['first'] 11 | self.last = element.attributes['last'] 12 | self.num= element.attributes['num'] 13 | self.position = element.attributes['position'] 14 | end 15 | 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /lib/gameday_api/event.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | class Event 3 | 4 | attr_accessor :number, :inning, :description, :team 5 | 6 | def load(element, home_or_away) 7 | @xml_doc = element 8 | @team = home_or_away 9 | @number = element.attributes["number"] 10 | @inning = element.attributes["inning"] 11 | @description = element.attributes["description"] 12 | end 13 | 14 | 15 | end 16 | end -------------------------------------------------------------------------------- /lib/gameday_api/eventlog.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timothyf/gameday_api/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/lib/gameday_api/eventlog.html.erb -------------------------------------------------------------------------------- /lib/gameday_api/game_status.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | class GameStatus 4 | 5 | attr_accessor :status, :ind, :reason, :inning, :top_inning, :b, :s, :o 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/gameday_api/gameday_config.yml: -------------------------------------------------------------------------------- 1 | # If you are behind a firewall, set a proxy here 2 | proxy: 3 | # host: 10.0.6.251 4 | # port: 3128 5 | 6 | # Do you want to retrieve the Gameday files from the gd2.mlb.com server, or from local storage 7 | # uncomment the desired fetcher 8 | #fetcher: remote 9 | fetcher: local 10 | 11 | # Move FILEBASEPATH into here 12 | 13 | # Move Gameday BASE URL into here 14 | 15 | -------------------------------------------------------------------------------- /lib/gameday_api/hip.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | class Hip 4 | 5 | attr_accessor :des, :x, :y, :batter_id, :pitcher_id, :hip_type, :team, :inning 6 | 7 | 8 | def initialize(element) 9 | @des = element.attributes["des"] 10 | @x = element.attributes["x"] 11 | @y = element.attributes["y"] 12 | @batter_id = element.attributes["batter"] 13 | @pitcher_id = element.attributes["pitcher"] 14 | @hip_type = element.attributes["type"] 15 | @team = element.attributes["team"] 16 | @inning = element.attributes["inning"] 17 | end 18 | 19 | 20 | end 21 | end -------------------------------------------------------------------------------- /lib/gameday_api/hitchart.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/hip' 2 | 3 | module GamedayApi 4 | 5 | class Hitchart 6 | 7 | attr_accessor :hips, :gid 8 | 9 | 10 | def initialize 11 | @hips = [] 12 | end 13 | 14 | 15 | def load_from_gid(gid) 16 | @gid = gid 17 | @xml_data = GamedayFetcher.fetch_inning_hit(gid) 18 | @xml_doc = REXML::Document.new(@xml_data) 19 | if @xml_doc.root 20 | @xml_doc.elements.each("hitchart/hip") do |element| 21 | hip = Hip.new(element) 22 | @hips << hip 23 | end 24 | end 25 | end 26 | 27 | 28 | end 29 | end -------------------------------------------------------------------------------- /lib/gameday_api/import_data.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/db_importer' 2 | 3 | db = DbImporter.new('localhost','root','','pitchfx') 4 | 5 | #db.import_for_month('2010','04') 6 | 7 | db.import_for_date('2010','04', '05') 8 | 9 | -------------------------------------------------------------------------------- /lib/gameday_api/inning.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/at_bat' 2 | require 'gameday_api/gameday_fetcher' 3 | 4 | module GamedayApi 5 | 6 | # This class represents a single inning of an MLB game 7 | class Inning 8 | 9 | attr_accessor :gid, :num, :away_team, :home_team, :top_atbats, :bottom_atbats 10 | 11 | 12 | # loads an Inning object given a game id and an inning number 13 | def load_from_id(gid, inning) 14 | @top_atbats = [] 15 | @bottom_atbats = [] 16 | @gid = gid 17 | begin 18 | @xml_data = GamedayFetcher.fetch_inningx(gid, inning) 19 | @xml_doc = REXML::Document.new(@xml_data) 20 | if @xml_doc.root 21 | @num = @xml_doc.root.attributes["num"] 22 | @away_team = @xml_doc.root.attributes["away_team"] 23 | @home_team = @xml_doc.root.attributes["home_team"] 24 | set_top_ab 25 | set_bottom_ab 26 | end 27 | rescue 28 | puts "Could not load inning file for #{gid}, inning #{inning.to_s}" 29 | end 30 | end 31 | 32 | 33 | private 34 | 35 | def set_top_ab 36 | @xml_doc.elements.each("inning/top/atbat") { |element| 37 | atbat = AtBat.new 38 | atbat.init(element, @gid, @num) 39 | @top_atbats.push atbat 40 | } 41 | end 42 | 43 | 44 | def set_bottom_ab 45 | @xml_doc.elements.each("inning/bottom/atbat") { |element| 46 | atbat = AtBat.new 47 | atbat.init(element, @gid, @num) 48 | @bottom_atbats.push atbat 49 | } 50 | end 51 | 52 | 53 | end 54 | end -------------------------------------------------------------------------------- /lib/gameday_api/line_score.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | # This class contains data representing a linescore for a single game. 4 | class LineScore 5 | 6 | attr_accessor :xml_doc 7 | attr_accessor :away_team_runs, :home_team_runs, :away_team_hits, :home_team_hits, :away_team_errors, :home_team_errors 8 | attr_accessor :innings 9 | 10 | # Initialize this instance from an XML element containing linescore data. 11 | def init(element) 12 | @xml_doc = element 13 | self.away_team_runs = element.attributes["away_team_runs"] 14 | self.away_team_hits = element.attributes["away_team_hits"] 15 | self.away_team_errors = element.attributes["away_team_errors"] 16 | 17 | self.home_team_runs = element.attributes["home_team_runs"] 18 | self.home_team_hits = element.attributes["home_team_hits"] 19 | self.home_team_errors = element.attributes["home_team_errors"] 20 | 21 | # Set score by innings 22 | set_innings 23 | end 24 | 25 | 26 | def set_innings 27 | @innings = [] 28 | @xml_doc.elements.each("inning_line_score") do |element| 29 | score = [] 30 | score.push element.attributes["away"] 31 | score.push element.attributes["home"] 32 | @innings.push score 33 | end 34 | end 35 | 36 | 37 | 38 | end 39 | end 40 | 41 | -------------------------------------------------------------------------------- /lib/gameday_api/media.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/gameday_fetcher' 2 | require 'gameday_api/media_highlight' 3 | require 'gameday_api/media_mobile' 4 | 5 | 6 | module GamedayApi 7 | 8 | class Media 9 | 10 | attr_accessor :gid, :highlights, :mobile 11 | 12 | 13 | def load_from_id(gid) 14 | @gid = gid 15 | @highlights = [] 16 | @mobile = [] 17 | begin 18 | @xml_highlights = GamedayFetcher.fetch_media_highlights(gid) 19 | @xml_doc = REXML::Document.new(@xml_highlights) 20 | if @xml_doc.root 21 | @xml_doc.elements.each("highlights/media") do |element| 22 | highlight = MediaHighlight.new(element) 23 | @highlights << highlight 24 | end 25 | end 26 | 27 | @xml_mobile = GamedayFetcher.fetch_media_mobile(gid) 28 | @xml_doc = REXML::Document.new(@xml_mobile) 29 | if @xml_doc.root 30 | @xml_doc.elements.each("mobile/media") do |element| 31 | mobile = MediaMobile.new(element) 32 | @mobile << mobile 33 | end 34 | end 35 | rescue 36 | puts "Could not find media for #{gid}" 37 | end 38 | end 39 | 40 | 41 | end 42 | end -------------------------------------------------------------------------------- /lib/gameday_api/media_highlight.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | class MediaHighlight 4 | 5 | attr_accessor :id, :date, :type, :v 6 | attr_accessor :headline, :duration, :thumb_url 7 | attr_accessor :res_400_url, :res_500_url, :res_800_url 8 | 9 | def initialize(element) 10 | @id = element.attributes['id'] 11 | @date = element.attributes['date'] 12 | @type = element.attributes['type'] 13 | @v = element.attributes['v'] 14 | @headline = element.elements["headline"].text 15 | @duration = element.elements["duration"].text 16 | @thumb_url = element.elements["thumb"].text 17 | if element.elements["url[@playback_scenario='FLASH_400K_600X338']"] 18 | @res_400_url = element.elements["url[@playback_scenario='FLASH_400K_600X338']"].text 19 | else 20 | @res_400_url = nil 21 | end 22 | if element.elements["url[@playback_scenario='FLASH_500K_512X288']"] 23 | @res_500_url = element.elements["url[@playback_scenario='FLASH_500K_512X288']"].text 24 | else 25 | @res_500_url = nil 26 | end 27 | if element.elements["url[@playback_scenario='FLASH_800K_640X360']"] 28 | @res_800_url = element.elements["url[@playback_scenario='FLASH_800K_640X360']"].text 29 | else 30 | @res_800_url = nil 31 | end 32 | end 33 | 34 | 35 | end 36 | end -------------------------------------------------------------------------------- /lib/gameday_api/media_mobile.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | class MediaMobile 4 | 5 | attr_accessor :id, :date, :type, :top_play, :player_id 6 | attr_accessor :team_id, :headline, :duration, :thumb_url 7 | attr_accessor :iphone_low_url, :iphone_hi_url 8 | attr_accessor :h264_low_url, :h264_hi_url 9 | 10 | def initialize(element) 11 | 12 | end 13 | 14 | 15 | end 16 | end -------------------------------------------------------------------------------- /lib/gameday_api/pitching_line.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | class PitchingLine 4 | 5 | attr_accessor :line_id,:game_id, :pitcher_id, :name, :pos, :outs, :bf, :er, :r, :h, :so, :hr, :bb, :w, :l, :era, :note 6 | 7 | def init_from_db(line_id, db) 8 | res = db.get_pitcher_line(line_id) 9 | res.each do |row| 10 | @line_id = row[0] 11 | @game_id = row[1] 12 | @pitcher_id = row[2] 13 | @outs = row[3] 14 | @er = row[4] 15 | @r = row[5] 16 | @h = row[6] 17 | @so = row[7] 18 | @hr = row[8] 19 | @bb = row[9] 20 | @w = row[10] 21 | @l = row[11] 22 | @era = row[12] 23 | @note = row[13] 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/gameday_api/schedule_game.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | 3 | # This class represents a single game from a game schedule 4 | # This class is used in conjunction with the Schedule class. 5 | # This is not the class you would use to retrieve game statistics. 6 | class ScheduleGame 7 | 8 | attr_accessor :date, :day_of_week, :away_team_abbrev, :away_league, :away_game_number 9 | attr_accessor :home_team_abbrev, :home_league, :home_game_number, :day_or_night 10 | 11 | 12 | def initialize(line) 13 | temp = line.split(',') 14 | @date = temp[0].tr_s('"', '').strip 15 | @day_of_week = temp[2].tr_s('"', '').strip 16 | @away_team_abbrev = temp[3].tr_s('"', '').strip 17 | @away_league = temp[4].tr_s('"', '').strip 18 | @away_game_number = temp[5].tr_s('"', '').strip 19 | @home_team_abbrev = temp[6].tr_s('"', '').strip 20 | @home_league = temp[7].tr_s('"', '').strip 21 | @home_game_number = temp[8].tr_s('"', '').strip 22 | @day_or_night = temp[9].tr_s('"', '').strip 23 | end 24 | 25 | end 26 | end -------------------------------------------------------------------------------- /lib/gameday_api/scoreboard.rb: -------------------------------------------------------------------------------- 1 | require 'gameday_api/gameday_fetcher' 2 | 3 | module GamedayApi 4 | 5 | class Scoreboard 6 | 7 | attr_accessor :games # An array of Game objects representing all of the games played on this date 8 | attr_accessor :year, :month, :day 9 | 10 | def load_for_date(year, month, day) 11 | @games = [] 12 | @year = year 13 | @month = month 14 | @day = day 15 | @xml_data = GamedayFetcher.fetch_scoreboard(year, month, day) 16 | @xml_doc = REXML::Document.new(@xml_data) 17 | 18 | @xml_doc.elements.each("games/game") { |element| 19 | game = Game.new(element.attributes['gameday']) 20 | game.load_from_scoreboard(element) 21 | @games << game 22 | } 23 | end 24 | 25 | end 26 | end -------------------------------------------------------------------------------- /lib/gameday_api/version.rb: -------------------------------------------------------------------------------- 1 | module GamedayApi 2 | VERSION = "0.0.1" 3 | end 4 | -------------------------------------------------------------------------------- /pkg/gameday_api-0.1.0.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timothyf/gameday_api/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/pkg/gameday_api-0.1.0.gem -------------------------------------------------------------------------------- /pkg/gameday_api-0.2.0.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timothyf/gameday_api/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/pkg/gameday_api-0.2.0.gem -------------------------------------------------------------------------------- /sample_data/batters/115229.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample_data/batters/150035.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample_data/batters/461834.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample_data/game.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample_data/pbp/batters/457133.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sample_data/pitchers/124604.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sample_data/pitchers/444382.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sample_data/pitchers/465657.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | This directory contains tests that demonstrate usage of the gameday_api. 2 | 3 | To run a test in this directory just type the ruby command followed by the test name, like this: 4 | ruby test_get_all_closing_pitchers_for_detroit.rb 5 | 6 | Feel free to incorporate any code you find here into your own programs. 7 | 8 | -------------------------------------------------------------------------------- /test/test_all_closing_pitchers_for_detroit.rb: -------------------------------------------------------------------------------- 1 | # This test will print a list of the starting pitchers for each of the Detroit 2 | # Tigers games from the 2009 season. 3 | 4 | 5 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 6 | 7 | require 'team' 8 | 9 | team = Team.new('det') 10 | pitchers = team.get_close_pitcher_appearances_by_year('2009') 11 | count = 1 12 | pitchers.each do |appearance| 13 | puts count.to_s + ' ' + appearance.pitcher_name 14 | count = count + 1 15 | end 16 | -------------------------------------------------------------------------------- /test/test_all_starting_pitchers_for_detroit.rb: -------------------------------------------------------------------------------- 1 | # This test will print a list of the starting pitchers for each of the Detroit 2 | # Tigers games from the 2009 season. 3 | 4 | 5 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 6 | 7 | require 'team' 8 | 9 | team = Team.new('det') 10 | pitchers = team.get_start_pitcher_appearances_by_year('2009') 11 | count = 1 12 | pitchers.each do |appearance| 13 | puts count.to_s + ' ' + appearance.pitcher_name 14 | count = count + 1 15 | end 16 | -------------------------------------------------------------------------------- /test/test_boxscore_dump.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'team' 4 | 5 | team = Team.new('det') 6 | games = team.games_for_date('2009', '09', '15') 7 | games[0].get_boxscore.dump_to_file 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/test_get_all_appearances_for_robertson.rb: -------------------------------------------------------------------------------- 1 | # In this test we are attempting to print out all of the appearances 2 | # for Detroit Tiger pitcher Nate Robertson during the 2009 MLB season. 3 | # Nate pitched as both a reliever and a starter during the 2009 season. 4 | 5 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 6 | 7 | require 'pitcher' 8 | 9 | nate_r = Pitcher.new 10 | nate_r.load_from_id('2009_09_20_detmlb_minmlb_1', '425146') 11 | 12 | # lets verify that we found the right player by printing out his name 13 | puts nate_r.first_name + ' ' + nate_r.last_name + ' ' + nate_r.team_abbrev 14 | 15 | appearances = nate_r.get_all_appearances('2009') 16 | 17 | puts 'Games Pitched = ' + appearances.size.to_s 18 | 19 | puts 'Pitch Counts:' 20 | starts = 0 21 | count = 1 22 | appearances.each do |appear| 23 | if appear.start == true 24 | starts += 1 25 | end 26 | puts 'Game #' + count.to_s + ': ' + appear.pitch_count.to_s 27 | count += 1 28 | end 29 | 30 | puts 'Games Started = ' + starts.to_s 31 | 32 | -------------------------------------------------------------------------------- /test/test_get_team_game.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'team' 4 | 5 | team = Team.new('det') 6 | games = team.games_for_date('2009', '09', '15') 7 | games.each do |game| 8 | puts game.print_linescore 9 | end -------------------------------------------------------------------------------- /test/test_import_tigers_pitchfx_to_db.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'db_importer' 4 | 5 | importer = DbImporter.new('localhost', 'root', '', 'pitchfx') 6 | 7 | #importer.import_for_month('2010', '04') 8 | 9 | importer.import_team_for_month('det', '2010', '04') 10 | 11 | #importer.import_for_game('2009_09_09_detmlb_kcamlb_1') 12 | -------------------------------------------------------------------------------- /test/test_leadoff_and_cleanup_hitters.rb: -------------------------------------------------------------------------------- 1 | # This test will print two lists. The first list will be of the leadoff hitters for each of the Detroit 2 | # Tigers games from the 2009 season. The second list will be of the cleanup (4th) hitters for each of 3 | # the Tigers 2009 games. 4 | 5 | 6 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 7 | 8 | require 'team' 9 | 10 | team = Team.new('det') 11 | hitters = team.get_leadoff_hitters_by_year('2009') 12 | count = 1 13 | hitters.each do |appearance| 14 | puts count.to_s + ' ' + appearance.batter_name 15 | count = count + 1 16 | end 17 | 18 | cleanup = team.get_cleanup_hitters_by_year('2009') 19 | count = 1 20 | cleanup.each do |appearance| 21 | puts count.to_s + ' ' + appearance.batter_name 22 | count = count + 1 23 | end 24 | -------------------------------------------------------------------------------- /test/test_print_batters_for_game.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'team' 4 | 5 | team = Team.new('det') 6 | games = team.games_for_date('2009', '09', '15') 7 | 8 | lineups = games[0].get_lineups 9 | 10 | visitors = lineups[0] 11 | home = lineups[1] 12 | 13 | puts 'Visitors' 14 | visitors.each do |batter| 15 | puts batter.batter_name 16 | end 17 | puts 18 | puts 19 | puts 'Home' 20 | home.each do |batter| 21 | puts batter.batter_name 22 | end 23 | -------------------------------------------------------------------------------- /test/test_print_linescores_for_day.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'game' 4 | 5 | games = Game.find_by_date('2009','09','15') 6 | 7 | games.each do |game| 8 | puts game.print_linescore 9 | puts 10 | end -------------------------------------------------------------------------------- /test/test_print_pitchers_for_game.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'team' 4 | 5 | def check_null(value) 6 | return value unless value==nil 7 | ' ' 8 | end 9 | 10 | puts 'Creating team object...' 11 | team = Team.new('det') 12 | puts 'Finding game objects...' 13 | games = team.games_for_date('2009', '09', '15') 14 | puts 'Reading pitchers...' 15 | pitchers = games[0].get_pitching 16 | 17 | visitors = pitchers[0] 18 | home = pitchers[1] 19 | 20 | puts 'Visitors' 21 | visitors.each do |pitcher| 22 | puts pitcher.pitcher_name + ' ' + check_null(pitcher.note) 23 | end 24 | puts 25 | puts 26 | puts 'Home' 27 | home.each do |pitcher| 28 | puts pitcher.pitcher_name + ' ' + check_null(pitcher.note) 29 | end 30 | 31 | -------------------------------------------------------------------------------- /test/test_print_player_card.rb: -------------------------------------------------------------------------------- 1 | # This test prints information and statistics for a player in a format similar 2 | # to what you would see on the back of a baseball card 3 | # Only the past 3 seasons of statistics are included. 4 | 5 | # Display card data for Curtis Granderson 6 | 7 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 8 | 9 | require 'team' 10 | 11 | team = Team.new('det') 12 | 13 | #(2007..2009).each do |year| 14 | roster = team.opening_day_roster(2009) 15 | player = roster.find_player_by_last_name('Granderson') 16 | puts player.first + ' ' + player.last 17 | #end 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/test_show_home_roster.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 2 | 3 | require 'team' 4 | 5 | team = Team.new('det') 6 | games = team.games_for_date('2009', '09', '15') 7 | 8 | players = games[0].get_rosters 9 | 10 | puts 'PLAYERS' 11 | count = 1 12 | players[1].players.each do |player| 13 | puts count.to_s + ' ' + player.first + ' ' + player.last + ' ' + player.position + ' ' + player.dob 14 | count = count + 1 15 | end 16 | 17 | puts '' 18 | puts 'COACHES' 19 | count = 1 20 | players[1].coaches.each do |coach| 21 | puts count.to_s + ' ' + coach.first + ' ' + coach.last + ' ' + coach.position 22 | count = count + 1 23 | end 24 | -------------------------------------------------------------------------------- /test/test_show_pitch_stats_for_game.rb: -------------------------------------------------------------------------------- 1 | # In this test we will print out detailed pitch statistics for 2 | # each of the pitchers who appeared in the specified game between 3 | # Detroit and Kansas City 4 | 5 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 6 | 7 | require 'game' 8 | 9 | def print_stats(pa) 10 | puts pa.pitcher_name 11 | pc = pa.pitch_count 12 | puts " pitches: " + pc.to_s 13 | pitches = pa.set_pitch_stats 14 | puts " balls: " + pa.b.to_s + ', ' + ((pa.b.to_f/pc.to_f)*100).to_i.to_s + '%' 15 | puts " strikes: " + pa.s.to_s + ', ' + ((pa.s.to_f/pc.to_f)*100).to_i.to_s + '%' 16 | puts " in-play: " + pa.x.to_s + ', ' + ((pa.x.to_f/pc.to_f)*100).to_i.to_s + '%' 17 | puts " max speed: " + pa.max_speed.to_s 18 | puts " min speed: " + pa.min_speed.to_s 19 | end 20 | 21 | game = Game.new('2010_04_12_kcamlb_detmlb_1') 22 | pitchers = game.get_pitching 23 | 24 | puts 'Visitors:' 25 | pitchers[0].each do |pa| 26 | print_stats(pa) 27 | end 28 | puts 29 | puts 30 | puts 'Home:' 31 | pitchers[1].each do |pa| 32 | print_stats(pa) 33 | end 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/test_show_scoreboard.rb: -------------------------------------------------------------------------------- 1 | # This test will print the scoreboard containing linescores for the specified date 2 | 3 | 4 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 5 | 6 | require 'scoreboard' 7 | 8 | sb = Scoreboard.new 9 | sb.load_for_date('2009', '09', '20') 10 | 11 | puts 'Games played = ' + sb.games.length.to_s 12 | 13 | sb.games.each do |game| 14 | away_innings_string = ' ' 15 | game.away_innings.each do |inning| 16 | away_innings_string += inning 17 | end 18 | home_innings_string = ' ' 19 | game.home_innings.each do |inning| 20 | if inning 21 | home_innings_string += inning 22 | end 23 | end 24 | # add in totals 25 | away_innings_string += ' ' + game.away_runs + ' ' + game.away_hits + ' ' + game.away_errors 26 | home_innings_string += ' ' + game.home_runs + ' ' + game.home_hits + ' ' + game.home_errors 27 | 28 | puts game.away_team_city + away_innings_string 29 | puts game.home_team_city + home_innings_string 30 | puts 'Winning Pitcher: ' + game.winning_pitcher.first + ' ' + game.winning_pitcher.last 31 | puts 'Losing Pitcher: ' + game.losing_pitcher.first + ' ' + game.losing_pitcher.last 32 | if game.save_pitcher.last && game.save_pitcher.last != '' 33 | puts 'Save Pitcher: ' + game.save_pitcher.first + ' ' + game.save_pitcher.last 34 | end 35 | puts '' 36 | end -------------------------------------------------------------------------------- /test/test_unique_starters.rb: -------------------------------------------------------------------------------- 1 | # This test will print a list of the pitchers who have started at least 2 | # one game during the 2009 season. 3 | 4 | 5 | $: << File.expand_path(File.dirname(__FILE__) + "/../lib") 6 | 7 | require 'team' 8 | 9 | team = Team.new('det') 10 | pitchers = team.get_starters_unique('2009') 11 | count = 1 12 | pitchers.each do |appearance| 13 | puts count.to_s + ' ' + appearance.pitcher_name 14 | count = count + 1 15 | end 16 | -------------------------------------------------------------------------------- /test/unit_tests/all_tests.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'gameday_util' 4 | 5 | GamedayUtil.set_fetcher('remote') 6 | 7 | require 'test/unit' 8 | require 'test_gameday_util' 9 | require 'test_gameday_url_builder' 10 | require 'test_team' 11 | require 'test_game' 12 | require 'test_boxscore' 13 | require 'test_player' 14 | require 'test_gameday_fetcher' 15 | require 'test_batter' 16 | require 'test_pitcher' 17 | require 'test_event_log' 18 | require 'test_pitch' 19 | require 'test_batting_appearance' 20 | require 'test_pitching_appearance' 21 | require 'test_inning' 22 | require 'test_roster' 23 | require 'test_media' 24 | -------------------------------------------------------------------------------- /test/unit_tests/long_running/all_long_running.rb: -------------------------------------------------------------------------------- 1 | require 'test/unit' 2 | require 'test_team' 3 | require 'test_player' 4 | require 'test_batter' 5 | require 'test_pitcher' -------------------------------------------------------------------------------- /test/unit_tests/long_running/test_batter.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") 2 | 3 | require 'test/unit' 4 | require 'batter' 5 | 6 | class TestBatter < Test::Unit::TestCase 7 | 8 | 9 | def setup 10 | if !@batter 11 | @batter = Batter.new 12 | @batter.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') 13 | end 14 | end 15 | 16 | 17 | def test_long_running 18 | get_multihit_appearances_test 19 | #at_bats_count_test 20 | end 21 | 22 | 23 | def get_multihit_appearances_test 24 | appearances = @batter.get_multihit_appearances('2009') 25 | assert_not_nil appearances 26 | assert appearances.length == 40 27 | end 28 | 29 | 30 | def at_bats_count_test 31 | ab_count = @batter.at_bats_count 32 | assert ab_count == 631 33 | end 34 | 35 | 36 | end -------------------------------------------------------------------------------- /test/unit_tests/long_running/test_pitcher.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") 2 | 3 | require 'test/unit' 4 | require 'pitcher' 5 | 6 | class TestPitcher < Test::Unit::TestCase 7 | 8 | 9 | def setup 10 | if !@pitcher 11 | @pitcher = Pitcher.new 12 | @pitcher.load_from_id('2009_09_20_detmlb_minmlb_1', '434378') 13 | assert @pitcher.first_name == 'Justin' 14 | assert @pitcher.last_name == 'Verlander' 15 | end 16 | end 17 | 18 | 19 | end -------------------------------------------------------------------------------- /test/unit_tests/long_running/test_player.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../../lib") 2 | 3 | require 'test/unit' 4 | require 'player' 5 | 6 | class TestPlayer < Test::Unit::TestCase 7 | 8 | 9 | def setup 10 | if !@player 11 | @player = Player.new 12 | @player.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') 13 | end 14 | end 15 | 16 | 17 | def test_long_running 18 | get_all_appearances_test 19 | end 20 | 21 | 22 | def get_all_appearances_test 23 | appearances = @player.get_all_appearances('2009') 24 | assert_not_nil appearances 25 | assert appearances.length == 160 26 | end 27 | 28 | 29 | end -------------------------------------------------------------------------------- /test/unit_tests/test_batter.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'batter' 5 | 6 | class TestBatter < Test::Unit::TestCase 7 | 8 | 9 | def test_load_from_id 10 | batter = Batter.new 11 | batter.load_from_id('2009_09_20_detmlb_minmlb_1','136722') 12 | assert batter.team_abbrev == 'det' 13 | assert batter.first_name == 'Carlos' 14 | assert batter.last_name == 'Guillen' 15 | assert batter.season_stats.avg == '.238' 16 | assert batter.career_stats.avg == '.287' 17 | assert batter.month_stats.avg == '.171' 18 | end 19 | 20 | 21 | def test_get_all_ids_for_game 22 | batters = Batter.get_all_ids_for_game('2009_09_20_detmlb_minmlb_1') 23 | assert_not_nil batters 24 | assert batters.length == 87 25 | assert batters[0] == "111851" 26 | assert batters[1] == "118158" 27 | assert batters[85] == "545363" 28 | assert batters[86] == "547820" 29 | end 30 | 31 | 32 | def test_get_all_ids_for_game_non_existing_page 33 | batters = Batter.get_all_ids_for_game('2010_04_05_nyamlb_bosmlb_1') 34 | assert batters.length == 0 35 | end 36 | 37 | end -------------------------------------------------------------------------------- /test/unit_tests/test_batting_appearance.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'batting_appearance' 5 | 6 | class TestBattingAppearance < Test::Unit::TestCase 7 | 8 | 9 | def test_init 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /test/unit_tests/test_file.dat: -------------------------------------------------------------------------------- 1 | Test Data -------------------------------------------------------------------------------- /test/unit_tests/test_inning.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'inning' 5 | 6 | class TestInning < Test::Unit::TestCase 7 | 8 | 9 | def test_load_from_id 10 | inning = Inning.new 11 | inning.load_from_id(get_gid, 3) 12 | assert inning.gid == get_gid 13 | assert inning.num == '3' 14 | assert inning.away_team == 'det' 15 | assert inning.home_team == 'min' 16 | assert inning.top_atbats.length == 4 17 | assert inning.bottom_atbats.length == 4 18 | assert inning.top_atbats[0].pitches.length == 4 19 | assert inning.top_atbats[1].pitches.length == 1 20 | assert inning.top_atbats[0].pitches[0].des == 'Foul' 21 | assert inning.top_atbats[0].pitches[0].id == '151' 22 | assert inning.top_atbats[0].pitches[0].type == 'S' 23 | assert inning.top_atbats[0].pitches[0].x == '90.13' 24 | end 25 | 26 | 27 | private 28 | 29 | def get_gid 30 | '2009_09_20_detmlb_minmlb_1' 31 | end 32 | 33 | 34 | end -------------------------------------------------------------------------------- /test/unit_tests/test_media.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'media' 5 | 6 | class TestTeam < Test::Unit::TestCase 7 | 8 | 9 | def test_load_from_id 10 | media = Media.new 11 | media.load_from_id('2009_09_20_detmlb_minmlb_1') 12 | assert_not_nil media.highlights 13 | assert_not_nil media.mobile 14 | assert media.highlights.length == 6 15 | assert media.highlights[0].headline == "Punto's RBI single" 16 | assert media.highlights[0].duration == "00:00:37" 17 | assert media.highlights[0].thumb_url == "http://mediadownloads.mlb.com/mlbam/2009/09/20/rth_6751897_th_7.jpg" 18 | assert media.highlights[0].res_400_url == "http://mediadownloads.mlb.com/mlbam/2009/09/20/mlbtv_detmin_6751897_400K.mp4" 19 | assert media.highlights[0].res_500_url == "http://mediadownloads.mlb.com/mlbam/2009/09/20/rth_detmin_6751897_500.mp4" 20 | assert media.highlights[0].res_800_url == "http://mediadownloads.mlb.com/mlbam/2009/09/20/mlbtv_detmin_6751897_800K.mp4" 21 | end 22 | 23 | 24 | end -------------------------------------------------------------------------------- /test/unit_tests/test_pitch.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'pitch' 5 | 6 | class TestPitch < Test::Unit::TestCase 7 | 8 | 9 | def test_init 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /test/unit_tests/test_pitching_appearance.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'pitching_appearance' 5 | 6 | class TestPitchingAppearance < Test::Unit::TestCase 7 | 8 | 9 | def test_init 10 | 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /test/unit_tests/test_player.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'player' 5 | 6 | class TestPlayer < Test::Unit::TestCase 7 | 8 | 9 | def test_load_from_id 10 | player = Player.new 11 | player.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') 12 | 13 | assert player.gid == '2009_09_20_detmlb_minmlb_1' 14 | assert player.pid == '434158' 15 | assert player.first == 'Curtis' 16 | assert player.last == 'Granderson' 17 | assert player.num == '28' 18 | assert player.boxname == 'Granderson' 19 | assert player.rl == 'R' 20 | assert player.position == 'CF' 21 | assert player.status == 'A' 22 | assert player.bat_order == '1' 23 | assert player.game_position == 'CF' 24 | assert player.avg == '.250' 25 | assert player.hr == '27' 26 | assert player.rbi == '63' 27 | assert player.wins == nil 28 | assert player.losses == nil 29 | assert player.era == nil 30 | 31 | assert player.team == 'det' 32 | assert player.type == 'batter' 33 | assert player.height == '6-1' 34 | assert player.weight == '185' 35 | assert player.bats == 'L' 36 | assert player.throws == 'R' 37 | assert player.dob == '03/16/1981' 38 | end 39 | 40 | 41 | def test_get_team 42 | player = Player.new 43 | player.load_from_id('2009_09_20_detmlb_minmlb_1', '434158') 44 | team = player.get_team 45 | assert_not_nil team 46 | assert team.city == 'Detroit' 47 | assert team.name == 'Tigers' 48 | end 49 | 50 | 51 | end -------------------------------------------------------------------------------- /test/unit_tests/test_roster.rb: -------------------------------------------------------------------------------- 1 | $: << File.expand_path(File.dirname(__FILE__) + "/../../lib") 2 | 3 | require 'test/unit' 4 | require 'roster' 5 | 6 | class TestRoster < Test::Unit::TestCase 7 | 8 | 9 | def test_find_player_by_last_name 10 | game = Game.new('2009_09_20_detmlb_minmlb_1') 11 | rosters = game.get_rosters 12 | player = rosters[0].find_player_by_last_name('Verlander') 13 | assert_not_nil player 14 | assert player.first == 'Justin' 15 | assert player.last == 'Verlander' 16 | end 17 | 18 | 19 | def test_find_player_by_id 20 | game = Game.new('2009_09_20_detmlb_minmlb_1') 21 | rosters = game.get_rosters 22 | player = rosters[0].find_player_by_id('425146') 23 | assert_not_nil player 24 | assert player.first == 'Nate' 25 | assert player.last == 'Robertson' 26 | end 27 | 28 | end --------------------------------------------------------------------------------