ahl_scraper 0.2.0 → 0.3.0

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +49 -0
  4. data/Gemfile +8 -8
  5. data/Gemfile.lock +46 -41
  6. data/ahl_scraper.gemspec +1 -1
  7. data/lib/ahl_scraper/fetchers/game_data_fetcher.rb +1 -1
  8. data/lib/ahl_scraper/fetchers/player_data_fetcher.rb +1 -1
  9. data/lib/ahl_scraper/fetchers/player_games/data_fetcher.rb +1 -1
  10. data/lib/ahl_scraper/fetchers/season_type_fetcher.rb +1 -2
  11. data/lib/ahl_scraper/fixed_games/1001050.json +18 -18
  12. data/lib/ahl_scraper/fixed_games/1003351.json +2728 -0
  13. data/lib/ahl_scraper/fixed_games/1018774.json +4 -4
  14. data/lib/ahl_scraper/fixed_games/1020527.json +8 -8
  15. data/lib/ahl_scraper/resources/game.rb +4 -3
  16. data/lib/ahl_scraper/resources/game_list_item.rb +13 -13
  17. data/lib/ahl_scraper/resources/games/info.rb +1 -1
  18. data/lib/ahl_scraper/resources/games/penalty.rb +2 -2
  19. data/lib/ahl_scraper/resources/games/team.rb +2 -2
  20. data/lib/ahl_scraper/resources/goalie_game_list_item.rb +2 -1
  21. data/lib/ahl_scraper/resources/player.rb +2 -2
  22. data/lib/ahl_scraper/resources/playoff_bracket.rb +5 -5
  23. data/lib/ahl_scraper/resources/playoff_brackets/round.rb +1 -1
  24. data/lib/ahl_scraper/resources/playoff_brackets/series.rb +60 -20
  25. data/lib/ahl_scraper/resources/roster_player.rb +1 -1
  26. data/lib/ahl_scraper/resources/season.rb +13 -8
  27. data/lib/ahl_scraper/resources/season_list_item.rb +2 -2
  28. data/lib/ahl_scraper/resources/seasons/team.rb +4 -3
  29. data/lib/ahl_scraper/resources/skater_game_list_item.rb +2 -2
  30. data/lib/ahl_scraper/resources/team_game_list_item.rb +2 -3
  31. data/lib/ahl_scraper/resources/team_list_item.rb +1 -1
  32. data/lib/ahl_scraper/services/games/create_skaters_service.rb +1 -1
  33. data/lib/ahl_scraper/services/games/on_ice_statlines_service.rb +1 -1
  34. data/lib/ahl_scraper/services/games/scoring_statlines_service.rb +29 -25
  35. data/lib/ahl_scraper/services/games/team_on_ice_goals_service.rb +1 -1
  36. data/lib/ahl_scraper/team_games.rb +3 -1
  37. data/lib/ahl_scraper/version.rb +1 -1
  38. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 878af541d3e623e6e74955e4edb4fcb713b1ea05b6c536eac092508fce031914
4
- data.tar.gz: bf55cecdad52ef86b8a133ae920cbd1c40d0fd95beffe75a804f03e3163091bc
3
+ metadata.gz: b50eba6912cfdd78130e062fda2e5714d0899d419d977b92c638378f9f672d4c
4
+ data.tar.gz: 0ab43e3f52a2de435ea0ea5f404b752d13ef6ae6eba003e485dd55967d6ab967
5
5
  SHA512:
