lib/sportradar/api/basketball/nba/game.rb in sportradar-api-0.9.54 vs lib/sportradar/api/basketball/nba/game.rb in sportradar-api-0.9.55
- old
+ new
@@ -194,24 +194,32 @@
end
def get_box
api_res = api.get_data(path_box)
data = api_res['game']
+ ingest_box(data)
+ end
+
+ def ingest_box(data)
update(data, source: :box)
@quarter = data.delete('quarter').to_i
check_newness(:box, @clock)
data
end
def get_pbp
api_res = api.get_data(path_pbp)
data = api_res['game']
+ ingest_pbp(data)
+ end
+
+ def ingest_pbp(data)
update(data, source: :pbp)
quarter_data = if data['quarter']
@quarter = data['quarter'].first.to_i
quarts = data['quarter'][1..-1]
- quarts.is_a?(Array) ? quarts[0] : quarts
+ quarts.is_a?(Array) && (quarts.size == 1) ? quarts[0] : quarts
else
@quarter = nil
[]
end
if data['overtime']
@@ -225,9 +233,13 @@
end
def get_summary
api_res = api.get_data(path_summary)
data = api_res['game']
+ ingest_summary(data)
+ end
+
+ def ingest_summary(data)
update(data, source: :summary)
@quarter = data.delete('quarter').to_i
check_newness(:box, @clock)
data
end
\ No newline at end of file