lib/sportradar/api/baseball/team.rb in sportradar-api-0.12.0 vs lib/sportradar/api/baseball/team.rb in sportradar-api-0.12.1
- old
+ new
@@ -79,11 +79,11 @@
def parse_players(data, game)
create_data(@players_hash, data, klass: Player, api: api, team: self, game: game)
end
def update_player_stats(player, stats, game = nil)
- game ? game.update_player_stats(player, stats) : @player_stats.merge!(player.id => stats.merge!(player: player))
+ game ? game.update_player_stats(player, stats) : @player_stats.merge!(player.id => stats.merge(player: player))
end
def parse_records(data)
@records['overall'] = Record.new(data, type: 'overall')
end
@@ -97,11 +97,11 @@
# data retrieval
def get_roster
- data = api.get_data(path_roster)
+ data = api.get_data(path_roster).to_h
ingest_roster(data)
end
def ingest_roster(data)
update(data)
data
@@ -110,17 +110,17 @@
url, headers, options, timeout = api.get_request_info(path_roster)
{url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_roster)}
end
def get_season_stats(year = Date.today.year)
- data = api.get_data(path_season_stats(year))
+ data = api.get_data(path_season_stats(year)).to_h
ingest_season_stats(data)
end
def ingest_season_stats(data)
parse_season_stats(data)
end
- def queue_season_stats
- url, headers, options, timeout = api.get_request_info(path_season_stats)
+ def queue_season_stats(year = Date.today.year)
+ url, headers, options, timeout = api.get_request_info(path_season_stats(year))
{url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_season_stats)}
end
# url path helpers
def path_base