Sha256: 01177c27ff669beb1b96407b8bfa2f7e6294cc41cfef7fcc558d71275f9cbbb8
Contents?: true
Size: 1022 Bytes
Versions: 7
Compression:
Stored size: 1022 Bytes
Contents
require_relative "../leaderboard.rb" module PlaylyfeClient module V2 class TeamsLeaderboard < PlaylyfeClient::V2::Leaderboard private def fill_positions(data) #preproces data into new_data new_data=[] data.each do |pos| rank=(pos[:rank] || pos["rank"]).to_i score=pos[:score] || pos["score"] entity= pos[:team] || pos["team"] team=game.teams.find(entity[:id] || entity["id"]) #all teams should be listed in game, so if nothing is found raise exception if team.nil? fail PlaylyfeClient::LeaderboardError.new("{\"error\": \"Team not found\", \"error_description\": \"Team '#{entity[:id] || entity["id"]}' from '#{self.name}'[#{self.id}] leaderboard was not found between game.teams!\"}") end new_data << {rank: rank, entity: team, score: score} end super(new_data) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems