ahl_scraper 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +85 -0
- data/.ruby-version +1 -0
- data/.solargraph.yml +15 -0
- data/.travis.yml +6 -0
- data/.vscode/settings.json +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +114 -0
- data/LICENSE.txt +21 -0
- data/README.md +235 -0
- data/Rakefile +8 -0
- data/ahl_scraper.gemspec +27 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/ahl_scraper.rb +55 -0
- data/lib/ahl_scraper/fetchers/division_data_fetcher.rb +19 -0
- data/lib/ahl_scraper/fetchers/game_data_fetcher.rb +29 -0
- data/lib/ahl_scraper/fetchers/game_event_data_fetcher.rb +19 -0
- data/lib/ahl_scraper/fetchers/player_data_fetcher.rb +25 -0
- data/lib/ahl_scraper/fetchers/player_games/data_fetcher.rb +30 -0
- data/lib/ahl_scraper/fetchers/playoff_bracket_data_fetcher.rb +19 -0
- data/lib/ahl_scraper/fetchers/season_data_fetcher.rb +15 -0
- data/lib/ahl_scraper/fetchers/season_end_date_fetcher.rb +34 -0
- data/lib/ahl_scraper/fetchers/season_game_ids_fetcher.rb +21 -0
- data/lib/ahl_scraper/fetchers/season_start_date_fetcher.rb +30 -0
- data/lib/ahl_scraper/fetchers/season_type_fetcher.rb +33 -0
- data/lib/ahl_scraper/fetchers/team_data_fetcher.rb +19 -0
- data/lib/ahl_scraper/fetchers/team_games/data_fetcher.rb +22 -0
- data/lib/ahl_scraper/fetchers/team_roster_data_fetcher.rb +67 -0
- data/lib/ahl_scraper/fixed_games/1001050.json +2182 -0
- data/lib/ahl_scraper/fixed_games/1018774.json +2573 -0
- data/lib/ahl_scraper/fixed_games/1020527.json +2483 -0
- data/lib/ahl_scraper/games.rb +46 -0
- data/lib/ahl_scraper/games/events.rb +8 -0
- data/lib/ahl_scraper/helpers/birthdate_helper.rb +27 -0
- data/lib/ahl_scraper/helpers/elapsed_time_helper.rb +24 -0
- data/lib/ahl_scraper/helpers/ice_time_helper.rb +18 -0
- data/lib/ahl_scraper/helpers/parameterize_helper.rb +35 -0
- data/lib/ahl_scraper/helpers/period_time_helper.rb +25 -0
- data/lib/ahl_scraper/helpers/season_dates_helper.rb +14 -0
- data/lib/ahl_scraper/player_games.rb +19 -0
- data/lib/ahl_scraper/players.rb +12 -0
- data/lib/ahl_scraper/playoff_brackets.rb +17 -0
- data/lib/ahl_scraper/resource.rb +38 -0
- data/lib/ahl_scraper/resources/game.rb +373 -0
- data/lib/ahl_scraper/resources/game_list_item.rb +57 -0
- data/lib/ahl_scraper/resources/games/coach.rb +23 -0
- data/lib/ahl_scraper/resources/games/events/shot.rb +10 -0
- data/lib/ahl_scraper/resources/games/goal.rb +161 -0
- data/lib/ahl_scraper/resources/games/goalie.rb +106 -0
- data/lib/ahl_scraper/resources/games/info.rb +83 -0
- data/lib/ahl_scraper/resources/games/on_ice_skater.rb +35 -0
- data/lib/ahl_scraper/resources/games/overtime.rb +48 -0
- data/lib/ahl_scraper/resources/games/penalty.rb +101 -0
- data/lib/ahl_scraper/resources/games/penalty_shot.rb +82 -0
- data/lib/ahl_scraper/resources/games/period.rb +31 -0
- data/lib/ahl_scraper/resources/games/referee.rb +23 -0
- data/lib/ahl_scraper/resources/games/shootout_attempt.rb +61 -0
- data/lib/ahl_scraper/resources/games/skater.rb +94 -0
- data/lib/ahl_scraper/resources/games/star.rb +47 -0
- data/lib/ahl_scraper/resources/games/team.rb +85 -0
- data/lib/ahl_scraper/resources/goalie_game_list_item.rb +69 -0
- data/lib/ahl_scraper/resources/player.rb +71 -0
- data/lib/ahl_scraper/resources/playoff_bracket.rb +21 -0
- data/lib/ahl_scraper/resources/playoff_brackets/game.rb +43 -0
- data/lib/ahl_scraper/resources/playoff_brackets/round.rb +31 -0
- data/lib/ahl_scraper/resources/playoff_brackets/series.rb +73 -0
- data/lib/ahl_scraper/resources/playoff_brackets/team.rb +39 -0
- data/lib/ahl_scraper/resources/roster_player.rb +71 -0
- data/lib/ahl_scraper/resources/season.rb +93 -0
- data/lib/ahl_scraper/resources/season_list_item.rb +30 -0
- data/lib/ahl_scraper/resources/seasons/team.rb +77 -0
- data/lib/ahl_scraper/resources/skater_game_list_item.rb +65 -0
- data/lib/ahl_scraper/resources/team_game_list_item.rb +64 -0
- data/lib/ahl_scraper/resources/team_list_item.rb +20 -0
- data/lib/ahl_scraper/roster_players.rb +11 -0
- data/lib/ahl_scraper/seasons.rb +31 -0
- data/lib/ahl_scraper/services/games/create_skaters_service.rb +72 -0
- data/lib/ahl_scraper/services/games/on_ice_statlines_service.rb +117 -0
- data/lib/ahl_scraper/services/games/penalty_shot_statlines_service.rb +38 -0
- data/lib/ahl_scraper/services/games/penalty_shots_service.rb +30 -0
- data/lib/ahl_scraper/services/games/penalty_statlines_service.rb +62 -0
- data/lib/ahl_scraper/services/games/scoring_statlines_service.rb +115 -0
- data/lib/ahl_scraper/services/games/shootout_statlines_service.rb +42 -0
- data/lib/ahl_scraper/services/games/team_on_ice_goals_service.rb +152 -0
- data/lib/ahl_scraper/services/games/time_splits_service.rb +70 -0
- data/lib/ahl_scraper/services/seasons/teams_service.rb +20 -0
- data/lib/ahl_scraper/team_games.rb +17 -0
- data/lib/ahl_scraper/teams.rb +11 -0
- data/lib/ahl_scraper/version.rb +5 -0
- metadata +138 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
module PlayoffBrackets
|
5
|
+
class Team < Resource
|
6
|
+
def id
|
7
|
+
@id ||= @raw_data[:id].to_i
|
8
|
+
end
|
9
|
+
|
10
|
+
def city
|
11
|
+
@city ||= @raw_data[:city]
|
12
|
+
end
|
13
|
+
|
14
|
+
def abbreviation
|
15
|
+
@abbreviation ||= @raw_data[:team_code]
|
16
|
+
end
|
17
|
+
|
18
|
+
def full_name
|
19
|
+
@full_name ||= @raw_data[:name]
|
20
|
+
end
|
21
|
+
|
22
|
+
def name
|
23
|
+
@name ||= @raw_data[:name].sub(city, "").strip
|
24
|
+
end
|
25
|
+
|
26
|
+
def division
|
27
|
+
@division ||= @raw_data[:division_long_name]
|
28
|
+
end
|
29
|
+
|
30
|
+
def conference_id
|
31
|
+
@conference_id ||= @raw_data[:conf_id].to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def logo_url
|
35
|
+
@logo_url ||= @raw_data[:logo]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class RosterPlayer < Resource
|
5
|
+
attr_reader :team_id, :season_id
|
6
|
+
|
7
|
+
def initialize(raw_data, team_id, season_id)
|
8
|
+
@raw_data = raw_data
|
9
|
+
@team_id = team_id
|
10
|
+
@season_id = season_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def id
|
14
|
+
@id ||= @raw_data.dig(:bio, :row, :player_id).to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def name
|
18
|
+
@name ||= @raw_data.dig(:bio, :row, :name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def shoots
|
22
|
+
@shoots ||= @raw_data.dig(:bio, :row, :shoots)
|
23
|
+
end
|
24
|
+
|
25
|
+
def birthplace
|
26
|
+
@birthplace ||= @raw_data.dig(:bio, :row, :birthplace)
|
27
|
+
end
|
28
|
+
|
29
|
+
def height
|
30
|
+
@height ||= @raw_data.dig(:bio, :row, :height_hyphenated)
|
31
|
+
end
|
32
|
+
|
33
|
+
def birthdate
|
34
|
+
@birthdate ||= @raw_data.dig(:bio, :row, :birthdate)
|
35
|
+
end
|
36
|
+
|
37
|
+
def draft_year
|
38
|
+
@draft_year ||= valid_birthdate? ? birthdate_object.draft_year : nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_age
|
42
|
+
@current_age ||= valid_birthdate? ? birthdate_object.current_age : nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def jersey_number
|
46
|
+
@jersey_number ||= @raw_data.dig(:bio, :row, :tp_jersey_number).to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
def position
|
50
|
+
@position ||= @raw_data.dig(:bio, :row, :position)
|
51
|
+
end
|
52
|
+
|
53
|
+
def weight
|
54
|
+
@weight ||= @raw_data.dig(:bio, :row, :w).to_i
|
55
|
+
end
|
56
|
+
|
57
|
+
def rookie?
|
58
|
+
@rookie ||= @raw_data.dig(:stats, :prop, :rookie, :rookie) == "1"
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def birthdate_object
|
64
|
+
@birthdate_object ||= BirthdateHelper.new(birthdate)
|
65
|
+
end
|
66
|
+
|
67
|
+
def valid_birthdate?
|
68
|
+
@valid_birthdate ||= !@raw_data.dig(:bio, :row, :birthdate).empty? && @raw_data.dig(:bio, :row, :birthdate) != "0000-00-00"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class Season < Resource
|
5
|
+
attr_reader :id, :name, :season_type
|
6
|
+
|
7
|
+
def initialize(raw_data)
|
8
|
+
@id = raw_data[:id].to_i
|
9
|
+
@name = raw_data[:name]
|
10
|
+
@season_type = set_season_type
|
11
|
+
@division_data = %i[regular playoffs].include?(season_type) ? DivisionDataFetcher.new(@id).call : []
|
12
|
+
end
|
13
|
+
|
14
|
+
def abbreviation
|
15
|
+
@abbreviation ||=
|
16
|
+
case season_type
|
17
|
+
when :regular
|
18
|
+
"#{start_year.to_s[-2..-1]}-#{end_year.to_s[-2..-1]}"
|
19
|
+
when :playoffs
|
20
|
+
"#{start_year.to_s[-2..-1]}PO"
|
21
|
+
when :all_star_game
|
22
|
+
"#{start_year.to_s[-2..-1]}ASG"
|
23
|
+
when :exhibition
|
24
|
+
"#{start_year.to_s[-2..-1]}-#{end_year.to_s[-2..-1]}EX"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def start_year
|
29
|
+
@start_year ||=
|
30
|
+
case season_type
|
31
|
+
when :regular, :exhibition
|
32
|
+
name[/(.*?)\-/].to_i
|
33
|
+
when :playoffs, :all_star_game
|
34
|
+
name[/(.*?) /].to_i
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def start_date
|
39
|
+
@start_date ||= set_start_date
|
40
|
+
end
|
41
|
+
|
42
|
+
def end_date
|
43
|
+
@end_date ||= set_end_date
|
44
|
+
end
|
45
|
+
|
46
|
+
def end_year
|
47
|
+
@end_year ||=
|
48
|
+
case season_type
|
49
|
+
when :regular, :exhibition
|
50
|
+
start_year + 1
|
51
|
+
when :playoffs, :all_star_game
|
52
|
+
start_year
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def divisions
|
57
|
+
@divisions ||= @division_data.map { |d| d.dig(:headers, :name, :properties, :title) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def teams
|
61
|
+
@teams ||= %i[regular playoffs].include?(season_type) ? Seasons::TeamsService.new(@division_data).call : []
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def set_season_type
|
67
|
+
case name
|
68
|
+
when /Exhibition/
|
69
|
+
:exhibition
|
70
|
+
when /All-Star/
|
71
|
+
:all_star_game
|
72
|
+
when /Playoffs/
|
73
|
+
:playoffs
|
74
|
+
when /Regular/
|
75
|
+
:regular
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_start_date
|
80
|
+
return unless %i[playoffs regular].include? season_type
|
81
|
+
|
82
|
+
day = SeasonStartDateFetcher.new(@id, season_type).call
|
83
|
+
"#{day} #{start_year}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def set_end_date
|
87
|
+
return unless %i[playoffs regular].include? season_type
|
88
|
+
|
89
|
+
day = SeasonEndDateFetcher.new(@id, season_type).call
|
90
|
+
"#{day} #{end_year}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class SeasonListItem < Resource
|
5
|
+
def initialize(raw_data)
|
6
|
+
@raw_data = raw_data
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= @raw_data[:id].to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
@name ||= @raw_data[:name]
|
15
|
+
end
|
16
|
+
|
17
|
+
def season_type
|
18
|
+
case name
|
19
|
+
when /Regular/
|
20
|
+
:regular
|
21
|
+
when /All-Star/
|
22
|
+
:all_star
|
23
|
+
when /Playoffs/
|
24
|
+
:playoffs
|
25
|
+
when /Exhibition/
|
26
|
+
:exhibition
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
module Seasons
|
5
|
+
class Team < Resource
|
6
|
+
attr_reader :division
|
7
|
+
|
8
|
+
EXCEPTIONS = {
|
9
|
+
"albany-river-rats" => { city: "Albany", name: "River Rats" },
|
10
|
+
"bridgeport-sound-tigers" => { city: "Bridgeport", name: "Sound Tigers" },
|
11
|
+
"grand-rapids-griffins" => { city: "Grand Rapids", name: "Griffins", abbreviation: "GR" },
|
12
|
+
"hartford-wolf-pack" => { city: "Hartford", name: "Wolf Pack" },
|
13
|
+
"lake-erie-monsters" => { city: "Lake Erie", name: "Monsters" },
|
14
|
+
"lowell-lock-monsters" => { city: "Lowell", name: "Lock Monsters" },
|
15
|
+
"lehigh-valley-phantoms" => { city: "Lehigh Valley", name: "Phantoms" },
|
16
|
+
"manitoba-moose" => { city: "Manitoba", name: "Moose", abbreviation: "MB" },
|
17
|
+
"oklahoma-city-barons" => { city: "Oklahoma City", name: "Barons" },
|
18
|
+
"omaha-ak-sar-ben-knights" => { city: "Omaha", name: "Ak-Sar-Ben Knights" },
|
19
|
+
"quad-city-flames" => { city: "Quad City", name: "Flames" },
|
20
|
+
"san-antonio-rampage" => { city: "San Antonio", name: "Rampage" },
|
21
|
+
"san-diego-gulls" => { city: "San Diego", name: "Gulls" },
|
22
|
+
"san-jose-barracuda" => { city: "San Jose", name: "Barracuda" },
|
23
|
+
"st-john-s-icecaps" => { city: "St. John's", name: "IceCaps" },
|
24
|
+
"st-john-s-maple-leafs" => { city: "St. John's", name: "Maple Leafs" },
|
25
|
+
"cincinnati-mighty-ducks" => { city: "Cincinnati", name: "Mighty Ducks" },
|
26
|
+
"wilkes-barre-scranton-penguins" => { city: "Wilkes-Barre/Scranton", name: "Penguins", game_file_city: "W-B/Scranton" },
|
27
|
+
"edmonton-road-runners" => { city: "Edmonton", name: "Road Runners" },
|
28
|
+
"henderson-silver-knights" => { city: "Henderson", name: "Silver Knights" },
|
29
|
+
}.freeze
|
30
|
+
|
31
|
+
def initialize(raw_data, division)
|
32
|
+
@raw_data = raw_data
|
33
|
+
@division = division
|
34
|
+
end
|
35
|
+
|
36
|
+
def id
|
37
|
+
@id ||= @raw_data.dig(:prop, :team_code, :teamLink)&.to_i
|
38
|
+
end
|
39
|
+
|
40
|
+
def full_name
|
41
|
+
@full_name ||= @raw_data.dig(:row, :name)&.delete_prefix("y -")&.delete_prefix("x -")&.delete_prefix("xy -")&.strip
|
42
|
+
end
|
43
|
+
|
44
|
+
def abbreviation
|
45
|
+
@abbreviation ||= EXCEPTIONS[parameterized_name]&.dig(:abbreviation) || @raw_data.dig(:row, :team_code)&.delete_prefix("y -")&.delete_prefix("x -")&.delete_prefix("xy -")&.strip
|
46
|
+
end
|
47
|
+
|
48
|
+
def parameterized_name
|
49
|
+
@parameterized_name ||= ParameterizeHelper.new(full_name).call
|
50
|
+
end
|
51
|
+
|
52
|
+
def city
|
53
|
+
@city ||= full_name.split.length > 2 ? exception_split_object&.dig(:city) : full_name.split[0]
|
54
|
+
end
|
55
|
+
|
56
|
+
def name
|
57
|
+
@name ||= full_name.split.length > 2 ? exception_split_object&.dig(:name) : full_name.split[1]
|
58
|
+
end
|
59
|
+
|
60
|
+
def game_file_city
|
61
|
+
@game_file_city ||= EXCEPTIONS[parameterized_name]&.dig(:game_file_city)
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def exception_split_object
|
67
|
+
@exception_split_object ||=
|
68
|
+
if !EXCEPTIONS[parameterized_name]
|
69
|
+
puts "Three word team name #{full_name} not recognized, must manually decipher team name and city"
|
70
|
+
{}
|
71
|
+
else
|
72
|
+
EXCEPTIONS[parameterized_name]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class SkaterGameListItem < Resource
|
5
|
+
def initialize(raw_data)
|
6
|
+
@raw_data = raw_data
|
7
|
+
end
|
8
|
+
|
9
|
+
def game_id
|
10
|
+
@game_id ||= @raw_data[:prop][:game][:gameLink].to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def game_name
|
14
|
+
@game_name ||= @raw_data[:row][:game]
|
15
|
+
end
|
16
|
+
|
17
|
+
def date
|
18
|
+
@date ||= @raw_data[:row][:date_played]
|
19
|
+
end
|
20
|
+
|
21
|
+
def shots
|
22
|
+
@shots ||= @raw_data[:row][:shots].to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def goals
|
26
|
+
@goals ||= @raw_data[:row][:goals].to_i
|
27
|
+
end
|
28
|
+
|
29
|
+
def goals_pp
|
30
|
+
@goals_pp ||= @raw_data[:row][:pp].to_i
|
31
|
+
end
|
32
|
+
|
33
|
+
def goals_sh
|
34
|
+
@goals_sh ||= @raw_data[:row][:sh].to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def points
|
38
|
+
@points ||= @raw_data[:row][:points].to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
def game_winning_goals
|
42
|
+
@game_winning_goals ||= @raw_data[:row][:gw].to_i
|
43
|
+
end
|
44
|
+
|
45
|
+
def plus_minus
|
46
|
+
@plus_minus ||= @raw_data[:row][:plusminus].to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
def assists
|
50
|
+
@assists ||= @raw_data[:row][:assists].to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
def shootout_goals
|
54
|
+
@shootout_goals ||= @raw_data[:row][:shootout_goals].to_i
|
55
|
+
end
|
56
|
+
|
57
|
+
def shootout_attempts
|
58
|
+
@shootout_attempts ||= @raw_data[:row][:shootout_attempts].to_i
|
59
|
+
end
|
60
|
+
|
61
|
+
def penalty_minutes
|
62
|
+
@penalty_minutes ||= @raw_data[:row][:penalty_minutes].to_i
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class TeamGameListItem < Resource
|
5
|
+
def initialize(raw_data, opts)
|
6
|
+
@raw_data = raw_data
|
7
|
+
@opts = opts
|
8
|
+
end
|
9
|
+
|
10
|
+
def game_id
|
11
|
+
@game_id ||= @raw_data[:row][:game_id].to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
def game_name
|
15
|
+
@game_name ||= "#{away_team[:city]} @ #{home_team[:city]}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def date
|
19
|
+
@date ||= @raw_data[:row][:date_with_day]
|
20
|
+
end
|
21
|
+
|
22
|
+
def status
|
23
|
+
@status ||= @raw_data[:row][:game_status]
|
24
|
+
end
|
25
|
+
|
26
|
+
def game_report_url
|
27
|
+
@game_report_url ||= @raw_data[:prop][:game_report][:link]
|
28
|
+
end
|
29
|
+
|
30
|
+
def game_sheet_url
|
31
|
+
@game_sheet_url ||= @raw_data[:prop][:game_sheet][:link]
|
32
|
+
end
|
33
|
+
|
34
|
+
def game_center_url
|
35
|
+
@game_center_url ||= "https://theahl.com/stats/game-center/#{game_id}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def home_score
|
39
|
+
@home_score ||= @raw_data[:row][:home_goal_count].to_i
|
40
|
+
end
|
41
|
+
|
42
|
+
def away_score
|
43
|
+
@away_score ||= @raw_data[:row][:visiting_goal_count].to_i
|
44
|
+
end
|
45
|
+
|
46
|
+
def home_team
|
47
|
+
@home_team ||= {
|
48
|
+
id: @raw_data[:prop][:home_team_city][:teamLink].to_i,
|
49
|
+
city: @raw_data[:row][:home_team_city],
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def away_team
|
54
|
+
@away_team ||= {
|
55
|
+
id: @raw_data[:prop][:visiting_team_city][:teamLink].to_i,
|
56
|
+
city: @raw_data[:row][:visiting_team_city],
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def at_home?
|
61
|
+
@at_home ||= @opts[:team_id] == home_team[:id]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|