Class: GamedayRemoteFetcher
- Inherits:
-
Object
- Object
- GamedayRemoteFetcher
- Defined in:
- lib/gameday_remote_fetcher.rb
Class Method Summary collapse
- .fetch(url) ⇒ Object
-
.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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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_eventlog(gid) ⇒ Object
Fetches the eventLog.xml file and returns its contents Sample URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/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 URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/master_scoreboard.xml.
Class Method Details
.fetch(url) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gameday_remote_fetcher.rb', line 6 def self.fetch(url) resp = GamedayUtil.net_http.get_response(URI.parse(url)) case resp when Net::HTTPSuccess result = resp.body else result = nil end result end |
.fetch_batter(gid, pid) ⇒ Object
Fetches the batters/(pid).xml file
169 170 171 172 173 174 175 |
# File 'lib/gameday_remote_fetcher.rb', line 169 def self.fetch_batter(gid, pid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_batter_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, pid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_batters_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date
227 228 229 230 231 232 |
# File 'lib/gameday_remote_fetcher.rb', line 227 def self.fetch_batters_page(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/batters/' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_bench(gid) ⇒ Object
Fetch the bench.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/bench.xml
40 41 42 43 44 45 |
# File 'lib/gameday_remote_fetcher.rb', line 40 def self.fetch_bench(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/bench.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_bencho(gid) ⇒ Object
Fetch the benchO.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/benchO.xml
50 51 52 53 54 55 |
# File 'lib/gameday_remote_fetcher.rb', line 50 def self.fetch_bencho(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/benchO.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_boxscore(gid) ⇒ Object
Fetches the boxscore.xml file and returns its contents Sample URL: gd2.mlb.com/components/game/mlb/year_2009/month_05/day_08/gid_2009_05_08_detmlb_clemlb_1/boxscore.xml
60 61 62 63 64 65 66 |
# File 'lib/gameday_remote_fetcher.rb', line 60 def self.fetch_boxscore(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_boxscore_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_day_highlights(year, month, day) ⇒ Object
32 33 34 35 |
# File 'lib/gameday_remote_fetcher.rb', line 32 def self.fetch_day_highlights(year, month, day) url = GamedayUrlBuilder.build_day_highlights_url(year, month, day) fetch(url) end |
.fetch_emailsource(gid) ⇒ Object
Fetch the emailSource.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/emailSource.xml
71 72 73 74 75 76 |
# File 'lib/gameday_remote_fetcher.rb', line 71 def self.fetch_emailsource(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/emailSource.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_epg(year, month, day) ⇒ Object
18 19 20 21 |
# File 'lib/gameday_remote_fetcher.rb', line 18 def self.fetch_epg(year, month, day) url = GamedayUrlBuilder.build_epg_url(year, month, day) fetch(url) end |
.fetch_eventlog(gid) ⇒ Object
Fetches the eventLog.xml file and returns its contents Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_flomlb_wasmlb_1/eventLog.xml
81 82 83 84 85 |
# File 'lib/gameday_remote_fetcher.rb', line 81 def self.fetch_eventlog(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_eventlog_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) end |
.fetch_game_events(gid) ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/gameday_remote_fetcher.rb', line 98 def self.fetch_game_events(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_game_events_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_game_xml(gid) ⇒ Object
Fetches the game.xml file and returns its contents
89 90 91 92 93 94 95 |
# File 'lib/gameday_remote_fetcher.rb', line 89 def self.fetch_game_xml(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_game_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_gamecenter_xml(gid) ⇒ Object
Fetches the gamecenter.xml file and returns its contents
108 109 110 111 112 113 114 |
# File 'lib/gameday_remote_fetcher.rb', line 108 def self.fetch_gamecenter_xml(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_gamecenter_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_gamedaysyn(gid) ⇒ Object
Fetch the gameday_Syn.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/gameday_Syn.xml
119 120 121 122 123 124 |
# File 'lib/gameday_remote_fetcher.rb', line 119 def self.fetch_gamedaysyn(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/gameday_Syn.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_games_page(year, month, day) ⇒ Object
Fetches the HTML page that lists all games for the specified date
218 219 220 221 222 223 |
# File 'lib/gameday_remote_fetcher.rb', line 218 def self.fetch_games_page(year, month, day) url = GamedayUrlBuilder.build_day_url(year, month, day) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_inning_hit(gid) ⇒ Object
inning/inning_hit.xml
208 209 210 211 212 213 214 |
# File 'lib/gameday_remote_fetcher.rb', line 208 def self.fetch_inning_hit(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_inning_hit_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_inning_scores(gid) ⇒ Object
inning/inning_Score.xml
198 199 200 201 202 203 204 |
# File 'lib/gameday_remote_fetcher.rb', line 198 def self.fetch_inning_scores(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_inning_scores_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_inningx(gid, inning_num) ⇒ Object
inning/inning_X.xml
188 189 190 191 192 193 194 |
# File 'lib/gameday_remote_fetcher.rb', line 188 def self.fetch_inningx(gid, inning_num) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_inningx_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, inning_num) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_linescore(gid) ⇒ Object
Fetch the linescore.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/linescore.xml
129 130 131 132 133 134 135 |
# File 'lib/gameday_remote_fetcher.rb', line 129 def self.fetch_linescore(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_linescore_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_media_highlights(gid) ⇒ Object
244 245 246 247 248 249 |
# File 'lib/gameday_remote_fetcher.rb', line 244 def self.fetch_media_highlights(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/media/highlights.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_media_mobile(gid) ⇒ Object
252 253 254 255 256 257 |
# File 'lib/gameday_remote_fetcher.rb', line 252 def self.fetch_media_mobile(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/media/mobile.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_miniscoreboard(gid) ⇒ Object
Fetch the miniscoreboard.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/miniscoreboard.xml
140 141 142 143 144 145 |
# File 'lib/gameday_remote_fetcher.rb', line 140 def self.fetch_miniscoreboard(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/miniscoreboard.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_notifications_full(gid) ⇒ Object
284 285 286 287 288 289 |
# File 'lib/gameday_remote_fetcher.rb', line 284 def self.fetch_notifications_full(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + "/notifications/notifications_full.xml" fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_notifications_inning(gid, inning) ⇒ Object
276 277 278 279 280 281 |
# File 'lib/gameday_remote_fetcher.rb', line 276 def self.fetch_notifications_inning(gid, inning) url = GamedayUrlBuilder.build_game_base_url(gid) + "/notifications/notifications_#{inning}.xml" fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_onbase_linescore(gid) ⇒ Object
260 261 262 263 264 265 |
# File 'lib/gameday_remote_fetcher.rb', line 260 def self.fetch_onbase_linescore(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/onbase/linescore.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_onbase_plays(gid) ⇒ Object
268 269 270 271 272 273 |
# File 'lib/gameday_remote_fetcher.rb', line 268 def self.fetch_onbase_plays(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/onbase/plays.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_pitcher(gid, pid) ⇒ Object
Fetches the pitchers/(pid).xml file
179 180 181 182 183 184 185 |
# File 'lib/gameday_remote_fetcher.rb', line 179 def self.fetch_pitcher(gid, pid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_pitcher_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid, pid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_pitchers_page(gid) ⇒ Object
Fetches the HTML page that lists all games for the specified date
236 237 238 239 240 241 |
# File 'lib/gameday_remote_fetcher.rb', line 236 def self.fetch_pitchers_page(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/pitchers/' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_players(gid) ⇒ Object
Fetches the players.xml file and returns its contents
149 150 151 152 153 154 155 |
# File 'lib/gameday_remote_fetcher.rb', line 149 def self.fetch_players(gid) gameday_info = GamedayUtil.parse_gameday_id('gid_' + gid) url = GamedayUrlBuilder.build_players_url(gameday_info['year'] , gameday_info['month'], gameday_info['day'] , gid) fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_plays(gid) ⇒ Object
Fetch the plays.xml file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/gid_2008_04_07_atlmlb_colmlb_1/plays.xml
160 161 162 163 164 165 |
# File 'lib/gameday_remote_fetcher.rb', line 160 def self.fetch_plays(gid) url = GamedayUrlBuilder.build_game_base_url(gid) + '/plays.xml' fetch(url) #fetcher = CacheFetcher.new() #return fetcher.fetch(url) end |
.fetch_scoreboard(year, month, day) ⇒ Object
Fetch the master scoreboard file Sample URL: gd2.mlb.com/components/game/mlb/year_2008/month_04/day_07/master_scoreboard.xml
26 27 28 29 |
# File 'lib/gameday_remote_fetcher.rb', line 26 def self.fetch_scoreboard(year, month, day) url = GamedayUrlBuilder.build_scoreboard_url(year, month, day) fetch(url) end |