6
- metadata.gz: 7d0270faf84de38e464e30aebc1e8db595f2310b3bf2a950573c538acee01cf766b3e06b4293f3aacfe2db1177a4f08164bc610a13a6e4406ca3dac3351f69fa
7
- data.tar.gz: e603bcb1f39ff49d68968a325aaa044d8287d9e0b40c1c72d9e61d79033d83d2cc03ca31717e28096516f9b05700922042a3679342a64b59c71ad9cdda5b6e24
6
+ metadata.gz: 0c3c0faf348050a9e1172f01d25c3f47b363eea83b4b8613688637b18532dfea6102ee7e0388ade687c306c452520be79b69d44702f2cd1b30142b548308b698
7
+ data.tar.gz: 70817e1d4a3258850516fe9f28543e04d31ca2c9bbcdba98f382af6152a48c6e59683b21fe49425450cb9c20d71ee2da5b2a03b7a518d3aa2a68265caaed1848
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.7.2
1
+ ruby-2.7.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### General
6
+
7
+ - Upgrade project Ruby version to `2.7.3`
8
+ - Update gem minimum version to `2.7.0`
9
+ - Use JSON override for game `1003351` where goalie boxscore stats don't match goal records (see wiki)
10
+ - Use term `handedness` for players
11
+ - Added penalty ids to JSON override games
12
+
13
+ ### GameInfo
14
+
15
+ - If game has not started set status to reflect that and include start time
16
+
17
+ ### Game
18
+
19
+ - Current time will check for whether a game has started so that games that haven't been played yet will return nil
20
+
21
+ ### GameListItem
22
+
23
+ - Use `dig` to be less error prone
24
+ - Set status to `Not Started` if game status still shows start time
25
+
26
+ ### Games::Penalty
27
+
28
+ - Add `id` field
29
+ - Add `bench?` attribute for when bench minor penalty
30
+ - Add `:penalty_shot` penalty type
31
+
32
+ ### PlayoffBracket
33
+
34
+ - Hardcode wins needed for series to allow for accurate series statuses
35
+ - Revamp `active?` logic to work even for finals (which remained set to active by AHL)
36
+ - Stick with `home` and `away` teams instead of `team1` and `team2` for:
37
+ - `feeder_series1` to `home_feeder_series`
38
+ - `feeder_series2` to `away_feeder_series`
39
+ - `team1` to `home_team_id`
40
+ - `team2` to `away_team_id`
41
+ - Change `winning_team` to `winning_team_id`
42
+ - Add `wins_needed` attribute
43
+
44
+ ### Game::Skater
45
+
46
+ - Use `p1_` for primary point short form instead of full words for `scoring_statline`
47
+
48
+ ### Season
49
+
50
+ - Add `preseason` season type with appropriate abbreviations
51
+
3
52
  ## 0.2.0
4
53
 
5
54
  ### RosterPlayers
data/Gemfile CHANGED
@@ -5,21 +5,21 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in ahl_scraper.gemspec
6
6
  gemspec
7
7
 
8
- gem "json"
9
- gem "nokogiri"
10
- gem "rake", "~> 12.0"
8
+ gem "json", "~> 2.5.1"
9
+ gem "nokogiri", "~> 1.12.4"
10
+ gem "rake", "~> 13.0.0"
11
11
 
12
12
  group :development do
13
13
  gem "rubocop", "~> 0.89.0", require: false
14
14
  gem "rubocop-performance", "~> 1.8.1", require: false
15
- gem "solargraph"
15
+ gem "solargraph", "~> 0.43.0"
16
16
  end
17
17
 
18
18
  group :development, :test do
19
- gem "byebug"
20
- gem "pry"
21
- gem "pry-byebug"
19
+ gem "byebug", "~> 11.1.3"
20
+ gem "pry", "~> 0.13.1"
21
+ gem "pry-byebug", "~> 3.9.0"
22
22
  gem "rspec", "~> 3.0"
23
- gem "vcr"
23
+ gem "vcr", "~> 6.0.0"
24
24
  gem "webmock", ">= 3.8.0"
25
25
  end
data/Gemfile.lock CHANGED
@@ -1,31 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ahl_scraper (0.2.0)
4
+ ahl_scraper (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.7.0)
9
+ addressable (2.8.0)
10
10
  public_suffix (>= 2.0.2, < 5.0)
11
- ast (2.4.1)
12
- backport (1.1.2)
13
- benchmark (0.1.0)
11
+ ast (2.4.2)
12
+ backport (1.2.0)
13
+ benchmark (0.1.1)
14
14
  byebug (11.1.3)
15
15
  coderay (1.1.3)
16
- crack (0.4.4)
16
+ crack (0.4.5)
17
+ rexml
17
18
  diff-lcs (1.4.4)
18
19
  e2mmap (0.1.0)
19
20
  hashdiff (1.0.1)
20
21
  jaro_winkler (1.5.4)
21
- json (2.3.1)
22
- maruku (0.7.3)
22
+ json (2.5.1)
23
+ kramdown (2.3.1)
24
+ rexml
25
+ kramdown-parser-gfm (1.1.0)
26
+ kramdown (~> 2.0)
23
27
  method_source (1.0.0)
