ahl_scraper 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
module Games
|
|
5
|
+
class Star < Resource
|
|
6
|
+
def id
|
|
7
|
+
@id ||= @raw_data[:player][:info][:id]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def number
|
|
11
|
+
@number ||= @opts[:number]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def first_name
|
|
15
|
+
@first_name ||= @raw_data[:player][:info][:firstName]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def last_name
|
|
19
|
+
@last_name ||= @raw_data[:player][:info][:lastName]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def team_id
|
|
23
|
+
@team_id ||= @raw_data[:team][:id]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def jersey_name
|
|
27
|
+
@jersey_name ||= @raw_data[:player][:info][:jerseyNumber]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def position
|
|
31
|
+
@position ||= @raw_data[:player][:info][:position]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def birthdate
|
|
35
|
+
@birthdate ||= @raw_data[:player][:info][:birthDate]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def goalie?
|
|
39
|
+
@goalie ||= @raw_data[:isGoalie]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def image_url
|
|
43
|
+
@image_url ||= @raw_data[:playerImage]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
module Games
|
|
5
|
+
class Team < Resource
|
|
6
|
+
def id
|
|
7
|
+
@id ||= @raw_data[:info][:id]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def full_name
|
|
11
|
+
@full_name ||= @raw_data[:info][:name]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def city
|
|
15
|
+
@city ||= @raw_data[:info][:city]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def name
|
|
19
|
+
@name ||= @raw_data[:info][:nickname] == @raw_data[:info][:city] ? parse_nickname : @raw_data[:info][:nickname]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def abbreviation
|
|
23
|
+
@abbreviation ||= @raw_data[:info][:abbreviation]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def logo_url
|
|
27
|
+
@logo_url ||= @raw_data[:info][:logo]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def home_team?
|
|
31
|
+
@home_team ||= @opts[:home_team]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def stats
|
|
35
|
+
@stats ||= {
|
|
36
|
+
score: score,
|
|
37
|
+
hits: @raw_data[:stats][:hits],
|
|
38
|
+
power_play_goals: @raw_data[:stats][:powerPlayGoals],
|
|
39
|
+
power_play_opportunities: @raw_data[:stats][:powerPlayOpportunities],
|
|
40
|
+
goals: @raw_data[:stats][:goalCount],
|
|
41
|
+
penalty_minute_count: @raw_data[:stats][:penaltyMinuteCount],
|
|
42
|
+
infraction_count: @raw_data[:stats][:infractionCount],
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def shot_stats
|
|
47
|
+
@shot_stats ||= {
|
|
48
|
+
sog: @opts[:shots].map { |period| period[home_team? ? :home : :away] }.reduce(:+),
|
|
49
|
+
p1_sog: @opts[:shots].dig(0, home_team? ? :home : :away),
|
|
50
|
+
p2_sog: @opts[:shots].dig(1, home_team? ? :home : :away),
|
|
51
|
+
p3_sog: @opts[:shots].dig(2, home_team? ? :home : :away),
|
|
52
|
+
ot_sog: @opts[:shots][3..-1]&.map { |ot| ot[home_team? ? :home : :away].to_i },
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def goal_stats
|
|
57
|
+
@goal_stats ||= {
|
|
58
|
+
goals: @opts[:goal_totals].map { |period| period[home_team? ? :home : :away] }.reduce(:+),
|
|
59
|
+
p1_goals: @opts[:goal_totals].dig(0, home_team? ? :home : :away),
|
|
60
|
+
p2_goals: @opts[:goal_totals].dig(1, home_team? ? :home : :away),
|
|
61
|
+
p3_goals: @opts[:goal_totals].dig(2, home_team? ? :home : :away),
|
|
62
|
+
ot_goals: @opts[:goal_totals][3..-1]&.map { |ot| ot[home_team? ? :home : :away].to_i },
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def on_ice_stats
|
|
67
|
+
@on_ice_stats ||= TeamOnIceGoalsService.new(id, @opts[:goals]).call
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def time_splits
|
|
71
|
+
@time_splits ||= TimeSplitsService.new(@opts[:goals], id, @opts[:current_state], @opts[:game_properties]).call
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
def score
|
|
77
|
+
@score ||= @opts[:shootout] && @opts[:winning_team_id] == id ? @raw_data[:stats][:goals] + 1 : @raw_data[:stats][:goals]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def parse_nickname
|
|
81
|
+
@raw_data[:info][:name].gsub(@raw_data[:info][:nickname], "").strip
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
class GoalieGameListItem < 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 goals_against
|
|
22
|
+
@goals_against ||= @raw_data[:row][:goals_against].to_i
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def shots_against
|
|
26
|
+
@shots_against ||= @raw_data[:row][:shots_against].to_i
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def saves
|
|
30
|
+
@saves ||= @raw_data[:row][:saves].to_i
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def goals_against_average
|
|
34
|
+
@goals_against_average ||= @raw_data[:row][:gaa].to_f
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def save_percent
|
|
38
|
+
@save_percent ||= @raw_data[:row][:svpct].to_f
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def minutes
|
|
42
|
+
@minutes ||= @raw_data[:row][:minutes]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def result
|
|
46
|
+
@result ||= set_result
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def shutout?
|
|
50
|
+
@shutout ||= @raw_data[:row][:shutout] == "1"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def set_result
|
|
56
|
+
return "won" if @raw_data[:row][:win] == "1"
|
|
57
|
+
|
|
58
|
+
# return "so_loss" if @raw_data[:row][:so_loss] == "1"
|
|
59
|
+
|
|
60
|
+
return "ot_loss" if @raw_data[:row][:ot_loss] == "1"
|
|
61
|
+
|
|
62
|
+
return "loss" if @raw_data[:row][:loss] == "1"
|
|
63
|
+
|
|
64
|
+
return "played_but_no_result" if @raw_data[:row][:minutes] != "0:00"
|
|
65
|
+
|
|
66
|
+
"did_not_play"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
class Player < Resource
|
|
5
|
+
def initialize(raw_data)
|
|
6
|
+
@raw_data = raw_data
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def id
|
|
10
|
+
@id ||= @raw_data.dig(:info, :playerId).to_i
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def name
|
|
14
|
+
@name ||= "#{first_name} #{last_name}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def first_name
|
|
18
|
+
@first_name ||= @raw_data.dig(:info, :firstName)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def last_name
|
|
22
|
+
@last_name ||= @raw_data.dig(:info, :lastName)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def shoots
|
|
26
|
+
@shoots ||= @raw_data.dig(:info, :shoots)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def catches
|
|
30
|
+
@catches ||= @raw_data.dig(:info, :catches)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def birthplace
|
|
34
|
+
@birthplace ||= @raw_data.dig(:info, :birthPlace)&.strip
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def height
|
|
38
|
+
@height ||= @raw_data.dig(:info, :height_hyphenated)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def birthdate
|
|
42
|
+
@birthdate ||= valid_birthdate? ? @raw_data.dig(:info, :birthDate) : nil
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def draft_year
|
|
46
|
+
@draft_year ||= valid_birthdate? ? BirthdateHelper.new(birthdate).draft_year : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def current_age
|
|
50
|
+
@current_age ||= valid_birthdate? ? BirthdateHelper.new(birthdate).current_age : nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def jersey_number
|
|
54
|
+
@jersey_number ||= @raw_data.dig(:info, :jerseyNumber).to_i
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def position
|
|
58
|
+
@position ||= @raw_data.dig(:info, :position)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def weight
|
|
62
|
+
@weight ||= @raw_data.dig(:info, :weight).to_i
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def valid_birthdate?
|
|
68
|
+
@valid_birthdate ||= !@raw_data.dig(:info, :birthDate).empty? && @raw_data.dig(:info, :birthDate) != "0000-00-00"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
class PlayoffBracket < Resource
|
|
5
|
+
def initialize(bracket_data)
|
|
6
|
+
@bracket_data = bracket_data
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teams
|
|
10
|
+
@teams ||= @bracket_data[:teams].map { |_team_id, team_data| PlayoffBrackets::Team.new(team_data) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rounds
|
|
14
|
+
@rounds ||= @bracket_data[:rounds].map { |round| PlayoffBrackets::Round.new(round) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def logo_url
|
|
18
|
+
@logo_url ||= @bracket_data[:logo]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
module PlayoffBrackets
|
|
5
|
+
class Game < Resource
|
|
6
|
+
def id
|
|
7
|
+
@id ||= @raw_data[:game_id].to_i
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def home_team
|
|
11
|
+
@home_team ||= @raw_data[:home_team].to_i
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def home_score
|
|
15
|
+
@home_score ||= @raw_data[:home_goal_count].to_i
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def away_team
|
|
19
|
+
@away_team ||= @raw_data[:visiting_team].to_i
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def away_score
|
|
23
|
+
@away_score ||= @raw_data[:visiting_goal_count].to_i
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def status
|
|
27
|
+
@status ||= @raw_data[:game_status]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def date
|
|
31
|
+
@date ||= @raw_data[:date_time]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def if_necessary?
|
|
35
|
+
@if_necessary ||= @raw_data[:if_necessary] == "1"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def notes
|
|
39
|
+
@notes ||= @raw_data[:game_notes]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
module PlayoffBrackets
|
|
5
|
+
class Round < Resource
|
|
6
|
+
def id
|
|
7
|
+
@id ||= @raw_data[:round].to_i
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def name
|
|
11
|
+
@name ||= @raw_data[:round_name]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def season_id
|
|
15
|
+
@season_id ||= @raw_data[:season_id].to_i
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def round_type_id
|
|
19
|
+
@round_type_id ||= @raw_data[:round_type_id].to_i
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def round_type_name
|
|
23
|
+
@round_type_name ||= @raw_data[:round_type_name]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def series
|
|
27
|
+
@series ||= @raw_data[:matchups].map { |series| Series.new(series) }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AhlScraper
|
|
4
|
+
module PlayoffBrackets
|
|
5
|
+
class Series < Resource
|
|
6
|
+
def id
|
|
7
|
+
@id ||= @raw_data[:series_letter]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def name
|
|
11
|
+
@name ||= @raw_data[:series_name]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def logo_url
|
|
15
|
+
@logo_url ||= @raw_data[:series_logo]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def round
|
|
19
|
+
@round ||= @raw_data[:round].to_i
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def active?
|
|
23
|
+
@active ||= @raw_data[:active] == "1"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def feeder_series1
|
|
27
|
+
@feeder_series1 ||= @raw_data[:feeder_series1]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def feeder_series2
|
|
31
|
+
@feeder_series2 ||= @raw_data[:feeder_series2]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def team1
|
|
35
|
+
@team1 ||= @raw_data[:team1].to_i
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def team2
|
|
39
|
+
@team2 ||= @raw_data[:team2].to_i
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def team1_wins
|
|
43
|
+
@team1_wins ||= @raw_data[:team1_wins]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def team2_wins
|
|
47
|
+
@team2_wins ||= @raw_data[:team2_wins]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def winning_team
|
|
51
|
+
@winning_team ||= @raw_data[:winner].empty? ? nil : @raw_data[:winner].to_i
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def ties
|
|
55
|
+
@ties ||= @raw_data[:ties]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def home_team_id
|
|
59
|
+
@home_team_id ||= first_game[:home_team].to_i
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def games
|
|
63
|
+
@games ||= @raw_data[:games].map { |game| Game.new(game) }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def first_game
|
|
69
|
+
@first_game ||= @raw_data[:games][0]
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|