ahl_scraper 0.2.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +70 -0
- data/Gemfile +0 -19
- data/Gemfile.lock +46 -41
- data/ahl_scraper.gemspec +15 -1
- data/lib/ahl_scraper/fetchers/game_data_fetcher.rb +1 -1
- data/lib/ahl_scraper/fetchers/player_data_fetcher.rb +1 -1
- data/lib/ahl_scraper/fetchers/player_games/data_fetcher.rb +1 -1
- data/lib/ahl_scraper/fetchers/scoreboards/data_fetcher.rb +37 -0
- data/lib/ahl_scraper/fetchers/season_type_fetcher.rb +1 -2
- data/lib/ahl_scraper/fixed_games/1001050.json +18 -18
- data/lib/ahl_scraper/fixed_games/1003351.json +2728 -0
- data/lib/ahl_scraper/fixed_games/1018774.json +4 -4
- data/lib/ahl_scraper/fixed_games/1020527.json +8 -8
- data/lib/ahl_scraper/helpers/ice_time_helper.rb +3 -1
- data/lib/ahl_scraper/helpers/period_time_helper.rb +6 -2
- data/lib/ahl_scraper/resources/game.rb +7 -5
- data/lib/ahl_scraper/resources/game_list_item.rb +13 -13
- data/lib/ahl_scraper/resources/games/goalie.rb +1 -1
- data/lib/ahl_scraper/resources/games/info.rb +1 -1
- data/lib/ahl_scraper/resources/games/penalty.rb +2 -2
- data/lib/ahl_scraper/resources/games/penalty_shot.rb +0 -5
- data/lib/ahl_scraper/resources/games/team.rb +2 -2
- data/lib/ahl_scraper/resources/goalie_game_list_item.rb +2 -1
- data/lib/ahl_scraper/resources/player.rb +2 -2
- data/lib/ahl_scraper/resources/playoff_bracket.rb +5 -5
- data/lib/ahl_scraper/resources/playoff_brackets/round.rb +1 -1
- data/lib/ahl_scraper/resources/playoff_brackets/series.rb +60 -20
- data/lib/ahl_scraper/resources/roster_player.rb +1 -1
- data/lib/ahl_scraper/resources/scoreboard.rb +147 -0
- data/lib/ahl_scraper/resources/scoreboards/team.rb +67 -0
- data/lib/ahl_scraper/resources/season.rb +13 -8
- data/lib/ahl_scraper/resources/season_list_item.rb +2 -2
- data/lib/ahl_scraper/resources/seasons/team.rb +6 -5
- data/lib/ahl_scraper/resources/skater_game_list_item.rb +2 -2
- data/lib/ahl_scraper/resources/team_game_list_item.rb +2 -3
- data/lib/ahl_scraper/resources/team_list_item.rb +1 -1
- data/lib/ahl_scraper/scoreboards.rb +15 -0
- data/lib/ahl_scraper/services/games/create_skaters_service.rb +1 -1
- data/lib/ahl_scraper/services/games/on_ice_statlines_service.rb +1 -1
- data/lib/ahl_scraper/services/games/penalty_shots_service.rb +1 -6
- data/lib/ahl_scraper/services/games/scoring_statlines_service.rb +29 -25
- data/lib/ahl_scraper/services/games/team_on_ice_goals_service.rb +1 -1
- data/lib/ahl_scraper/team_games.rb +3 -1
- data/lib/ahl_scraper/version.rb +1 -1
- data/lib/ahl_scraper.rb +2 -0
- metadata +178 -5
@@ -1438,7 +1438,7 @@
|
|
1438
1438
|
],
|
1439
1439
|
"penalties": [
|
1440
1440
|
{
|
1441
|
-
"game_penalty_id":
|
1441
|
+
"game_penalty_id": 219032,
|
1442
1442
|
"period": { "id": "1", "shortName": "", "longName": "1st" },
|
1443
1443
|
"time": "11:54",
|
1444
1444
|
"againstTeam": {
|
@@ -1473,7 +1473,7 @@
|
|
1473
1473
|
"isBench": false
|
1474
1474
|
},
|
1475
1475
|
{
|
1476
|
-
"game_penalty_id":
|
1476
|
+
"game_penalty_id": 219034,
|
1477
1477
|
"period": { "id": "1", "shortName": "", "longName": "1st" },
|
1478
1478
|
"time": "16:43",
|
1479
1479
|
"againstTeam": {
|
@@ -2057,7 +2057,7 @@
|
|
2057
2057
|
],
|
2058
2058
|
"penalties": [
|
2059
2059
|
{
|
2060
|
-
"game_penalty_id":
|
2060
|
+
"game_penalty_id": 219045,
|
2061
2061
|
"period": { "id": "2", "shortName": "", "longName": "2nd" },
|
2062
2062
|
"time": "17:58",
|
2063
2063
|
"againstTeam": {
|
@@ -2381,7 +2381,7 @@
|
|
2381
2381
|
],
|
2382
2382
|
"penalties": [
|
2383
2383
|
{
|
2384
|
-
"game_penalty_id":
|
2384
|
+
"game_penalty_id": 219082,
|
2385
2385
|
"period": { "id": "3", "shortName": "", "longName": "3rd" },
|
2386
2386
|
"time": "4:19",
|
2387
2387
|
"againstTeam": {
|
@@ -1768,7 +1768,7 @@
|
|
1768
1768
|
],
|
1769
1769
|
"penalties": [
|
1770
1770
|
{
|
1771
|
-
"game_penalty_id":
|
1771
|
+
"game_penalty_id": 237213,
|
1772
1772
|
"period": { "id": "2", "shortName": "", "longName": "2nd" },
|
1773
1773
|
"time": "2:08",
|
1774
1774
|
"againstTeam": {
|
@@ -1803,7 +1803,7 @@
|
|
1803
1803
|
"isBench": false
|
1804
1804
|
},
|
1805
1805
|
{
|
1806
|
-
"game_penalty_id":
|
1806
|
+
"game_penalty_id": 237215,
|
1807
1807
|
"period": { "id": "2", "shortName": "", "longName": "2nd" },
|
1808
1808
|
"time": "4:52",
|
1809
1809
|
"againstTeam": {
|
@@ -1831,7 +1831,7 @@
|
|
1831
1831
|
"isBench": true
|
1832
1832
|
},
|
1833
1833
|
{
|
1834
|
-
"game_penalty_id":
|
1834
|
+
"game_penalty_id": 237217,
|
1835
1835
|
"period": { "id": "2", "shortName": "", "longName": "2nd" },
|
1836
1836
|
"time": "6:26",
|
1837
1837
|
"againstTeam": {
|
@@ -1866,7 +1866,7 @@
|
|
1866
1866
|
"isBench": false
|
1867
1867
|
},
|
1868
1868
|
{
|
1869
|
-
"game_penalty_id":
|
1869
|
+
"game_penalty_id": 237227,
|
1870
1870
|
"period": { "id": "2", "shortName": "", "longName": "2nd" },
|
1871
1871
|
"time": "18:48",
|
1872
1872
|
"againstTeam": {
|
@@ -2300,7 +2300,7 @@
|
|
2300
2300
|
],
|
2301
2301
|
"penalties": [
|
2302
2302
|
{
|
2303
|
-
"game_penalty_id":
|
2303
|
+
"game_penalty_id": 237233,
|
2304
2304
|
"period": { "id": "3", "shortName": "", "longName": "3rd" },
|
2305
2305
|
"time": "4:35",
|
2306
2306
|
"againstTeam": {
|
@@ -2335,7 +2335,7 @@
|
|
2335
2335
|
"isBench": false
|
2336
2336
|
},
|
2337
2337
|
{
|
2338
|
-
"game_penalty_id":
|
2338
|
+
"game_penalty_id": 237245,
|
2339
2339
|
"period": { "id": "3", "shortName": "", "longName": "3rd" },
|
2340
2340
|
"time": "13:27",
|
2341
2341
|
"againstTeam": {
|
@@ -2370,7 +2370,7 @@
|
|
2370
2370
|
"isBench": false
|
2371
2371
|
},
|
2372
2372
|
{
|
2373
|
-
"game_penalty_id":
|
2373
|
+
"game_penalty_id": 237262,
|
2374
2374
|
"period": { "id": "3", "shortName": "", "longName": "3rd" },
|
2375
2375
|
"time": "16:49",
|
2376
2376
|
"againstTeam": {
|
@@ -2405,7 +2405,7 @@
|
|
2405
2405
|
"isBench": false
|
2406
2406
|
},
|
2407
2407
|
{
|
2408
|
-
"game_penalty_id":
|
2408
|
+
"game_penalty_id": 237268,
|
2409
2409
|
"period": { "id": "3", "shortName": "", "longName": "3rd" },
|
2410
2410
|
"time": "16:49",
|
2411
2411
|
"againstTeam": {
|
@@ -10,12 +10,16 @@ module AhlScraper
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def to_period_seconds
|
13
|
-
|
13
|
+
return unless time
|
14
|
+
|
15
|
+
period_time = time&.split(":")
|
14
16
|
period_time[0].to_i * 60 + period_time[1].to_i
|
15
17
|
end
|
16
18
|
|
17
19
|
def to_time_elapsed
|
18
|
-
|
20
|
+
return unless time
|
21
|
+
|
22
|
+
period_time = time&.split(":")
|
19
23
|
period_time[0].to_i * 60 + period_time[1].to_i + ((period - 1) * 1200)
|
20
24
|
end
|
21
25
|
|
@@ -47,8 +47,9 @@ module AhlScraper
|
|
47
47
|
attr_reader(*ATTRIBUTES)
|
48
48
|
|
49
49
|
def initialize(game_id, opts = {})
|
50
|
+
raw_data = GameDataFetcher.new(game_id).call
|
51
|
+
super(raw_data, opts)
|
50
52
|
@game_id = game_id
|
51
|
-
@raw_data = GameDataFetcher.new(game_id).call
|
52
53
|
@raw_event_data = GameEventDataFetcher.new(game_id).call
|
53
54
|
@season_type = opts[:season_type] || SeasonTypeFetcher.new(@raw_data[:details][:seasonId]).call
|
54
55
|
end
|
@@ -224,7 +225,7 @@ module AhlScraper
|
|
224
225
|
end
|
225
226
|
|
226
227
|
def overtimes
|
227
|
-
@overtimes ||= Array(@raw_data[:periods][3
|
228
|
+
@overtimes ||= Array(@raw_data[:periods][3..]).map { |o| Games::Overtime.new(o, { regular_season: season_type == :regular }) }
|
228
229
|
end
|
229
230
|
|
230
231
|
def overtime?
|
@@ -343,17 +344,18 @@ module AhlScraper
|
|
343
344
|
irregular_game_status = IRREGULAR_GAMES.dig(game_id.to_s, :status)
|
344
345
|
return irregular_game_status if irregular_game_status
|
345
346
|
|
347
|
+
return "postponed" if @raw_data.dig(:details, :status) == "Postponed"
|
346
348
|
# return "forfeited" if game is a forfeit, need to figure this out if it happens
|
347
349
|
|
348
|
-
return "finished" if @raw_data
|
350
|
+
return "finished" if @raw_data.dig(:details, :final) == "1"
|
349
351
|
|
350
|
-
return "in_progress" if @raw_data
|
352
|
+
return "in_progress" if @raw_data.dig(:details, :started) == "1"
|
351
353
|
|
352
354
|
"not_started"
|
353
355
|
end
|
354
356
|
|
355
357
|
def set_current_game_time
|
356
|
-
return if
|
358
|
+
return if @raw_data[:details][:final] == "1" || @raw_data[:details][:started] == "0"
|
357
359
|
|
358
360
|
game_time = @raw_data[:details][:status].match(/\d{1,2}:\d{2}/).to_s
|
359
361
|
return if game_time.empty?
|
@@ -2,52 +2,52 @@
|
|
2
2
|
|
3
3
|
module AhlScraper
|
4
4
|
class GameListItem < Resource
|
5
|
-
def initialize(raw_data)
|
6
|
-
|
5
|
+
def initialize(raw_data, opts = {})
|
6
|
+
super(raw_data, opts)
|
7
7
|
end
|
8
8
|
|
9
9
|
def id
|
10
|
-
@id ||= @raw_data
|
10
|
+
@id ||= @raw_data&.dig(:row, :game_id).to_i
|
11
11
|
end
|
12
12
|
|
13
13
|
def home_team_city
|
14
|
-
@home_team_city ||= @raw_data
|
14
|
+
@home_team_city ||= @raw_data&.dig(:row, :home_team_city)
|
15
15
|
end
|
16
16
|
|
17
17
|
def home_team_score
|
18
|
-
@home_team_score ||= @raw_data
|
18
|
+
@home_team_score ||= @raw_data&.dig(:row, :home_goal_count).to_i
|
19
19
|
end
|
20
20
|
|
21
21
|
def home_team_id
|
22
|
-
@home_team_id ||= @raw_data
|
22
|
+
@home_team_id ||= @raw_data&.dig(:prop, :home_team_city, :teamLink).to_i
|
23
23
|
end
|
24
24
|
|
25
25
|
def away_team_city
|
26
|
-
@away_team_city ||= @raw_data
|
26
|
+
@away_team_city ||= @raw_data&.dig(:row, :visiting_team_city)
|
27
27
|
end
|
28
28
|
|
29
29
|
def away_team_score
|
30
|
-
@away_team_score ||= @raw_data
|
30
|
+
@away_team_score ||= @raw_data&.dig(:row, :visiting_goal_count).to_i
|
31
31
|
end
|
32
32
|
|
33
33
|
def away_team_id
|
34
|
-
@away_team_id ||= @raw_data
|
34
|
+
@away_team_id ||= @raw_data&.dig(:prop, :visiting_team_city, :teamLink).to_i
|
35
35
|
end
|
36
36
|
|
37
37
|
def date
|
38
|
-
@date ||= @raw_data
|
38
|
+
@date ||= @raw_data&.dig(:row, :date_with_day)
|
39
39
|
end
|
40
40
|
|
41
41
|
def status
|
42
|
-
@status ||= @raw_data
|
42
|
+
@status ||= @raw_data&.dig(:row, :game_status)&.match(/am|pm/) ? "Not Started" : @raw_data&.dig(:row, :game_status)
|
43
43
|
end
|
44
44
|
|
45
45
|
def game_report_url
|
46
|
-
@game_report_url ||= @raw_data
|
46
|
+
@game_report_url ||= @raw_data&.dig(:prop, :game_report, :link)
|
47
47
|
end
|
48
48
|
|
49
49
|
def game_sheet_url
|
50
|
-
@game_sheet_url ||= @raw_data
|
50
|
+
@game_sheet_url ||= @raw_data&.dig(:prop, :game_sheet, :link)
|
51
51
|
end
|
52
52
|
|
53
53
|
def game_center_url
|
@@ -44,7 +44,7 @@ module AhlScraper
|
|
44
44
|
goals: @raw_data[:stats][:goals],
|
45
45
|
assists: @raw_data[:stats][:assists],
|
46
46
|
points: @raw_data[:stats][:points],
|
47
|
-
penalty_minutes: @raw_data[:stats][:
|
47
|
+
penalty_minutes: @raw_data[:stats][:penaltyMinutes],
|
48
48
|
toi: @raw_data[:stats][:timeOnIce],
|
49
49
|
toi_in_seconds: set_time_on_ice_in_seconds,
|
50
50
|
shots_against: @raw_data[:stats][:shotsAgainst],
|
@@ -4,7 +4,7 @@ module AhlScraper
|
|
4
4
|
module Games
|
5
5
|
class Penalty < Resource
|
6
6
|
def id
|
7
|
-
@id ||= @raw_data
|
7
|
+
@id ||= @raw_data[:game_penalty_id]&.to_i
|
8
8
|
end
|
9
9
|
|
10
10
|
def number
|
@@ -78,7 +78,7 @@ module AhlScraper
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def bench?
|
81
|
-
@raw_data[:
|
81
|
+
@raw_data[:isBench]
|
82
82
|
end
|
83
83
|
|
84
84
|
def invalid?
|
@@ -49,7 +49,7 @@ module AhlScraper
|
|
49
49
|
p1_sog: @opts[:shots].dig(0, home_team? ? :home : :away),
|
50
50
|
p2_sog: @opts[:shots].dig(1, home_team? ? :home : :away),
|
51
51
|
p3_sog: @opts[:shots].dig(2, home_team? ? :home : :away),
|
52
|
-
ot_sog: @opts[:shots][3
|
52
|
+
ot_sog: @opts[:shots][3..]&.map { |ot| ot[home_team? ? :home : :away].to_i },
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
@@ -59,7 +59,7 @@ module AhlScraper
|
|
59
59
|
p1_goals: @opts[:goal_totals].dig(0, home_team? ? :home : :away),
|
60
60
|
p2_goals: @opts[:goal_totals].dig(1, home_team? ? :home : :away),
|
61
61
|
p3_goals: @opts[:goal_totals].dig(2, home_team? ? :home : :away),
|
62
|
-
ot_goals: @opts[:goal_totals][3
|
62
|
+
ot_goals: @opts[:goal_totals][3..]&.map { |ot| ot[home_team? ? :home : :away].to_i },
|
63
63
|
}
|
64
64
|
end
|
65
65
|
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
module AhlScraper
|
4
4
|
class PlayoffBracket < Resource
|
5
|
-
def initialize(
|
6
|
-
|
5
|
+
def initialize(raw_data, opts = {})
|
6
|
+
super(raw_data, opts)
|
7
7
|
end
|
8
8
|
|
9
9
|
def teams
|
10
|
-
@teams ||= @
|
10
|
+
@teams ||= @raw_data[:teams].map { |_team_id, team_data| PlayoffBrackets::Team.new(team_data) }
|
11
11
|
end
|
12
12
|
|
13
13
|
def rounds
|
14
|
-
@rounds ||= @
|
14
|
+
@rounds ||= @raw_data[:rounds].map { |round| PlayoffBrackets::Round.new(round, { raw_data: @raw_data }) }
|
15
15
|
end
|
16
16
|
|
17
17
|
def logo_url
|
18
|
-
@logo_url ||= @
|
18
|
+
@logo_url ||= @raw_data[:logo]
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -3,6 +3,18 @@
|
|
3
3
|
module AhlScraper
|
4
4
|
module PlayoffBrackets
|
5
5
|
class Series < Resource
|
6
|
+
OVERRIDE_WINS_NEEDED = {
|
7
|
+
"36" => { "1" => 4 },
|
8
|
+
"39" => { "1" => 4 },
|
9
|
+
"33" => { "1" => 4 },
|
10
|
+
"29" => { "1" => 4 },
|
11
|
+
"15" => { "1" => 4 },
|
12
|
+
"10" => { "1" => 4 },
|
13
|
+
"7" => { "1" => 4 },
|
14
|
+
"69" => { "1" => 4 },
|
15
|
+
"72" => { "1" => 1, "2" => 1, "3" => 2, "4" => 2 },
|
16
|
+
}.freeze
|
17
|
+
|
6
18
|
def id
|
7
19
|
@id ||= @raw_data[:series_letter]
|
8
20
|
end
|
@@ -20,54 +32,82 @@ module AhlScraper
|
|
20
32
|
end
|
21
33
|
|
22
34
|
def active?
|
23
|
-
@active ||= @raw_data[:active] == "1"
|
35
|
+
@active ||= @raw_data[:active] == "1" && team1_wins < wins_needed && team2_wins < wins_needed
|
24
36
|
end
|
25
37
|
|
26
|
-
def
|
27
|
-
@
|
38
|
+
def home_feeder_series
|
39
|
+
@home_feeder_series ||= home_team_id == team1 ? @raw_data[:feeder_series1] : @raw_data[:feeder_series2]
|
28
40
|
end
|
29
41
|
|
30
|
-
def
|
31
|
-
@
|
42
|
+
def away_feeder_series
|
43
|
+
@away_feeder_series ||= home_team_id == team1 ? @raw_data[:feeder_series2] : @raw_data[:feeder_series1]
|
32
44
|
end
|
33
45
|
|
34
|
-
def
|
35
|
-
@
|
46
|
+
def winning_team_id
|
47
|
+
@winning_team_id ||= @raw_data[:winner].empty? ? find_winner : @raw_data[:winner].to_i
|
36
48
|
end
|
37
49
|
|
38
|
-
def
|
39
|
-
@
|
50
|
+
def home_team_id
|
51
|
+
@home_team_id ||= first_game[:home_team].to_i
|
40
52
|
end
|
41
53
|
|
42
|
-
def
|
43
|
-
@
|
54
|
+
def away_team_id
|
55
|
+
@away_team_id ||= first_game[:visiting_team].to_i
|
44
56
|
end
|
45
57
|
|
46
|
-
def
|
47
|
-
@
|
58
|
+
def home_team_wins
|
59
|
+
@home_team_wins ||= home_team_id == team1 ? team1_wins : team2_wins
|
48
60
|
end
|
49
61
|
|
50
|
-
def
|
51
|
-
@
|
62
|
+
def away_team_wins
|
63
|
+
@away_team_wins ||= home_team_id == team1 ? team2_wins : team1_wins
|
52
64
|
end
|
53
65
|
|
54
66
|
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
|
67
|
+
@ties ||= @raw_data[:ties].to_i
|
60
68
|
end
|
61
69
|
|
62
70
|
def games
|
63
71
|
@games ||= @raw_data[:games].map { |game| Game.new(game) }
|
64
72
|
end
|
65
73
|
|
74
|
+
def wins_needed
|
75
|
+
@wins_needed ||= OVERRIDE_WINS_NEEDED.dig(season_id, round.to_s) || (round == 1 ? 3 : 4)
|
76
|
+
end
|
77
|
+
|
66
78
|
private
|
67
79
|
|
68
80
|
def first_game
|
69
81
|
@first_game ||= @raw_data[:games][0]
|
70
82
|
end
|
83
|
+
|
84
|
+
def find_winner
|
85
|
+
return team1 if team1_wins == wins_needed
|
86
|
+
|
87
|
+
return team2 if team2_wins == wins_needed
|
88
|
+
|
89
|
+
nil
|
90
|
+
end
|
91
|
+
|
92
|
+
def season_id
|
93
|
+
@opts[:bracket_data]&.dig(:rounds, round - 1, :season_id)
|
94
|
+
end
|
95
|
+
|
96
|
+
def team1
|
97
|
+
@team1 ||= @raw_data[:team1].to_i
|
98
|
+
end
|
99
|
+
|
100
|
+
def team2
|
101
|
+
@team2 ||= @raw_data[:team2].to_i
|
102
|
+
end
|
103
|
+
|
104
|
+
def team1_wins
|
105
|
+
@team1_wins ||= @raw_data[:team1_wins]
|
106
|
+
end
|
107
|
+
|
108
|
+
def team2_wins
|
109
|
+
@team2_wins ||= @raw_data[:team2_wins]
|
110
|
+
end
|
71
111
|
end
|
72
112
|
end
|
73
113
|
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AhlScraper
|
4
|
+
class Scoreboard < Resource
|
5
|
+
def initialize(raw_data)
|
6
|
+
super(raw_data, {})
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= @raw_data[:ID].to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def season_id
|
14
|
+
@season_id ||= @raw_data[:SeasonID].to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def game_number
|
18
|
+
@game_number ||= @raw_data[:game_number].to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def game_date
|
22
|
+
@game_date ||= @raw_data[:Date]
|
23
|
+
end
|
24
|
+
|
25
|
+
def htv_game_id
|
26
|
+
@htv_game_id ||= @raw_data[:HtvGameID].to_i
|
27
|
+
end
|
28
|
+
|
29
|
+
def game_date_words
|
30
|
+
@game_date_words ||= @raw_data[:GameDate]
|
31
|
+
end
|
32
|
+
|
33
|
+
def game_date_ISO8601
|
34
|
+
@game_date_ISO8601 ||= @raw_data[:GameDateISO8601]
|
35
|
+
end
|
36
|
+
|
37
|
+
def scheduled_time
|
38
|
+
@scheduled_time ||= @raw_data[:ScheduledTime]
|
39
|
+
end
|
40
|
+
|
41
|
+
def scheduled_time_formatted
|
42
|
+
@scheduled_time_formatted ||= @raw_data[:ScheduledFormattedTime]
|
43
|
+
end
|
44
|
+
|
45
|
+
def timezone
|
46
|
+
@timezone ||= @raw_data[:Timezone]
|
47
|
+
end
|
48
|
+
|
49
|
+
def ticket_url
|
50
|
+
@ticket_url ||= @raw_data[:TicketUrl]
|
51
|
+
end
|
52
|
+
|
53
|
+
def period
|
54
|
+
@period ||= @raw_data[:Period].to_i
|
55
|
+
end
|
56
|
+
|
57
|
+
def period_long_name
|
58
|
+
@period_long_name ||= @raw_data[:PeriodNameLong]
|
59
|
+
end
|
60
|
+
|
61
|
+
def game_clock
|
62
|
+
@game_clock ||= @raw_data[:GameClock]
|
63
|
+
end
|
64
|
+
|
65
|
+
def intermission?
|
66
|
+
@intermission ||= @raw_data[:Intermission] == "1"
|
67
|
+
end
|
68
|
+
|
69
|
+
def game_status
|
70
|
+
@game_status ||= @raw_data[:GameStatusString]
|
71
|
+
end
|
72
|
+
|
73
|
+
def game_status_string_long
|
74
|
+
@game_status_string_long ||= @raw_data[:GameStatusStringLong]
|
75
|
+
end
|
76
|
+
|
77
|
+
def venue_name
|
78
|
+
@venue_name ||= @raw_data[:venue_name]
|
79
|
+
end
|
80
|
+
|
81
|
+
def venue_location
|
82
|
+
@venue_location ||= @raw_data[:venue_location]
|
83
|
+
end
|
84
|
+
|
85
|
+
def timezone_short
|
86
|
+
@timezone_short ||= @raw_data[:TimezoneShort]
|
87
|
+
end
|
88
|
+
|
89
|
+
def home_score
|
90
|
+
@home_score ||= @raw_data[:HomeGoals].to_i
|
91
|
+
end
|
92
|
+
|
93
|
+
def home_team
|
94
|
+
@home_team ||= Scoreboards::Team.new(home_team_data)
|
95
|
+
end
|
96
|
+
|
97
|
+
def away_score
|
98
|
+
@away_score ||= @raw_data[:VisitorGoals].to_i
|
99
|
+
end
|
100
|
+
|
101
|
+
def away_team
|
102
|
+
@away_team ||= Scoreboards::Team.new(away_team_data)
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
def away_team_data
|
108
|
+
{
|
109
|
+
id: @raw_data[:VisitorID],
|
110
|
+
abbreviation: @raw_data[:VisitorCode],
|
111
|
+
city: @raw_data[:VisitorCity],
|
112
|
+
name: @raw_data[:VisitorNickname],
|
113
|
+
full_name: @raw_data[:VisitorLongName],
|
114
|
+
division: @raw_data[:VisitingDivision],
|
115
|
+
score: @raw_data[:VisitorGoals],
|
116
|
+
audio_url: @raw_data[:VisitorAudioUrl],
|
117
|
+
video_url: @raw_data[:VisitorVideoUrl],
|
118
|
+
webcasts_url: @raw_data[:VisitorWebcastUrl],
|
119
|
+
wins: @raw_data[:VisitorWins],
|
120
|
+
regulation_losses: @raw_data[:VisitorRegulationLosses],
|
121
|
+
ot_losses: @raw_data[:VisitorOTLosses],
|
122
|
+
shootout_losses: @raw_data[:VisitorShootoutLosses],
|
123
|
+
logo: @raw_data[:VisitorLogo],
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
def home_team_data
|
128
|
+
{
|
129
|
+
id: @raw_data[:HomeID],
|
130
|
+
abbreviation: @raw_data[:HomeCode],
|
131
|
+
city: @raw_data[:HomeCity],
|
132
|
+
name: @raw_data[:HomeNickname],
|
133
|
+
full_name: @raw_data[:HomeLongName],
|
134
|
+
division: @raw_data[:HomeDivision],
|
135
|
+
score: @raw_data[:HomeGoals],
|
136
|
+
audio_url: @raw_data[:HomeAudioUrl],
|
137
|
+
video_url: @raw_data[:HomeVideoUrl],
|
138
|
+
webcasts_url: @raw_data[:HomeWebcastUrl],
|
139
|
+
wins: @raw_data[:HomeWins],
|
140
|
+
regulation_losses: @raw_data[:HomeRegulationLosses],
|
141
|
+
ot_losses: @raw_data[:HomeOTLosses],
|
142
|
+
shootout_losses: @raw_data[:HomeShootoutLosses],
|
143
|
+
logo: @raw_data[:HomeLogo],
|
144
|
+
}
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|