espn_pub 0.1.11 → 0.1.13
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/lib/espn_pub/entities/game.rb +1 -1
- data/lib/espn_pub/entities/player.rb +21 -2
- data/lib/espn_pub/entities/player_game_stat.rb +3 -2
- data/lib/espn_pub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68325ed9c1b710f4f358c7f3baac8f6efc41321821dfed6d86da6b3074479621
|
|
4
|
+
data.tar.gz: 973468036ecbf7c93b0fd87140610e3eda5c66ceed81552984490af802cb4634
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91432e1617a1b61514e8b2d60b364143d2b70aa1f09ea987f00306c780aa2ff1d44ff145f35db22a886414c221987641fdcef4d4668910d2351b386713f502fd
|
|
7
|
+
data.tar.gz: a47e0dcc0ce5053f8df672326ea3a94e12c7659e72f8ea2612214c9ba40b170d4062677e3b130d3234d42d02d4745b8ecfb96d9753d6b84a9fa83cbc24fed005
|
|
@@ -62,7 +62,7 @@ module EspnPub
|
|
|
62
62
|
stats_data[key] = athlete['stats'][index]
|
|
63
63
|
end
|
|
64
64
|
@player_game_stats << EspnPub::Entities::PlayerGameStat.new(
|
|
65
|
-
player: player, team: team, stats_data: stats_data
|
|
65
|
+
player: player, team: team, stats_data: stats_data, starter: athlete['starter']
|
|
66
66
|
)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -84,8 +84,8 @@ module EspnPub
|
|
|
84
84
|
position: athlete_data.dig('position', 'abbreviation'),
|
|
85
85
|
team_id: athlete_data.dig('team', 'id'),
|
|
86
86
|
date_of_birth: parse_date_of_birth(athlete_data['dateOfBirth']),
|
|
87
|
-
height: athlete_data['displayHeight'],
|
|
88
|
-
weight: athlete_data['displayWeight'],
|
|
87
|
+
height: convert_height(athlete_data['displayHeight']),
|
|
88
|
+
weight: convert_weight(athlete_data['displayWeight']),
|
|
89
89
|
debut_year: athlete_data['debutYear']
|
|
90
90
|
)
|
|
91
91
|
end
|
|
@@ -108,6 +108,25 @@ module EspnPub
|
|
|
108
108
|
rescue ArgumentError
|
|
109
109
|
nil
|
|
110
110
|
end
|
|
111
|
+
|
|
112
|
+
def self.convert_height(value)
|
|
113
|
+
return nil unless value
|
|
114
|
+
return value if value.is_a?(Integer)
|
|
115
|
+
|
|
116
|
+
return unless value.match(/'/)
|
|
117
|
+
|
|
118
|
+
feet, inches = value.split("'").map { |s| s.gsub(/[\s"]/, '').to_i }
|
|
119
|
+
(feet * 12) + inches
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.convert_weight(value)
|
|
123
|
+
return nil unless value
|
|
124
|
+
return value if value.is_a?(Integer)
|
|
125
|
+
|
|
126
|
+
return unless value.match(/lbs/)
|
|
127
|
+
|
|
128
|
+
value.gsub(/ lbs/, '').to_i
|
|
129
|
+
end
|
|
111
130
|
end
|
|
112
131
|
end
|
|
113
132
|
end
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
module EspnPub
|
|
4
4
|
module Entities
|
|
5
5
|
class PlayerGameStat < Base
|
|
6
|
-
attr_reader :player, :team, :stats_data
|
|
6
|
+
attr_reader :player, :team, :stats_data, :starter
|
|
7
7
|
|
|
8
|
-
def initialize(player:, team:, stats_data: {})
|
|
8
|
+
def initialize(player:, team:, stats_data: {}, starter: false)
|
|
9
9
|
@player = player
|
|
10
10
|
@team = team
|
|
11
11
|
@stats_data = stats_data
|
|
12
|
+
@starter = starter
|
|
12
13
|
super()
|
|
13
14
|
end
|
|
14
15
|
end
|
data/lib/espn_pub/version.rb
CHANGED