Sha256: 206e4cd2e473c56195f38b22b4236c89afc97f0169b895063a9b2aa2cbf8f9ac

Contents?: true

Size: 809 Bytes

Versions: 10

Compression:

Stored size: 809 Bytes

Contents

require_relative "../leaderboard.rb"
require_relative "./players_leaderboard.rb"
require_relative "./teams_leaderboard.rb"

module PlaylyfeClient
  module V2
    class UnknownLeaderboard < PlaylyfeClient::V2::Leaderboard

      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              

    end
  end
end  

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
playlyfe_client-1.1.6 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.1.5 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.1.3 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.1.2 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.1.1 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.1.0 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.0.6 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.0.5 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.0.4 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb
playlyfe_client-1.0.2 lib/playlyfe_client/v2/leaderboard/unknown_leaderboard.rb