class Greenmonster::InningsDownloader
Attributes
game_path[R]
Public Class Methods
new(game_path:)
click to toggle source
# File lib/greenmonster/innings_downloader.rb, line 3 def initialize(game_path:) @game_path = game_path end
Public Instance Methods
pull()
click to toggle source
# File lib/greenmonster/innings_downloader.rb, line 7 def pull inning_names.each do |inning_name| Greenmonster::FileDownloader.new( game_path: game_path, file_name: "inning/#{inning_name}" ).pull end end
Private Instance Methods
inning_names()
click to toggle source
# File lib/greenmonster/innings_downloader.rb, line 22 def inning_names relevant_links.map do |link| link.text.strip.gsub("/", "") end end
innings_listing_html()
click to toggle source
# File lib/greenmonster/innings_downloader.rb, line 28 def innings_listing_html HTTParty. get("#{Greenmonster::REMOTE_DATA_ROOT}/#{game_path}/inning"). response. body end
relevant_links()
click to toggle source
# File lib/greenmonster/innings_downloader.rb, line 35 def relevant_links Nokogiri::HTML(innings_listing_html).search("a").select do |link| link.text =~ /inning_\d+\.xml/ end end