class FootballNow::Importer
Public Class Methods
create_leagues()
click to toggle source
# File lib/importer.rb, line 12 def self.create_leagues FootballNow::Scraper.scrape_leagues.each do |league| FootballNow::League.create_from_hash(league) end end
create_matches()
click to toggle source
# File lib/importer.rb, line 30 def self.create_matches FootballNow::League.all.each do |league| matches_hash(league.league_url).each do |match_hash| FootballNow::Match.create_from_hash(match_hash) end end end
create_teams()
click to toggle source
# File lib/importer.rb, line 18 def self.create_teams FootballNow::League.all.each do |league| teams_hash(league.league_url).each do |team_hash| FootballNow::Team.create_from_hash(team_hash) end end end
generate()
click to toggle source
# File lib/importer.rb, line 3 def self.generate create_leagues puts "#{FootballNow::League.all.count} Leagues loaded..." create_teams puts "#{FootballNow::Team.all.count} Teams loaded..." create_matches puts "#{FootballNow::Match.all.count} Matches loaded..." end
matches_hash(league_url)
click to toggle source
# File lib/importer.rb, line 38 def self.matches_hash(league_url) FootballNow::Scraper.scrape_matches(league_url) end
teams_hash(league_url)
click to toggle source
# File lib/importer.rb, line 26 def self.teams_hash(league_url) FootballNow::Scraper.scrape_teams(league_url) end