ahl_scraper 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/ahl_scraper/players.rb +2 -0
- data/lib/ahl_scraper/resources/player.rb +12 -0
- data/lib/ahl_scraper/resources/players/draft_info.rb +47 -0
- data/lib/ahl_scraper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ad854afa14d8f639b35294da5ee966b60ec6ab335ab4775d01ac00242b9b80
|
4
|
+
data.tar.gz: 8bcd4121376a7dc3aab716a1321b4a1bdfa826923b69ccef386ce1cd23aa22f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6853fbd4cdd9c0491bcc24bf16b4dfbf510ddb62234784bcd0f174dcc9b401899c5b5469493aa8ba1f30ff81ce5158dae052f77f5584b85ddaca096eedd9d847
|
7
|
+
data.tar.gz: f96d7358daa78c9ba2835f5921c027b63a1c380653c81f71cba015631343f9d60312c43d345e4fc067d2e8582058901a4de69968a75337f8dd4e2ad2f4c302a6
|
data/CHANGELOG.md
CHANGED
data/lib/ahl_scraper/players.rb
CHANGED
@@ -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
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jefftcraig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -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
|