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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47ece8f680f8640b8923d32b2e0f3e49c9ec5264
|
4
|
+
data.tar.gz: 90a57e6df0e71ac4fadf5f55209115f90c07b9b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9afaec96c711b47fdb696eb7d3f1d906701ffb925bb65d7ed844e49ef3c47e094d3997d39c1087d8154a372e22c9fc1c42881f849a2ef38933f6d333f52b3386
|
7
|
+
data.tar.gz: 0be1802d9195a52c6b881411ba4360924d304538556250c6fb2ea44408642fb32910aefa51e6ec7d17c970c7975b84bc811414001ae68af1d67acf5e9c5d0f39
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
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']
|
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
|
-
|
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
|
|
data/lib/sportradar/api/data.rb
CHANGED
@@ -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
|
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
|