Class: PlaylyfeClient::V2::UnknownLeaderboard

Inherits:
Leaderboard show all
Defined in:
lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb

Instance Attribute Summary

Attributes inherited from Leaderboard

#cycles, #entity_type, #metric, #scope

Attributes inherited from Leaderboard

#game, #id, #name, #positions

Class Method Summary collapse

Methods inherited from Leaderboard

all, #results, #table

Class Method Details

.create_from(lbd_hash, game) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb', line 9

def self.create_from(lbd_hash, game)
  entity=lbd_hash[:entity_type] || lbd_hash["entity_type"]
  case entity
  when "players"
    return PlaylyfeClient::V2::PlayersLeaderboard.new(lbd_hash, game)
  when "teams"  
    return PlaylyfeClient::V2::TeamsLeaderboard.new(lbd_hash, game)
  else
    fail PlaylyfeClient::LeaderboardError.new("{\"error\": \"Unrecognized entity_type\", \"error_description\": \"Class for entity_type '#{entity}' from #{lbd_hash} is unrecognized!\"}")
  end
end