class AhlScraper::TeamGameListItem

Public Class Methods

new(raw_data, opts) click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 5
def initialize(raw_data, opts)
  @raw_data = raw_data
  @opts = opts
end

Public Instance Methods

at_home?() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 60
def at_home?
  @at_home ||= @opts[:team_id] == home_team[:id]
end
away_score() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 42
def away_score
  @away_score ||= @raw_data[:row][:visiting_goal_count].to_i
end
away_team() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 53
def away_team
  @away_team ||= {
    id: @raw_data[:prop][:visiting_team_city][:teamLink].to_i,
    city: @raw_data[:row][:visiting_team_city],
  }
end
date() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 18
def date
  @date ||= @raw_data[:row][:date_with_day]
end
game_center_url() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 34
def game_center_url
  @game_center_url ||= "https://theahl.com/stats/game-center/#{game_id}"
end
game_id() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 10
def game_id
  @game_id ||= @raw_data[:row][:game_id].to_i
end
game_name() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 14
def game_name
  @game_name ||= "#{away_team[:city]} @ #{home_team[:city]}"
end
game_report_url() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 26
def game_report_url
  @game_report_url ||= @raw_data[:prop][:game_report][:link]
end
game_sheet_url() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 30
def game_sheet_url
  @game_sheet_url ||= @raw_data[:prop][:game_sheet][:link]
end
home_score() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 38
def home_score
  @home_score ||= @raw_data[:row][:home_goal_count].to_i
end
home_team() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 46
def home_team
  @home_team ||= {
    id: @raw_data[:prop][:home_team_city][:teamLink].to_i,
    city: @raw_data[:row][:home_team_city],
  }
end
status() click to toggle source
# File lib/ahl_scraper/resources/team_game_list_item.rb, line 22
def status
  @status ||= @raw_data[:row][:game_status]
end