ahl_scraper 0.3.2 → 0.3.3

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: 96ea396818543dee6748d5ebd32b0db5d72c8901f1fb87b152302065392dd54c
4
+ data.tar.gz: f6885cf29578adc5600be0f126df73dd7ab22db7b5729035bcabaa14a15dc257
5
5
  SHA512:
6
- metadata.gz: cc5998864a75a5a351c2f42eb97066340e681024af5da5d766077dc80d581a5c767340aa9b5125d06da1e40cd615e1c7805d86a831b28f5174d3632dd6d6f14f
7
- data.tar.gz: 8cb1e8fa0b79e50bacf1b4755120f3e41382b8f1b0fb542352af6ea744e62719b2c0b9cb821631c3efa3ffdef1491828742a519023b7eb9d300689f947a526ec
6
+ metadata.gz: 228d84267c85f593994851af53395c878505fd540cea3a94a037ea904a38315f0b86c68404e9a6fb6f096c84a5fb62595b8ee09543e61aa24e502172b83ed4a2
7
+ data.tar.gz: 9bc8c692ee1b2e27df73087d244042a150717f0dd489b417593ecd8ec7e55148c35f00bb7096564f30c6cf6b7263bbb76169f559ce530404d9455f0c7a9d158d
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.3
4
+
5
+ ## Developer
6
+
7
+ - Added `.tool-versions` file for `asdf` package manager use
8
+
9
+ ## PlayoffBrackets::Round
10
+
11
+ - Add `active?` attribute which checks if any series is active, if so it returns truthy, else falsey
12
+
13
+ ## PlayoffBrackets::Series
14
+
15
+ - Add check for existance of team ids for `active?` attribute to be truthy
16
+
3
17
  ## 0.3.2
4
18
 
5
19
  ## General
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
@@ -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
@@ -32,7 +32,7 @@ module AhlScraper
32
32
  end
33
33
 
34
34
  def active?
35
- @active ||= @raw_data[:active] == "1" && team1_wins < wins_needed && team2_wins < wins_needed
35
+ @active ||= @raw_data[:active] == "1" && team_ids_present? && team1_wins < wins_needed && team2_wins < wins_needed
36
36
  end
37
37
 
38
38
  def home_feeder_series
@@ -48,11 +48,13 @@ module AhlScraper
48
48
  end
49
49
 
50
50
  def home_team_id
51
- @home_team_id ||= first_game[:home_team].to_i
51
+ @home_team_id = first_game&.dig(:home_team)&.to_i if @home_team_id.nil?
52
+ @home_team_id
52
53
  end
53
54
 
54
55
  def away_team_id
55
- @away_team_id ||= first_game[:visiting_team].to_i
56
+ @away_team_id = first_game&.dig(:visiting_team)&.to_i if @away_team_id.nil?
57
+ @away_team_id
56
58
  end
57
59
 
58
60
  def home_team_wins
@@ -78,7 +80,7 @@ module AhlScraper
78
80
  private
79
81
 
80
82
  def first_game
81
- @first_game ||= @raw_data[:games][0]
83
+ @first_game ||= @raw_data.dig(:games, 0)
82
84
  end
83
85
 
84
86
  def find_winner
@@ -90,23 +92,27 @@ module AhlScraper
90
92
  end
91
93
 
92
94
  def season_id
93
- @opts[:bracket_data]&.dig(:rounds, round - 1, :season_id)
95
+ @opts.dig(:bracket_data, :rounds, round - 1, :season_id)
94
96
  end
95
97
 
96
98
  def team1
97
- @team1 ||= @raw_data[:team1].to_i
99
+ @team1 ||= @raw_data[:team1].to_i.zero? ? nil : @raw_data[:team1].to_i
98
100
  end
99
101
 
100
102
  def team2
101
- @team2 ||= @raw_data[:team2].to_i
103
+ @team2 ||= @raw_data[:team2].to_i.zero? ? nil : @raw_data[:team2].to_i
104
+ end
105
+
106
+ def team_ids_present?
107
+ team1 && team2
102
108
  end
103
109
 
104
110
  def team1_wins
105
- @team1_wins ||= @raw_data[:team1_wins]
111
+ @team1_wins ||= @raw_data[:team1_wins].to_i
106
112
  end
107
113
 
108
114
  def team2_wins
109
- @team2_wins ||= @raw_data[:team2_wins]
115
+ @team2_wins ||= @raw_data[:team2_wins].to_i
110
116
  end
111
117
  end
112
118
  end
@@ -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.3"
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.3
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-05-14 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: []