ahl_scraper 0.3.7 → 0.4.0

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: 19ac0b14d0b335af57c72d9a95ddbe1ed7c674990f56a52962e01ecd6112d4f5
4
- data.tar.gz: 27eb465a69a64ee0c5171edbed58bea880901c5b9953dc91f6aacd75d01141b5
3
+ metadata.gz: 1f42dd5e6d96639ecdac35f8379c64af4071b81baaf3c3b54b8936bc5f8914df
4
+ data.tar.gz: b76e71cd02f95bc334eb84df86e4cf433fef6566bf3e2f176f741d9728aee7e3
5
5
  SHA512:
6
- metadata.gz: 81e272f8523db112eabe3c4f1127b83e83593f8685eb567d851941f7f1d81411d5ffabd270a6afc86573af6426d247c83292dbd09e1e71f241d4d93ca3edfcff
7
- data.tar.gz: '084d82bd3ca33d37aab4af2fd15a37508af4a67422069a5bed32466ee14bd9b28a194ec8e40dd39c37e42029bb5e55a6f6ba5aa4bf9e00c14eeb5881cc46209d'
6
+ metadata.gz: d81f9eaf408dc34229ed6a28d708747a561ad064a75f547e4204ab33d6dbb93087dc0666847379aff5f6de0ef9b469db4e0c2943f5abc50523a300ce0f33d335
7
+ data.tar.gz: 1b84e15ea9401d816813921daa5f036006706916fa5b2c93eeedc23675b9e06cf26b063b8f7127620755214c7ec2b011e698c1130cfedb680573612ddf6b1c03
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.8
4
+
5
+ ### Players
6
+
7
+ - Add `draft_info` to players (when AHL provides it)
8
+
3
9
  ## 0.3.7
4
10
 
5
11
  ### PlayoffBrackets::Series
data/Gemfile.lock CHANGED
@@ -1,65 +1,66 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ahl_scraper (0.3.7)
4
+ ahl_scraper (0.3.9)
5
5
  json (~> 2.5.1)
6
- nokogiri (~> 1.12.4)
6
+ nokogiri (~> 1.14.0)
7
7
  rake (~> 13.0.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.8.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ addressable (2.8.6)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
14
  ast (2.4.2)
15
15
  backport (1.2.0)
16
- benchmark (0.2.0)
16
+ benchmark (0.3.0)
17
17
  byebug (11.1.3)
18
18
  coderay (1.1.3)
19
19
  crack (0.4.5)
20
20
  rexml
21
21
  diff-lcs (1.5.0)
22
22
  e2mmap (0.1.0)
23
- hashdiff (1.0.1)
24
- jaro_winkler (1.5.4)
23
+ hashdiff (1.1.0)
24
+ jaro_winkler (1.5.6)
25
25
  json (2.5.1)
26
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-arm64-darwin)
31
+ nokogiri (1.14.5-arm64-darwin)
32
32
  racc (~> 1.4)
33
- parallel (1.22.1)
34
- parser (3.1.2.0)
33
+ parallel (1.24.0)
34
+ parser (3.2.2.4)
35
35
  ast (~> 2.4.1)
36
+ racc
36
37
  pry (0.13.1)
37
38
  coderay (~> 1.1)
38
39
  method_source (~> 1.0)
39
40
  pry-byebug (3.9.0)
40
41
  byebug (~> 11.0)
41
42
  pry (~> 0.13.0)
42
- public_suffix (4.0.7)
43
- racc (1.6.0)
43
+ public_suffix (5.0.4)
44
+ racc (1.7.3)
44
45
  rainbow (3.1.1)
45
46
  rake (13.0.6)
46
- regexp_parser (2.3.1)
47
+ regexp_parser (2.8.3)
47
48
  reverse_markdown (2.1.1)
48
49
  nokogiri
49
- rexml (3.2.5)
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)
50
+ rexml (3.2.6)
51
+ rspec (3.12.0)
52
+ rspec-core (~> 3.12.0)
53
+ rspec-expectations (~> 3.12.0)
54
+ rspec-mocks (~> 3.12.0)
55
+ rspec-core (3.12.2)
56
+ rspec-support (~> 3.12.0)
57
+ rspec-expectations (3.12.3)
57
58
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.11.0)
59
- rspec-mocks (3.11.1)
59
+ rspec-support (~> 3.12.0)
60
+ rspec-mocks (3.12.6)
60
61
  diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.11.0)
62
- rspec-support (3.11.0)
62
+ rspec-support (~> 3.12.0)
63
+ rspec-support (3.12.1)
63
64
  rubocop (0.89.1)
64
65
  parallel (~> 1.10)
65
66
  parser (>= 2.7.1.1)
@@ -74,7 +75,7 @@ GEM
74
75
  rubocop-performance (1.8.1)
