sportradar-api 0.9.34 → 0.9.35

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
  SHA1:
3
- metadata.gz: 114350649f6907cfd922c903108cae849f797fd1
4
- data.tar.gz: ff41c309dde1ccb7803d812a8f5868e0db8398f6
3
+ metadata.gz: 47ece8f680f8640b8923d32b2e0f3e49c9ec5264
4
+ data.tar.gz: 90a57e6df0e71ac4fadf5f55209115f90c07b9b0
5
5
  SHA512:
6
- metadata.gz: 44e43825d789947563293d9d7acf25c7323f204760024e0bf97ba0e5172e3d423036b5a63c2058f53d1cec49d250adc77cc8646e5618b5683fb32c724983ea49
7
- data.tar.gz: d037e51ba0c1aed8403492adba6a1af0194a79bcb68dc8af5dd04cd305bd9ae5c4bb3e89ee96eaf7a99308d5fa6ff66f631d48c0dcb984d1f32ff75444819add
6
+ metadata.gz: 9afaec96c711b47fdb696eb7d3f1d906701ffb925bb65d7ed844e49ef3c47e094d3997d39c1087d8154a372e22c9fc1c42881f849a2ef38933f6d333f52b3386
7
+ data.tar.gz: 0be1802d9195a52c6b881411ba4360924d304538556250c6fb2ea44408642fb32910aefa51e6ec7d17c970c7975b84bc811414001ae68af1d67acf5e9c5d0f39
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.9.34)
4
+ sportradar-api (0.9.35)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -3,7 +3,7 @@ module Sportradar
3
3
  module Basketball
4
4
  class Nba
5
5
  class Player < Data
6
- attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_date, :birth_place, :college, :height, :weight, :birth_place, :college
6
+ attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_date, :birth_place, :college, :height, :weight, :birth_place, :college, :averages, :draft
7
7
  # @all_hash = {}
8
8
  # def self.new(data, **opts)
9
9
  # existing = @all_hash[data['id']]
@@ -67,8 +67,11 @@ module Sportradar
67
67
  update_draft(data)
68
68
 
69
69
  @team.update_player_stats(self, data['statistics'], opts[:game]) if data['statistics']
70
- @team.update_player_stats(self, data.dig('overall', 'average')) if data.dig('overall', 'average')
71
-
70
+ if avgs = data.dig('overall', 'average')
71
+ @averages = avgs
72
+ @team.update_player_stats(self, @averages)
73
+ end
74
+
72
75
  self
73
76
  end
74
77
 
@@ -115,10 +118,10 @@ module Sportradar
115
118
  # "points"=>"13"}}
116
119
  # end
117
120
  def update_draft(data)
118
- @draft = data['draft'] # {"team_id"=>"583ec825-fb46-11e1-82cb-f4ce4684ea4c", "year"=>"2012", "round"=>"1", "pick"=>"30"},
121
+ @draft = data['draft'] if data['draft'] # {"team_id"=>"583ec825-fb46-11e1-82cb-f4ce4684ea4c", "year"=>"2012", "round"=>"1", "pick"=>"30"},
119
122
  end
120
123
  def update_injuries(data)
121
- @injuries = data['injuries'] #
124
+ @injuries = data['injuries'] if data['injuries'] #
122
125
  # {"injury"=>
123
126
  # {"id"=>"06423591-3fc1-4d2b-8c60-a3f30d735345",
124
127
  # "comment"=>"Ezeli suffered a setback in his recovery from a procedure on his knee and there is no timetable for his return, according to Jason Quick of csnnw.com.",
@@ -125,7 +125,8 @@ module Sportradar
125
125
  def parse_season_stats(data)
126
126
  @team_stats = data.dig('team_records')
127
127
  update(data)
128
- create_data(@players_hash, data.dig('player_records', 'player'), klass: Player, api: api, team: self)
128
+ player_data = data.dig('player_records', 'player')
129
+ create_data(@players_hash, player_data, klass: Player, api: api, team: self)
129
130
  data
130
131
  end
131
132
 
@@ -52,7 +52,11 @@ module Sportradar
52
52
  existing ||= {} # handles nil case, typically during object instantiation
53
53
  case data
54
54
  when Array
55
- data.each { |hash| existing[hash['id']] = klass.new(hash, **opts) }
55
+ data.each do |hash|
56
+ current = existing[hash['id']]
57
+ current ? current.update(hash) : existing[hash['id']] = klass.new(hash, **opts)
58
+ existing[hash['id']]
59
+ end
56
60
  when Hash
57
61
  existing[data['id']] = klass.new(data, **opts)
58
62
  else
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.9.34"
3
+ VERSION = "0.9.35"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.34
4
+ version: 0.9.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett