Class: GamedayLocalFetcher
- Inherits:
-
Object
- Object
- GamedayLocalFetcher
- Defined in:
- lib/gameday_local_fetcher.rb
Overview
This class is responsible for retrieving gameday data files from the local file system. It contains methods that read or open a connection to the XML files that have been saved to the local filesystem.
Class Method Summary collapse
-
.fetch_batter(gid, pid) ⇒ Object
Fetches the batters/(pid).xml file.
-
.fetch_batters_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date.
-
.fetch_bench(gid) ⇒ Object
Fetch the bench.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/bench.xml.
-
.fetch_bencho(gid) ⇒ Object
Fetch the benchO.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/benchO.xml.
-
.fetch_boxscore(gid) ⇒ Object
Fetches the boxscore.xml file and returns its contents Sample PATH: components/game/mlb/year_2009/month_05/day_08/gid_2009_05_08_detmlb_clemlb_1/boxscore.xml.
- .fetch_day_highlights(year, month, day) ⇒ Object
-
.fetch_emailsource(gid) ⇒ Object
Fetch the emailSource.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/emailSource.xml.
-
.fetch_epg(year, month, day) ⇒ Object
Fetch the epg.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/epg.xml.
-
.fetch_eventlog(gid) ⇒ Object
Fetches the eventLog.xml file and returns its contents Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_flomlb_wasmlb_1/eventLog.xml.
- .fetch_game_events(gid) ⇒ Object
-
.fetch_game_xml(gid) ⇒ Object
Fetches the game.xml file and returns its contents.
-
.fetch_gamecenter_xml(gid) ⇒ Object
Fetches the gamecenter.xml file and returns its contents.
-
.fetch_gamedaysyn(gid) ⇒ Object
Fetch the gameday_Syn.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/gameday_Syn.xml.
-
.fetch_games_page(year, month, day) ⇒ Object
Fetches the HTML page that lists all games for the specified date.
-
.fetch_inning_hit(gid) ⇒ Object
inning/inning_hit.xml.
-
.fetch_inning_scores(gid) ⇒ Object
inning/inning_Score.xml.
-
.fetch_inningx(gid, inning_num) ⇒ Object
inning/inning_X.xml.
-
.fetch_linescore(gid) ⇒ Object
Fetch the linescore.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/linescore.xml.
- .fetch_media_highlights(gid) ⇒ Object
- .fetch_media_mobile(gid) ⇒ Object
-
.fetch_miniscoreboard(gid) ⇒ Object
Fetch the miniscoreboard.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/miniscoreboard.xml.
- .fetch_notifications_full(gid) ⇒ Object
- .fetch_notifications_inning(gid, inning) ⇒ Object
- .fetch_onbase_linescore(gid) ⇒ Object
- .fetch_onbase_plays(gid) ⇒ Object
-
.fetch_pitcher(gid, pid) ⇒ Object
Fetches the pitchers/(pid).xml file.
-
.fetch_pitchers_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date.
-
.fetch_players(gid) ⇒ Object
Fetches the players.xml file and returns its contents.
-
.fetch_plays(gid) ⇒ Object
Fetch the plays.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/plays.xml.
-
.fetch_scoreboard(year, month, day) ⇒ Object
Fetch the master scoreboard file Sample PATH: components/game/mlb/year_2008/month_04/day_07/master_scoreboard.xml.
Class Method Details
.fetch_batter(gid, pid) ⇒ Object
Fetches the batters/(pid).xml file
139 140 141 142 143 |
# File 'lib/gameday_local_fetcher.rb', line 139 def self.fetch_batter(gid, pid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_batter_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, pid) GamedayUtil.read_file(path) end |
.fetch_batters_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date
187 188 189 190 |
# File 'lib/gameday_local_fetcher.rb', line 187 def self.fetch_batters_page(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/batters.html' GamedayUtil.read_file(path) end |
.fetch_bench(gid) ⇒ Object
Fetch the bench.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/bench.xml
34 35 36 37 |
# File 'lib/gameday_local_fetcher.rb', line 34 def self.fetch_bench(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/bench.xml' GamedayUtil.read_file(path) end |
.fetch_bencho(gid) ⇒ Object
Fetch the benchO.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/benchO.xml
42 43 44 45 |
# File 'lib/gameday_local_fetcher.rb', line 42 def self.fetch_bencho(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/benchO.xml' GamedayUtil.read_file(path) end |
.fetch_boxscore(gid) ⇒ Object
Fetches the boxscore.xml file and returns its contents Sample PATH: components/game/mlb/year_2009/month_05/day_08/gid_2009_05_08_detmlb_clemlb_1/boxscore.xml
50 51 52 53 54 |
# File 'lib/gameday_local_fetcher.rb', line 50 def self.fetch_boxscore(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_boxscore_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_day_highlights(year, month, day) ⇒ Object
26 27 28 29 |
# File 'lib/gameday_local_fetcher.rb', line 26 def self.fetch_day_highlights(year, month, day) path = GamedayPathBuilder.build_day_highlights_path(year, month, day) GamedayUtil.read_file(path) end |
.fetch_emailsource(gid) ⇒ Object
Fetch the emailSource.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/emailSource.xml
59 60 61 62 |
# File 'lib/gameday_local_fetcher.rb', line 59 def self.fetch_emailsource(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/emailSource.xml' GamedayUtil.read_file(path) end |
.fetch_epg(year, month, day) ⇒ Object
Fetch the epg.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/epg.xml
12 13 14 15 |
# File 'lib/gameday_local_fetcher.rb', line 12 def self.fetch_epg(year, month, day) path = GamedayPathBuilder.build_epg_path(year, month, day) GamedayUtil.read_file(path) end |
.fetch_eventlog(gid) ⇒ Object
Fetches the eventLog.xml file and returns its contents Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_flomlb_wasmlb_1/eventLog.xml
67 68 69 70 71 |
# File 'lib/gameday_local_fetcher.rb', line 67 def self.fetch_eventlog(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_eventlog_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_game_events(gid) ⇒ Object
82 83 84 85 86 |
# File 'lib/gameday_local_fetcher.rb', line 82 def self.fetch_game_events(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_game_events_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_game_xml(gid) ⇒ Object
Fetches the game.xml file and returns its contents
75 76 77 78 79 |
# File 'lib/gameday_local_fetcher.rb', line 75 def self.fetch_game_xml(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_game_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_gamecenter_xml(gid) ⇒ Object
Fetches the gamecenter.xml file and returns its contents
90 91 92 93 94 |
# File 'lib/gameday_local_fetcher.rb', line 90 def self.fetch_gamecenter_xml(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_gamecenter_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_gamedaysyn(gid) ⇒ Object
Fetch the gameday_Syn.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/gameday_Syn.xml
99 100 101 102 |
# File 'lib/gameday_local_fetcher.rb', line 99 def self.fetch_gamedaysyn(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/gameday_Syn.xml' GamedayUtil.read_file(path) end |
.fetch_games_page(year, month, day) ⇒ Object
Fetches the HTML page that lists all games for the specified date
178 179 180 181 182 183 |
# File 'lib/gameday_local_fetcher.rb', line 178 def self.fetch_games_page(year, month, day) puts 'LOCAL = fetching games page - ' + year.to_s + ' ' + month.to_s + ' ' + day.to_s path = GamedayPathBuilder.build_day_path(year, month, day) + 'games.html' puts 'PATH = ' + path GamedayUtil.read_file(path) end |
.fetch_inning_hit(gid) ⇒ Object
inning/inning_hit.xml
170 171 172 173 174 |
# File 'lib/gameday_local_fetcher.rb', line 170 def self.fetch_inning_hit(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_inning_hit_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_inning_scores(gid) ⇒ Object
inning/inning_Score.xml
162 163 164 165 166 |
# File 'lib/gameday_local_fetcher.rb', line 162 def self.fetch_inning_scores(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_inning_scores_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_inningx(gid, inning_num) ⇒ Object
inning/inning_X.xml
154 155 156 157 158 |
# File 'lib/gameday_local_fetcher.rb', line 154 def self.fetch_inningx(gid, inning_num) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_inningx_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, inning_num) GamedayUtil.read_file(path) end |
.fetch_linescore(gid) ⇒ Object
Fetch the linescore.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/linescore.xml
107 108 109 110 111 |
# File 'lib/gameday_local_fetcher.rb', line 107 def self.fetch_linescore(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_linescore_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_media_highlights(gid) ⇒ Object
200 201 202 203 |
# File 'lib/gameday_local_fetcher.rb', line 200 def self.fetch_media_highlights(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/media/highlights.xml' GamedayUtil.read_file(path) end |
.fetch_media_mobile(gid) ⇒ Object
206 207 208 209 |
# File 'lib/gameday_local_fetcher.rb', line 206 def self.fetch_media_mobile(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/media/mobile.xml' GamedayUtil.read_file(path) end |
.fetch_miniscoreboard(gid) ⇒ Object
Fetch the miniscoreboard.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/miniscoreboard.xml
116 117 118 119 |
# File 'lib/gameday_local_fetcher.rb', line 116 def self.fetch_miniscoreboard(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/miniscoreboard.xml' GamedayUtil.read_file(path) end |
.fetch_notifications_full(gid) ⇒ Object
230 231 232 233 |
# File 'lib/gameday_local_fetcher.rb', line 230 def self.fetch_notifications_full(gid) path = GamedayPathBuilder.build_game_base_path(gid) + "/notifications/notifications_full.xml" GamedayUtil.read_file(path) end |
.fetch_notifications_inning(gid, inning) ⇒ Object
224 225 226 227 |
# File 'lib/gameday_local_fetcher.rb', line 224 def self.fetch_notifications_inning(gid, inning) path = GamedayPathBuilder.build_game_base_path(gid) + "/notifications/notifications_#{inning}.xml" GamedayUtil.read_file(path) end |
.fetch_onbase_linescore(gid) ⇒ Object
212 213 214 215 |
# File 'lib/gameday_local_fetcher.rb', line 212 def self.fetch_onbase_linescore(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/onbase/linescore.xml' GamedayUtil.read_file(path) end |
.fetch_onbase_plays(gid) ⇒ Object
218 219 220 221 |
# File 'lib/gameday_local_fetcher.rb', line 218 def self.fetch_onbase_plays(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/onbase/plays.xml' GamedayUtil.read_file(path) end |
.fetch_pitcher(gid, pid) ⇒ Object
Fetches the pitchers/(pid).xml file
147 148 149 150 151 |
# File 'lib/gameday_local_fetcher.rb', line 147 def self.fetch_pitcher(gid, pid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_pitcher_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, pid) GamedayUtil.read_file(path) end |
.fetch_pitchers_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date
194 195 196 197 |
# File 'lib/gameday_local_fetcher.rb', line 194 def self.fetch_pitchers_page(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/pitchers.html' GamedayUtil.read_file(path) end |
.fetch_players(gid) ⇒ Object
Fetches the players.xml file and returns its contents
123 124 125 126 127 |
# File 'lib/gameday_local_fetcher.rb', line 123 def self.fetch_players(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) path = GamedayPathBuilder.build_players_path(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) GamedayUtil.read_file(path) end |
.fetch_plays(gid) ⇒ Object
Fetch the plays.xml file Sample PATH: components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/plays.xml
132 133 134 135 |
# File 'lib/gameday_local_fetcher.rb', line 132 def self.fetch_plays(gid) path = GamedayPathBuilder.build_game_base_path(gid) + '/plays.xml' GamedayUtil.read_file(path) end |
.fetch_scoreboard(year, month, day) ⇒ Object
Fetch the master scoreboard file Sample PATH: components/game/mlb/year_2008/month_04/day_07/master_scoreboard.xml
20 21 22 23 |
# File 'lib/gameday_local_fetcher.rb', line 20 def self.fetch_scoreboard(year, month, day) path = GamedayPathBuilder.build_scoreboard_path(year, month, day) GamedayUtil.read_file(path) end |