75
76
  rubocop (>= 0.87.0)
76
77
  rubocop-ast (>= 0.4.0)
77
- ruby-progressbar (1.11.0)
78
+ ruby-progressbar (1.13.0)
78
79
  solargraph (0.43.3)
79
80
  backport (~> 1.2)
80
81
  benchmark
@@ -90,17 +91,15 @@ GEM
90
91
  thor (~> 1.0)
91
92
  tilt (~> 2.0)
92
93
  yard (~> 0.9, >= 0.9.24)
93
- thor (1.2.1)
94
- tilt (2.0.10)
94
+ thor (1.3.0)
95
+ tilt (2.3.0)
95
96
  unicode-display_width (1.8.0)
96
97
  vcr (6.0.0)
97
- webmock (3.14.0)
98
+ webmock (3.19.1)
98
99
  addressable (>= 2.8.0)
99
100
  crack (>= 0.3.2)
100
101
  hashdiff (>= 0.4.0, < 2.0.0)
101
- webrick (1.7.0)
102
- yard (0.9.27)
103
- webrick (~> 1.7.0)
102
+ yard (0.9.34)
104
103
 
105
104
  PLATFORMS
106
105
  arm64-darwin-21
data/ahl_scraper.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["changelog_uri"] = "https://github.com/notnotjeff/ahl_scraper"
20
20
 
21
21
  spec.add_dependency "json", "~> 2.5.1"
22
- spec.add_dependency "nokogiri", "~> 1.12.4"
22
+ spec.add_dependency "nokogiri", "~> 1.14.0"
23
23
  spec.add_dependency "rake", "~> 13.0.0"
24
24
 
25
25
  spec.add_development_dependency "byebug", "~> 11.1.3"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ahl_scraper/resources/players/draft_info"
4
+
3
5
  module AhlScraper
4
6
  module Players
5
7
  class << self
@@ -58,10 +58,22 @@ module AhlScraper
58
58
  @weight ||= @raw_data.dig(:info, :weight).to_i
59
59
  end
60
60
 
61
+ def draft_info
62
+ @draft_info ||= Players::DraftInfo.new(draft_data)
63
+ end
64
+
61
65
  private
62
66
 
63
67
  def valid_birthdate?
64
68
  @valid_birthdate ||= !@raw_data.dig(:info, :birthDate).empty? && @raw_data.dig(:info, :birthDate) != "0000-00-00"
65
69
  end
70
+
71
+ def draft_data
72
+ nhl_draft = @raw_data.dig(:info, :drafts)&.select { |draft| draft[:draft_league] == "NHL" }&.dig(0)
73
+
74
+ return {} if nhl_draft.nil?
75
+
76
+ nhl_draft
77
+ end
66
78
  end
67
79
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AhlScraper
4
+ module Players
5
+ class DraftInfo < Resource
6
+ def id
7
+ @id ||= @raw_data[:id]&.to_i
8
+ end
9
+
10
+ def league
11
+ @draft_league ||= @raw_data[:draft_league]
12
+ end
13
+
14
+ def team_name
15
+ @team_name ||= @raw_data[:draft_team]
16
+ end
17
+
18
+ def team_id
19
+ @team_id ||= @raw_data[:draft_team_id]&.to_i
20
+ end
21
+
22
+ def year
23
+ @year ||= @raw_data[:draft_year]&.to_i
24
+ end
25
+
26
+ def round
27
+ @round ||= @raw_data[:draft_round]&.to_i
28
+ end
29
+
30
+ def rank
31
+ @rank ||= @raw_data[:draft_rank]&.to_i
32
+ end
33
+
34
+ def junior_team
35
+ @junior_team ||= @raw_data[:draft_junior_team]
36
+ end
37
+
38
+ def team_logo
39
+ @team_logo ||= @raw_data[:draft_logo]
40
+ end
41
+
42
+ def description
43
+ @description ||= @raw_data[:draft_text]&.strip
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AhlScraper
4
- VERSION = "0.3.7"
4
+ VERSION = "0.4.0"
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.7
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jefftcraig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.12.4
33
+ version: 1.14.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.12.4
40
+ version: 1.14.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -255,6 +255,7 @@ files:
255
255
  - lib/ahl_scraper/resources/games/team.rb
256
256
  - lib/ahl_scraper/resources/goalie_game_list_item.rb
257
257
  - lib/ahl_scraper/resources/player.rb
258
+ - lib/ahl_scraper/resources/players/draft_info.rb
258
259
  - lib/ahl_scraper/resources/playoff_bracket.rb
259
260
  - lib/ahl_scraper/resources/playoff_brackets/game.rb
260
261
  - lib/ahl_scraper/resources/playoff_brackets/round.rb