lib/sportradar/api/football/player.rb in sportradar-api-0.12.0 vs lib/sportradar/api/football/player.rb in sportradar-api-0.12.1
- old
+ new
@@ -1,10 +1,10 @@
module Sportradar
module Api
module Football
class Player < Data
- attr_accessor :response, :id, :preferred_name, :number, :name_full, :name_first, :name_last, :position, :birth_place, :college, :height, :weight, :averages, :totals, :draft, :depth, :api
+ attr_accessor :response, :id, :preferred_name, :number, :name_full, :name_first, :name_last, :position, :birth_place, :college, :height, :weight, :averages, :totals, :draft, :depth, :api, :stats
def initialize(data, **opts)
@response = data
@api = opts[:api]
@team = opts[:team]
@@ -60,13 +60,19 @@
# NCAA specific below
# update_injuries(data)
# update_draft(data)
- if stats = data['statistics']
- @totals = stats
+ if @stats = data['statistics']
+ @totals = @stats
# binding.pry
- @team.update_player_stats(self, stats.dup, opts[:game])
+ @team.update_player_stats(self, @stats.dup, opts[:game])
+ elsif @stats = data['games_played']
+ @stats = data.dup
+ %w[id name jersey reference position].each do |useless_key|
+ @stats.delete(useless_key)
+ end
+ @totals = @stats
else
@totals = {}
end
self
\ No newline at end of file