ahl_scraper 0.3.1 → 0.3.4
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 +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +29 -27
- 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 +3 -3
- data/lib/ahl_scraper/resources/games/goalie.rb +1 -1
- data/lib/ahl_scraper/resources/games/penalty_shot.rb +0 -5
- data/lib/ahl_scraper/resources/playoff_bracket.rb +1 -1
- data/lib/ahl_scraper/resources/playoff_brackets/round.rb +5 -0
- data/lib/ahl_scraper/resources/playoff_brackets/series.rb +16 -9
- data/lib/ahl_scraper/resources/seasons/team.rb +2 -2
- data/lib/ahl_scraper/services/games/penalty_shots_service.rb +1 -6
- data/lib/ahl_scraper/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b20a1f72dc69a61ddd7568c5ef2eeca67f133bbcdd22f0e94d941ada6ee1e479
|
4
|
+
data.tar.gz: f3d310aee075a7cd08f3a8d329c359e974816287c4f768e231c4e50643dabc35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b5912e8c6819fd3f45ff7a6f9919fe307ebdf7d554c27d2cebe6bd59452bb5a7f708f86b02bcee4fe1d2be33305264ef39a794d7d7ae5a8f8152b7a6bc4147
|
7
|
+
data.tar.gz: e99c4087b80330d517b2f73027e82a31b32941b1b5d36741c4be0f969fa2ce7bf9d1dbc7bf0beb12d0507a0f7bd3b01138d4df99c8b2186d06b2732d58ee5499
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.3.4
|
4
|
+
|
5
|
+
## PlayoffBrackets::Series
|
6
|
+
|
7
|
+
- Add new series wins required for current playoffs (2022 with id `76`)
|
8
|
+
|
9
|
+
## 0.3.3
|
10
|
+
|
11
|
+
## Developer
|
12
|
+
|
13
|
+
- Added `.tool-versions` file for `asdf` package manager use
|
14
|
+
|
15
|
+
## PlayoffBrackets::Round
|
16
|
+
|
17
|
+
- Add `active?` attribute which checks if any series is active, if so it returns truthy, else falsey
|
18
|
+
|
19
|
+
## PlayoffBrackets::Series
|
20
|
+
|
21
|
+
- Add check for existance of team ids for `active?` attribute to be truthy
|
22
|
+
|
23
|
+
## 0.3.2
|
24
|
+
|
25
|
+
## General
|
26
|
+
|
27
|
+
- Changed `.split` to `&.split` and use `.dig` more to not fail when fields don't exist (often on games that have not finished)
|
28
|
+
|
29
|
+
### Game::Goalie
|
30
|
+
|
31
|
+
- Fix penalty minutes not being copied to the object because of a typo
|
32
|
+
|
3
33
|
## 0.3.1
|
4
34
|
|
5
35
|
### Scoreboards
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ahl_scraper (0.3.
|
4
|
+
ahl_scraper (0.3.3)
|
5
5
|
json (~> 2.5.1)
|
6
6
|
nokogiri (~> 1.12.4)
|
7
7
|
rake (~> 13.0.0)
|
@@ -13,25 +13,25 @@ GEM
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
ast (2.4.2)
|
15
15
|
backport (1.2.0)
|
16
|
-
benchmark (0.
|
16
|
+
benchmark (0.2.0)
|
17
17
|
byebug (11.1.3)
|
18
18
|
coderay (1.1.3)
|
19
19
|
crack (0.4.5)
|
20
20
|
rexml
|
21
|
-
diff-lcs (1.
|
21
|
+
diff-lcs (1.5.0)
|
22
22
|
e2mmap (0.1.0)
|
23
23
|
hashdiff (1.0.1)
|
24
24
|
jaro_winkler (1.5.4)
|
25
25
|
json (2.5.1)
|
26
|
-
kramdown (2.
|
26
|
+
kramdown (2.4.0)
|
27
27
|
rexml
|
28
28
|
kramdown-parser-gfm (1.1.0)
|
29
29
|
kramdown (~> 2.0)
|
30
30
|
method_source (1.0.0)
|
31
|
-
nokogiri (1.12.5-
|
31
|
+
nokogiri (1.12.5-arm64-darwin)
|
32
32
|
racc (~> 1.4)
|
33
|
-
parallel (1.
|
34
|
-
parser (3.
|
33
|
+
parallel (1.22.1)
|
34
|
+
parser (3.1.2.0)
|
35
35
|
ast (~> 2.4.1)
|
36
36
|
pry (0.13.1)
|
37
37
|
coderay (~> 1.1)
|
@@ -39,27 +39,27 @@ GEM
|
|
39
39
|
pry-byebug (3.9.0)
|
40
40
|
byebug (~> 11.0)
|
41
41
|
pry (~> 0.13.0)
|
42
|
-
public_suffix (4.0.
|
43
|
-
racc (1.
|
44
|
-
rainbow (3.
|
42
|
+
public_suffix (4.0.7)
|
43
|
+
racc (1.6.0)
|
44
|
+
rainbow (3.1.1)
|
45
45
|
rake (13.0.6)
|
46
|
-
regexp_parser (2.
|
47
|
-
reverse_markdown (2.
|
46
|
+
regexp_parser (2.3.1)
|
47
|
+
reverse_markdown (2.1.1)
|
48
48
|
nokogiri
|
49
49
|
rexml (3.2.5)
|
50
|
-
rspec (3.
|
51
|
-
rspec-core (~> 3.
|
52
|
-
rspec-expectations (~> 3.
|
53
|
-
rspec-mocks (~> 3.
|
54
|
-
rspec-core (3.
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-expectations (3.
|
50
|
+
rspec (3.11.0)
|
51
|
+
rspec-core (~> 3.11.0)
|
52
|
+
rspec-expectations (~> 3.11.0)
|
53
|
+
rspec-mocks (~> 3.11.0)
|
54
|
+
rspec-core (3.11.0)
|
55
|
+
rspec-support (~> 3.11.0)
|
56
|
+
rspec-expectations (3.11.0)
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
-
rspec-support (~> 3.
|
59
|
-
rspec-mocks (3.
|
58
|
+
rspec-support (~> 3.11.0)
|
59
|
+
rspec-mocks (3.11.1)
|
60
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-support (3.
|
61
|
+
rspec-support (~> 3.11.0)
|
62
|
+
rspec-support (3.11.0)
|
63
63
|
rubocop (0.89.1)
|
64
64
|
parallel (~> 1.10)
|
65
65
|
parser (>= 2.7.1.1)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
thor (~> 1.0)
|
91
91
|
tilt (~> 2.0)
|
92
92
|
yard (~> 0.9, >= 0.9.24)
|
93
|
-
thor (1.1
|
93
|
+
thor (1.2.1)
|
94
94
|
tilt (2.0.10)
|
95
95
|
unicode-display_width (1.8.0)
|
96
96
|
vcr (6.0.0)
|
@@ -98,10 +98,12 @@ GEM
|
|
98
98
|
addressable (>= 2.8.0)
|
99
99
|
crack (>= 0.3.2)
|
100
100
|
hashdiff (>= 0.4.0, < 2.0.0)
|
101
|
-
|
101
|
+
webrick (1.7.0)
|
102
|
+
yard (0.9.27)
|
103
|
+
webrick (~> 1.7.0)
|
102
104
|
|
103
105
|
PLATFORMS
|
104
|
-
|
106
|
+
arm64-darwin-21
|
105
107
|
|
106
108
|
DEPENDENCIES
|
107
109
|
ahl_scraper!
|
@@ -116,4 +118,4 @@ DEPENDENCIES
|
|
116
118
|
webmock (>= 3.8.0)
|
117
119
|
|
118
120
|
BUNDLED WITH
|
119
|
-
2.
|
121
|
+
2.3.12
|
@@ -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
|
|
@@ -344,12 +344,12 @@ module AhlScraper
|
|
344
344
|
irregular_game_status = IRREGULAR_GAMES.dig(game_id.to_s, :status)
|
345
345
|
return irregular_game_status if irregular_game_status
|
346
346
|
|
347
|
-
return "postponed" if @raw_data
|
347
|
+
return "postponed" if @raw_data.dig(:details, :status) == "Postponed"
|
348
348
|
# return "forfeited" if game is a forfeit, need to figure this out if it happens
|
349
349
|
|
350
|
-
return "finished" if @raw_data
|
350
|
+
return "finished" if @raw_data.dig(:details, :final) == "1"
|
351
351
|
|
352
|
-
return "in_progress" if @raw_data
|
352
|
+
return "in_progress" if @raw_data.dig(:details, :started) == "1"
|
353
353
|
|
354
354
|
"not_started"
|
355
355
|
end
|
@@ -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],
|
@@ -11,7 +11,7 @@ module AhlScraper
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def rounds
|
14
|
-
@rounds ||= @raw_data[:rounds].map { |round| PlayoffBrackets::Round.new(round, {
|
14
|
+
@rounds ||= @raw_data[:rounds].map { |round| PlayoffBrackets::Round.new(round, { bracket_data: @raw_data }) }
|
15
15
|
end
|
16
16
|
|
17
17
|
def logo_url
|
@@ -23,6 +23,11 @@ module AhlScraper
|
|
23
23
|
@round_type_name ||= @raw_data[:round_type_name]
|
24
24
|
end
|
25
25
|
|
26
|
+
def active?
|
27
|
+
@active = series.filter(&:active?).any? if @active.nil?
|
28
|
+
@active
|
29
|
+
end
|
30
|
+
|
26
31
|
def series
|
27
32
|
@series ||= @raw_data[:matchups].map { |series| Series.new(series, { bracket_data: @opts[:bracket_data] }) }
|
28
33
|
end
|
@@ -13,6 +13,7 @@ module AhlScraper
|
|
13
13
|
"7" => { "1" => 4 },
|
14
14
|
"69" => { "1" => 4 },
|
15
15
|
"72" => { "1" => 1, "2" => 1, "3" => 2, "4" => 2 },
|
16
|
+
"76" => { "1" => 3, "2" => 3, "3" => 4, "4" => 4, "5" => 4 },
|
16
17
|
}.freeze
|
17
18
|
|
18
19
|
def id
|
@@ -32,7 +33,7 @@ module AhlScraper
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def active?
|
35
|
-
@active ||= @raw_data[:active] == "1" && team1_wins < wins_needed && team2_wins < wins_needed
|
36
|
+
@active ||= @raw_data[:active] == "1" && team_ids_present? && team1_wins < wins_needed && team2_wins < wins_needed
|
36
37
|
end
|
37
38
|
|
38
39
|
def home_feeder_series
|
@@ -48,11 +49,13 @@ module AhlScraper
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def home_team_id
|
51
|
-
@home_team_id
|
52
|
+
@home_team_id = first_game&.dig(:home_team)&.to_i if @home_team_id.nil?
|
53
|
+
@home_team_id
|
52
54
|
end
|
53
55
|
|
54
56
|
def away_team_id
|
55
|
-
@away_team_id
|
57
|
+
@away_team_id = first_game&.dig(:visiting_team)&.to_i if @away_team_id.nil?
|
58
|
+
@away_team_id
|
56
59
|
end
|
57
60
|
|
58
61
|
def home_team_wins
|
@@ -78,7 +81,7 @@ module AhlScraper
|
|
78
81
|
private
|
79
82
|
|
80
83
|
def first_game
|
81
|
-
@first_game ||= @raw_data
|
84
|
+
@first_game ||= @raw_data.dig(:games, 0)
|
82
85
|
end
|
83
86
|
|
84
87
|
def find_winner
|
@@ -90,23 +93,27 @@ module AhlScraper
|
|
90
93
|
end
|
91
94
|
|
92
95
|
def season_id
|
93
|
-
@opts
|
96
|
+
@opts.dig(:bracket_data, :rounds, round - 1, :season_id)
|
94
97
|
end
|
95
98
|
|
96
99
|
def team1
|
97
|
-
@team1 ||= @raw_data[:team1].to_i
|
100
|
+
@team1 ||= @raw_data[:team1].to_i.zero? ? nil : @raw_data[:team1].to_i
|
98
101
|
end
|
99
102
|
|
100
103
|
def team2
|
101
|
-
@team2 ||= @raw_data[:team2].to_i
|
104
|
+
@team2 ||= @raw_data[:team2].to_i.zero? ? nil : @raw_data[:team2].to_i
|
105
|
+
end
|
106
|
+
|
107
|
+
def team_ids_present?
|
108
|
+
team1 && team2
|
102
109
|
end
|
103
110
|
|
104
111
|
def team1_wins
|
105
|
-
@team1_wins ||= @raw_data[:team1_wins]
|
112
|
+
@team1_wins ||= @raw_data[:team1_wins].to_i
|
106
113
|
end
|
107
114
|
|
108
115
|
def team2_wins
|
109
|
-
@team2_wins ||= @raw_data[:team2_wins]
|
116
|
+
@team2_wins ||= @raw_data[:team2_wins].to_i
|
110
117
|
end
|
111
118
|
end
|
112
119
|
end
|
@@ -51,11 +51,11 @@ module AhlScraper
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def city
|
54
|
-
@city ||= full_name
|
54
|
+
@city ||= full_name&.split.length > 2 ? exception_split_object&.dig(:city) : full_name&.split[0]
|
55
55
|
end
|
56
56
|
|
57
57
|
def name
|
58
|
-
@name ||= full_name
|
58
|
+
@name ||= full_name&.split.length > 2 ? exception_split_object&.dig(:name) : full_name&.split[1]
|
59
59
|
end
|
60
60
|
|
61
61
|
def game_file_city
|
@@ -17,14 +17,9 @@ module AhlScraper
|
|
17
17
|
|
18
18
|
def ordered_penalty_shots
|
19
19
|
@ordered_penalty_shots ||= penalty_shot_data.sort do |a, b|
|
20
|
-
[a[:period][:id].to_i,
|
20
|
+
[a[:period][:id].to_i, IceTimeHelper.new(a[:time]).to_sec] <=> [b[:period][:id].to_i, IceTimeHelper.new(b[:time]).to_sec]
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
def convert_time(game_time)
|
25
|
-
time = game_time.split(":")
|
26
|
-
time[0].to_i * 60 + time[1].to_i
|
27
|
-
end
|
28
23
|
end
|
29
24
|
end
|
30
25
|
end
|
data/lib/ahl_scraper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahl_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jefftcraig
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- ".rubocop.yml"
|
191
191
|
- ".ruby-version"
|
192
192
|
- ".solargraph.yml"
|
193
|
+
- ".tool-versions"
|
193
194
|
- ".travis.yml"
|
194
195
|
- ".vscode/settings.json"
|
195
196
|
- CHANGELOG.md
|
@@ -290,7 +291,7 @@ metadata:
|
|
290
291
|
homepage_uri: https://github.com/notnotjeff/ahl_scraper
|
291
292
|
source_code_uri: https://github.com/notnotjeff/ahl_scraper
|
292
293
|
changelog_uri: https://github.com/notnotjeff/ahl_scraper
|
293
|
-
post_install_message:
|
294
|
+
post_install_message:
|
294
295
|
rdoc_options: []
|
295
296
|
require_paths:
|
296
297
|
- lib
|
@@ -306,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
307
|
version: '0'
|
307
308
|
requirements: []
|
308
309
|
rubygems_version: 3.1.6
|
309
|
-
signing_key:
|
310
|
+
signing_key:
|
310
311
|
specification_version: 4
|
311
312
|
summary: Scrape data from the AHL website
|
312
313
|
test_files: []
|