class TSPScraper::CLI
Public Class Methods
print_help()
click to toggle source
# File lib/tsp_scraper/cli.rb, line 17 def self.print_help puts "Usage: tsp_scraper START_DATE END_DATE" puts "START_DATE and END_DATE should be in the format YYYY-MM-DD." end
print_quotes(quotes)
click to toggle source
# File lib/tsp_scraper/cli.rb, line 22 def self.print_quotes(quotes) quotes.each do |quote| quote[:funds].each do |name, price| puts "#{quote[:date]},#{name},#{price.to_s('F')}" end end end
start()
click to toggle source
# File lib/tsp_scraper/cli.rb, line 3 def self.start begin end_date_raw = ARGV.pop start_date_raw = ARGV.pop start_date = Date.parse(start_date_raw) end_date = Date.parse(end_date_raw) rescue print_help exit 1 end quotes = TSPScraper::Client.scrape(start_date, end_date) print_quotes quotes end