24
- mini_portile2 (2.4.0)
25
- nokogiri (1.10.10)
26
- mini_portile2 (~> 2.4.0)
27
- parallel (1.20.1)
28
- parser (2.7.2.0)
28
+ nokogiri (1.12.5-x86_64-darwin)
29
+ racc (~> 1.4)
30
+ parallel (1.21.0)
31
+ parser (3.0.2.0)
29
32
  ast (~> 2.4.1)
30
33
  pry (0.13.1)
31
34
  coderay (~> 1.1)
@@ -34,25 +37,26 @@ GEM
34
37
  byebug (~> 11.0)
35
38
  pry (~> 0.13.0)
36
39
  public_suffix (4.0.6)
40
+ racc (1.5.2)
37
41
  rainbow (3.0.0)
38
- rake (12.3.3)
39
- regexp_parser (2.0.0)
42
+ rake (13.0.6)
43
+ regexp_parser (2.1.1)
40
44
  reverse_markdown (2.0.0)
41
45
  nokogiri
42
- rexml (3.2.4)
46
+ rexml (3.2.5)
43
47
  rspec (3.10.0)
44
48
  rspec-core (~> 3.10.0)
45
49
  rspec-expectations (~> 3.10.0)
46
50
  rspec-mocks (~> 3.10.0)
47
- rspec-core (3.10.0)
51
+ rspec-core (3.10.1)
48
52
  rspec-support (~> 3.10.0)
49
- rspec-expectations (3.10.0)
53
+ rspec-expectations (3.10.1)
50
54
  diff-lcs (>= 1.2.0, < 2.0)
51
55
  rspec-support (~> 3.10.0)
52
- rspec-mocks (3.10.0)
56
+ rspec-mocks (3.10.2)
53
57
  diff-lcs (>= 1.2.0, < 2.0)
54
58
  rspec-support (~> 3.10.0)
55
- rspec-support (3.10.0)
59
+ rspec-support (3.10.2)
56
60
  rubocop (0.89.1)
57
61
  parallel (~> 1.10)
58
62
  parser (>= 2.7.1.1)
@@ -67,47 +71,48 @@ GEM
67
71
  rubocop-performance (1.8.1)
68
72
  rubocop (>= 0.87.0)
69
73
  rubocop-ast (>= 0.4.0)
70
- ruby-progressbar (1.10.1)
71
- solargraph (0.39.17)
72
- backport (~> 1.1)
74
+ ruby-progressbar (1.11.0)
75
+ solargraph (0.43.3)
76
+ backport (~> 1.2)
73
77
  benchmark
74
78
  bundler (>= 1.17.2)
79
+ diff-lcs (~> 1.4)
75
80
  e2mmap
76
81
  jaro_winkler (~> 1.5)
77
- maruku (~> 0.7, >= 0.7.3)
78
- nokogiri (~> 1.9, >= 1.9.1)
79
- parser (~> 2.3)
82
+ kramdown (~> 2.3)
83
+ kramdown-parser-gfm (~> 1.1)
84
+ parser (~> 3.0)
80
85
  reverse_markdown (>= 1.0.5, < 3)
81
- rubocop (~> 0.52)
86
+ rubocop (>= 0.52)
82
87
  thor (~> 1.0)
83
88
  tilt (~> 2.0)
84
89
  yard (~> 0.9, >= 0.9.24)
85
- thor (1.0.1)
90
+ thor (1.1.0)
86
91
  tilt (2.0.10)
87
- unicode-display_width (1.7.0)
92
+ unicode-display_width (1.8.0)
88
93
  vcr (6.0.0)
89
- webmock (3.10.0)
90
- addressable (>= 2.3.6)
94
+ webmock (3.14.0)
95
+ addressable (>= 2.8.0)
91
96
  crack (>= 0.3.2)
92
97
  hashdiff (>= 0.4.0, < 2.0.0)
93
- yard (0.9.25)
98
+ yard (0.9.26)
94
99
 
95
100
  PLATFORMS
96
- ruby
101
+ x86_64-darwin-19
97
102
 
98
103
  DEPENDENCIES
99
104
  ahl_scraper!
100
- byebug
101
- json
102
- nokogiri
103
- pry
104
- pry-byebug
105
- rake (~> 12.0)
105
+ byebug (~> 11.1.3)
106
+ json (~> 2.5.1)
107
+ nokogiri (~> 1.12.4)
108
+ pry (~> 0.13.1)
109
+ pry-byebug (~> 3.9.0)
110
+ rake (~> 13.0.0)
106
111
  rspec (~> 3.0)
