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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549629bccc7f2a274c7c79e4b54c3eeb729c573275d4532ddd3013e250612fe5
4
- data.tar.gz: 5cdb779d1d7198086eb40c7efa5cf683676d55f89b10ad2d37a1d6b5f99473df
3
+ metadata.gz: 68325ed9c1b710f4f358c7f3baac8f6efc41321821dfed6d86da6b3074479621
4
+ data.tar.gz: 973468036ecbf7c93b0fd87140610e3eda5c66ceed81552984490af802cb4634
5
5
  SHA512:
6
- metadata.gz: 50d7e48c80b08c7384958414f39bfd57aade6ac2c3ce93d7567256970cd16d88a15421e8368b4a83ebefcd0477a30371ff08391d560b8abf4d2177b4cff9d6eb
7
- data.tar.gz: a39dbe3f2ef9b6aea6766d84c838dcabaee451aa36c3335f7cd0926446afcb613b1ec64bf1c024f77941991f87c948a651cc8972eb4fad9abf1da3118038099b
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EspnPub
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.13'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: espn_pub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Bowman