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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19ac0b14d0b335af57c72d9a95ddbe1ed7c674990f56a52962e01ecd6112d4f5
4
- data.tar.gz: 27eb465a69a64ee0c5171edbed58bea880901c5b9953dc91f6aacd75d01141b5
3
+ metadata.gz: 42ad854afa14d8f639b35294da5ee966b60ec6ab335ab4775d01ac00242b9b80
4
+ data.tar.gz: 8bcd4121376a7dc3aab716a1321b4a1bdfa826923b69ccef386ce1cd23aa22f8
5
5
  SHA512:
6
- metadata.gz: 81e272f8523db112eabe3c4f1127b83e83593f8685eb567d851941f7f1d81411d5ffabd270a6afc86573af6426d247c83292dbd09e1e71f241d4d93ca3edfcff
7
- data.tar.gz: '084d82bd3ca33d37aab4af2fd15a37508af4a67422069a5bed32466ee14bd9b28a194ec8e40dd39c37e42029bb5e55a6f6ba5aa4bf9e00c14eeb5881cc46209d'
6
+ metadata.gz: 6853fbd4cdd9c0491bcc24bf16b4dfbf510ddb62234784bcd0f174dcc9b401899c5b5469493aa8ba1f30ff81ce5158dae052f77f5584b85ddaca096eedd9d847
7
+ data.tar.gz: f96d7358daa78c9ba2835f5921c027b63a1c380653c81f71cba015631343f9d60312c43d345e4fc067d2e8582058901a4de69968a75337f8dd4e2ad2f4c302a6
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
@@ -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.3.8"
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.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-04-20 00:00:00.000000000 Z
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