107
112
  rubocop (~> 0.89.0)
108
113
  rubocop-performance (~> 1.8.1)
109
- solargraph
110
- vcr
114
+ solargraph (~> 0.43.0)
115
+ vcr (~> 6.0.0)
111
116
  webmock (>= 3.8.0)
112
117
 
113
118
  BUNDLED WITH
data/ahl_scraper.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Allows users to gather game, season, and player data from the AHL website"
13
13
  spec.homepage = "http://www.ahltracker.com"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = "https://github.com/notnotjeff/ahl_scraper"
18
18
  spec.metadata["source_code_uri"] = "https://github.com/notnotjeff/ahl_scraper"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module AhlScraper
4
4
  class GameDataFetcher
5
- BROKEN_GAMES = [1_018_774, 1_001_050, 1_020_527].freeze
5
+ BROKEN_GAMES = [1_018_774, 1_001_050, 1_020_527, 1_003_351].freeze
6
6
 
7
7
  def initialize(game_id)
8
8
  @game_id = game_id
@@ -18,7 +18,7 @@ module AhlScraper
18
18
 
19
19
  def player_data_without_bio
20
20
  data = Nokogiri::HTML(URI.parse(url).open).text[5..-2]
21
- bio = data[/\"bio"\:(.*?)\,\"teamName/m, 1]
21
+ bio = data[/"bio":(.*?),"teamName/m, 1]
22
22
  data.gsub(bio, "\"\"")
23
23
  end
24
24
  end
@@ -22,7 +22,7 @@ module AhlScraper
22
22
 
23
23
  def player_data_without_bio
24
24
  data = Nokogiri::HTML(URI.parse(url).open).text[5..-2]
25
- bio = data[/\"bio"\:(.*?)\,\"teamName/m, 1]
25
+ bio = data[/"bio":(.*?),"teamName/m, 1]
26
26
  data.gsub(bio, "\"\"")
27
27
  end
28
28
  end
@@ -7,8 +7,7 @@ module AhlScraper
7
7
  end
8
8
 
9
9
  def call
10
- season = JSON.parse(Nokogiri::HTML(URI.parse(url).open).text[5..-2], symbolize_names: true)
11
- .dig(:seasons)
10
+ season = JSON.parse(Nokogiri::HTML(URI.parse(url).open).text[5..-2], symbolize_names: true)[:seasons]
12
11
  &.find { |s| s[:id].to_i == @season_id.to_i }
13
12
  return nil unless season
14
13
 
@@ -1224,7 +1224,7 @@
1224
1224
  ],
1225
1225
  "penalties": [
1226
1226
  {
1227
- "game_penalty_id": null,
1227
+ "game_penalty_id": 202,
1228
1228
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1229
1229
  "time": "0:40",
1230
1230
  "againstTeam": {
@@ -1259,7 +1259,7 @@
1259
1259
  "isBench": false
1260
1260
  },
1261
1261
  {
1262
- "game_penalty_id": null,
1262
+ "game_penalty_id": 203,
1263
1263
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1264
1264
  "time": "3:00",
1265
1265
  "againstTeam": {
@@ -1294,7 +1294,7 @@
1294
1294
  "isBench": false
1295
1295
  },
1296
1296
  {
1297
- "game_penalty_id": null,
1297
+ "game_penalty_id": 204,
1298
1298
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1299
1299
  "time": "6:29",
1300
1300
  "againstTeam": {
@@ -1329,7 +1329,7 @@
1329
1329
  "isBench": false
1330
1330
  },
1331
1331
  {
1332
- "game_penalty_id": null,
1332
+ "game_penalty_id": 207,
1333
1333
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1334
1334
  "time": "8:19",
1335
1335
  "againstTeam": {
@@ -1364,7 +1364,7 @@
1364
1364
  "isBench": false
1365
1365
  },
1366
1366
  {
1367
- "game_penalty_id": null,
1367
+ "game_penalty_id": 211,
1368
1368
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1369
1369
  "time": "8:59",
1370
1370
  "againstTeam": {
@@ -1399,7 +1399,7 @@
1399
1399
  "isBench": false
1400
1400
  },
1401
1401
  {
1402
- "game_penalty_id": null,
1402
+ "game_penalty_id": 227,
1403
1403
  "period": { "id": "1", "shortName": "", "longName": "1st" },
1404
1404
  "time": "17:54",
1405
1405
  "againstTeam": {
@@ -1446,7 +1446,7 @@
1446
1446
  "goals": [],
1447
1447
  "penalties": [
1448
1448
  {
1449
- "game_penalty_id": null,
1449
+ "game_penalty_id": 243,
1450
1450
  "period": { "id": "2", "shortName": "", "longName": "2nd" },
1451
1451
  "time": "2:52",
1452
1452
  "againstTeam": {
@@ -1481,7 +1481,7 @@
1481
1481
  "isBench": false
1482
1482
  },
1483
1483
  {
1484
- "game_penalty_id": null,
1484
+ "game_penalty_id": 252,
1485
1485
  "period": { "id": "2", "shortName": "", "longName": "2nd" },
1486
1486
  "time": "5:31",
1487
1487
  "againstTeam": {
@@ -1516,7 +1516,7 @@
1516
1516
  "isBench": false
1517
1517
  },
1518
1518
  {
1519
- "game_penalty_id": null,
1519
+ "game_penalty_id": 254,
1520
1520
  "period": { "id": "2", "shortName": "", "longName": "2nd" },
1521
1521
  "time": "8:05",
1522
1522
  "againstTeam": {
@@ -1551,7 +1551,7 @@
1551
1551
  "isBench": false
1552
1552
  },
1553
1553
  {
1554
- "game_penalty_id": null,
1554
+ "game_penalty_id": 255,
1555
1555
  "period": { "id": "2", "shortName": "", "longName": "2nd" },
1556
1556
  "time": "13:02",
1557
1557
  "againstTeam": {
@@ -1586,7 +1586,7 @@
1586
1586
  "isBench": false
1587
1587
  },
1588
1588
  {
1589
- "game_penalty_id": null,
1589
+ "game_penalty_id": 260,
1590
1590
  "period": { "id": "2", "shortName": "", "longName": "2nd" },
1591
1591
  "time": "14:16",
1592
1592
  "againstTeam": {
@@ -1894,7 +1894,7 @@
1894
1894
  ],
1895
1895
  "penalties": [
1896
1896
  {
1897
- "game_penalty_id": null,
1897
+ "game_penalty_id": 261,
1898
1898
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
1899
1899
  "time": "1:32",
1900
1900
  "againstTeam": {
@@ -1929,7 +1929,7 @@
1929
1929
  "isBench": false
1930
1930
  },
1931
1931
  {
1932
- "game_penalty_id": null,
1932
+ "game_penalty_id": 278,
1933
1933
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
1934
1934
  "time": "5:51",
1935
1935
  "againstTeam": {
@@ -1964,7 +1964,7 @@
1964
1964
  "isBench": false
1965
1965
  },
1966
1966
  {
1967
- "game_penalty_id": null,
1967
+ "game_penalty_id": 281,
1968
1968
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
1969
1969
  "time": "10:22",
1970
1970
  "againstTeam": {
@@ -1999,7 +1999,7 @@
1999
1999
  "isBench": false
2000
2000
  },
2001
2001
  {
2002
- "game_penalty_id": null,
2002
+ "game_penalty_id": 332,
2003
2003
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
2004
2004
  "time": "12:05",
2005
2005
  "againstTeam": {
@@ -2034,7 +2034,7 @@
2034
2034
  "isBench": false
2035
2035
  },
2036
2036
  {
2037
- "game_penalty_id": null,
2037
+ "game_penalty_id": 340,
2038
2038
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
2039
2039
  "time": "15:53",
2040
2040
  "againstTeam": {
@@ -2069,7 +2069,7 @@
2069
2069
  "isBench": false
2070
2070
  },
2071
2071
  {
2072
- "game_penalty_id": null,
2072
+ "game_penalty_id": 355,
2073
2073
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
2074
2074
  "time": "15:53",
2075
2075
  "againstTeam": {
@@ -2104,7 +2104,7 @@
2104
2104
  "isBench": false
2105
2105
  },
2106
2106
  {
2107
- "game_penalty_id": null,
2107
+ "game_penalty_id": 363,
2108
2108
  "period": { "id": "3", "shortName": "", "longName": "3rd" },
2109
2109
  "time": "17:11",
2110
2110
  "againstTeam": {