ahl_scraper 0.3.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fc138bb02a9563b2b9a4940a15dd9bd6e56f56d5b7352bddbb09fb2a63a7c0d
4
- data.tar.gz: 4292c6ed3cd9c4da7f92aa6b861fa2d40a7cc1c933962c8c55610e34819317f0
3
+ metadata.gz: d3e4430a39581a934ebf5d3513e007736adb1b24b384468fe21a2db916ec44c8
4
+ data.tar.gz: 2a8ed5d74db57a07651f18e456c6f275d41801512f5c5a632e0630030af62d4f
5
5
  SHA512:
6
- metadata.gz: cc5998864a75a5a351c2f42eb97066340e681024af5da5d766077dc80d581a5c767340aa9b5125d06da1e40cd615e1c7805d86a831b28f5174d3632dd6d6f14f
7
- data.tar.gz: 8cb1e8fa0b79e50bacf1b4755120f3e41382b8f1b0fb542352af6ea744e62719b2c0b9cb821631c3efa3ffdef1491828742a519023b7eb9d300689f947a526ec
6
+ metadata.gz: b02c8b0d834ea69ceaad08077e2d84a7fbe75ad327987a77ccce96500ae4f4b8f6a7ec9215e89e1221788ba0c0441c23200febb526cfd9bc6297ea7b71b5b9da
7
+ data.tar.gz: a773e783e8df81e10e2ce323cc3d53ca6e94a0f11fe1bc8d58d16b669fe701d1e32baf7be2e9f6cff80dc258a4005f15200c78f37b3199d6134dbc10d2391c2d
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.3
data/CHANGELOG.md CHANGED
@@ -1,8 +1,38 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Developer
6
+
7
+ - Add ability to use `rake console` to access gem in console to do manual testing
8
+
9
+ ### Seasons::Team
10
+
11
+ - Add Coachella Valley Firebirds to naming hash
12
+
13
+ ## 0.3.4
14
+
15
+ ### PlayoffBrackets::Series
16
+
17
+ - Add new series wins required for current playoffs (2022 with id `76`)
18
+
19
+ ## 0.3.3
20
+
21
+ ### Developer
22
+
23
+ - Added `.tool-versions` file for `asdf` package manager use
24
+
25
+ ### PlayoffBrackets::Round
26
+
27
+ - Add `active?` attribute which checks if any series is active, if so it returns truthy, else falsey
28
+
29
+ ### PlayoffBrackets::Series
30
+
31
+ - Add check for existance of team ids for `active?` attribute to be truthy
32
+
3
33
  ## 0.3.2
4
34
 
5
- ## General
35
+ ### General
6
36
 
7
37
  - Changed `.split` to `&.split` and use `.dig` more to not fail when fields don't exist (often on games that have not finished)
8
38
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ahl_scraper (0.3.1)
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.1.1)
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.4.4)
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.3.1)
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-x86_64-darwin)
31
+ nokogiri (1.12.5-arm64-darwin)
32
32
  racc (~> 1.4)
33
- parallel (1.21.0)
34
- parser (3.0.2.0)
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.6)
43
- racc (1.5.2)
44
- rainbow (3.0.0)
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.1.1)
47
- reverse_markdown (2.0.0)
46
+ regexp_parser (2.3.1)
47
+ reverse_markdown (2.1.1)
48
48
  nokogiri
49
49
  rexml (3.2.5)
50
- rspec (3.10.0)
51
- rspec-core (~> 3.10.0)
52
- rspec-expectations (~> 3.10.0)
53
- rspec-mocks (~> 3.10.0)
54
- rspec-core (3.10.1)
55
- rspec-support (~> 3.10.0)
56
- rspec-expectations (3.10.1)
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.10.0)
59
- rspec-mocks (3.10.2)
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.10.0)
62
- rspec-support (3.10.2)
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.0)
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
- yard (0.9.26)
101
+ webrick (1.7.0)
102
+ yard (0.9.27)
103
+ webrick (~> 1.7.0)
102
104
 
103
105
  PLATFORMS
104
- x86_64-darwin-19
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.2.17
121
+ 2.3.12
data/Rakefile CHANGED
@@ -6,3 +6,7 @@ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  task default: :spec
9
+
10
+ task :console do
11
+ exec "irb -r ahl_scraper -I ./lib"
12
+ end
@@ -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, { raw_data: @raw_data }) }
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 ||= first_game[:home_team].to_i
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 ||= first_game[:visiting_team].to_i
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[:games][0]
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[:bracket_data]&.dig(:rounds, round - 1, :season_id)
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
@@ -26,6 +26,7 @@ module AhlScraper
26
26
  "wilkes-barre-scranton-penguins" => { city: "Wilkes-Barre/Scranton", name: "Penguins", game_file_city: "W-B/Scranton" },
27
27
  "edmonton-road-runners" => { city: "Edmonton", name: "Road Runners" },
28
28
  "henderson-silver-knights" => { city: "Henderson", name: "Silver Knights" },
29
+ "coachella-valley-firebirds" => { city: "Coachella Valley", name: "Firebirds" },
29
30
  }.freeze
30
31
 
31
32
  def initialize(raw_data, division, opts = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AhlScraper
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.5"
5
5
  end
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.2
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jefftcraig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-13 00:00:00.000000000 Z
11
+ date: 2022-07-23 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: []