ahl_scraper 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +2 -2
- data/README.md +4 -4
- data/lib/ahl_scraper/resources/games/penalty.rb +16 -2
- data/lib/ahl_scraper/resources/player.rb +2 -6
- data/lib/ahl_scraper/resources/roster_player.rb +2 -2
- 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: 878af541d3e623e6e74955e4edb4fcb713b1ea05b6c536eac092508fce031914
|
4
|
+
data.tar.gz: bf55cecdad52ef86b8a133ae920cbd1c40d0fd95beffe75a804f03e3163091bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d0270faf84de38e464e30aebc1e8db595f2310b3bf2a950573c538acee01cf766b3e06b4293f3aacfe2db1177a4f08164bc610a13a6e4406ca3dac3351f69fa
|
7
|
+
data.tar.gz: e603bcb1f39ff49d68968a325aaa044d8287d9e0b40c1c72d9e61d79033d83d2cc03ca31717e28096516f9b05700922042a3679342a64b59c71ad9cdda5b6e24
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
### RosterPlayers
|
6
|
+
|
7
|
+
- Changed `shoots` to `handedness` and fixed value so that goalies get a proper handedness
|
8
|
+
|
9
|
+
### Players
|
10
|
+
|
11
|
+
- Merged `shoots` and `catches` into `handedness` attribute
|
12
|
+
|
13
|
+
### Penalties
|
14
|
+
|
15
|
+
- Uses AHL id under the `id` attribute
|
16
|
+
- Add `penalty_shot` type
|
17
|
+
- Add `bench?` for bench related penalties
|
18
|
+
- Add `invalid?` for tagging broken penalties that can be skipped
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -136,7 +136,7 @@ Returns a `Player` object which has full details on a player by passing their id
|
|
136
136
|
require "ahl_scraper"
|
137
137
|
AhlScraper::Players.retrieve(6845)
|
138
138
|
|
139
|
-
#=> #<Player:0x4b8c {:id=>6845, :current_age=>0.2534e2, :position=>"D", :first_name=>"Sebastian", :
|
139
|
+
#=> #<Player:0x4b8c {:id=>6845, :current_age=>0.2534e2, :position=>"D", :first_name=>"Sebastian", :handedness=>"L", :last_name=>"Aho", :birthplace=>"Umea, Sweden", :height=>"5-11", :birthdate=>"1996-02-17", :draft_year=>2014, :weight=>177, :name=>"Sebastian Aho", :jersey_number=>28}>
|
140
140
|
```
|
141
141
|
|
142
142
|
### Teams
|
@@ -182,9 +182,9 @@ Returns an array of `RosterPlayer` objects which provide information on all of a
|
|
182
182
|
require "ahl_scraper"
|
183
183
|
AhlScraper::RosterPlayers.retrieve_all(335, 68)
|
184
184
|
|
185
|
-
#=> [#<RosterPlayer:0x3c3c {:id=>6379, :current_age=>0.2521e2, :season_id=>68, :position=>"C", :
|
186
|
-
#<RosterPlayer:0x3c50 {:id=>1844, :current_age=>0.3416e2, :season_id=>68, :position=>"LW", :
|
187
|
-
#<RosterPlayer:0x3c64 {:id=>5660, :current_age=>0.2914e2, :season_id=>68, :position=>"LW", :
|
185
|
+
#=> [#<RosterPlayer:0x3c3c {:id=>6379, :current_age=>0.2521e2, :season_id=>68, :position=>"C", :handedness=>"L", :birthplace=>"Saskatoon, SK", :birthdate=>"1996-04-03", :height=>"6-0", :draft_year=>2014, :weight=>203, :rookie?=>false, :team_id=>335, :name=>"Rourke Chartier", :jersey_number=>15}>,
|
186
|
+
#<RosterPlayer:0x3c50 {:id=>1844, :current_age=>0.3416e2, :season_id=>68, :position=>"LW", :handedness=>"L", :birthplace=>"Toronto, ON", :birthdate=>"1987-04-25", :height=>"5-11", :draft_year=>2005, :weight=>207, :rookie?=>false, :team_id=>335, :name=>"Richard Clune", :jersey_number=>17}>,
|
187
|
+
#<RosterPlayer:0x3c64 {:id=>5660, :current_age=>0.2914e2, :season_id=>68, :position=>"LW", :handedness=>"L", :birthplace=>"Morristown, NJ", :birthdate=>"1992-04-30", :height=>"6-0", :draft_year=>2010, :weight=>200, :rookie?=>false, :team_id=>335, :name=>"Kenny Agostino", :jersey_number=>18}>,
|
188
188
|
#...
|
189
189
|
#]
|
190
190
|
```
|
@@ -3,12 +3,16 @@
|
|
3
3
|
module AhlScraper
|
4
4
|
module Games
|
5
5
|
class Penalty < Resource
|
6
|
+
def id
|
7
|
+
@id ||= @raw_data.dig(:game_penalty_id)&.to_i
|
8
|
+
end
|
9
|
+
|
6
10
|
def number
|
7
11
|
@number ||= @opts[:number]
|
8
12
|
end
|
9
13
|
|
10
14
|
def period
|
11
|
-
@period ||= @raw_data.dig(:period, :id)
|
15
|
+
@period ||= @raw_data.dig(:period, :id)&.to_i
|
12
16
|
end
|
13
17
|
|
14
18
|
def time
|
@@ -70,12 +74,22 @@ module AhlScraper
|
|
70
74
|
end
|
71
75
|
|
72
76
|
def power_play?
|
73
|
-
@
|
77
|
+
@raw_data[:isPowerPlay]
|
78
|
+
end
|
79
|
+
|
80
|
+
def bench?
|
81
|
+
@raw_data[:isPowerPlay]
|
82
|
+
end
|
83
|
+
|
84
|
+
def invalid?
|
85
|
+
[240_773].include? id
|
74
86
|
end
|
75
87
|
|
76
88
|
def penalty_type
|
77
89
|
@penalty_type ||=
|
78
90
|
case @raw_data[:description]
|
91
|
+
when /penalty shot/i
|
92
|
+
:penalty_shot
|
79
93
|
when /double minor/i
|
80
94
|
:double_minor
|
81
95
|
when /major/i
|
@@ -22,12 +22,8 @@ module AhlScraper
|
|
22
22
|
@last_name ||= @raw_data.dig(:info, :lastName)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
@
|
27
|
-
end
|
28
|
-
|
29
|
-
def catches
|
30
|
-
@catches ||= @raw_data.dig(:info, :catches)
|
25
|
+
def handedness
|
26
|
+
@handedness ||= position == "G" ? @raw_data.dig(:info, :catches) : @raw_data.dig(:info, :shoots)
|
31
27
|
end
|
32
28
|
|
33
29
|
def birthplace
|
@@ -18,8 +18,8 @@ module AhlScraper
|
|
18
18
|
@name ||= @raw_data.dig(:bio, :row, :name)
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
@
|
21
|
+
def handedness
|
22
|
+
@handedness ||= position == "G" ? @raw_data.dig(:bio, :row, :catches) : @raw_data.dig(:bio, :row, :shoots)
|
23
23
|
end
|
24
24
|
|
25
25
|
def birthplace
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jefftcraig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows users to gather game, season, and player data from the AHL website
|
14
14
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- ".solargraph.yml"
|
25
25
|
- ".travis.yml"
|
26
26
|
- ".vscode/settings.json"
|
27
|
+
- CHANGELOG.md
|
27
28
|
- CODE_OF_CONDUCT.md
|
28
29
|
- Gemfile
|
29
30
|
- Gemfile.lock
|