Sha256: 5a6b5e77f50877e2aba939e0fa22dd17cbda3744c7fc5a4937b48f46c576a766

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

module Strutta
  # Entries belong to a Strutta::Games object
  # Instance methods found in Strutta::APIObject
  class Entries < APIObject
    # Initializes the Strutta::Entries object
    #
    # @param id [Integer, nil] Entry id
    # @param game [Strutta::Games] Master Strutta::Games object
    # @return [Strutta::Entries] instantiated Strutta::Entries object
    def initialize(id = nil, game)
      @id = id
      @game = game
      @root_path = "entries/#{@id}"
      @no_id_error = Errors::ENTRY_ID_REQUIRED
    end

    # GET transition history for Entry (no ID required)
    # games/:game_id/entries/:id/transitions
    #
    # @return [Hash] Parsed body of the API response
    def transitions(params = {})
      @game.verify_id(@id, Errors::ENTRY_ID_REQUIRED)
      @game.get(params, "entries/#{@id}/transitions")
    end

    # GET leaderboard history for Entries in Points Rounds (no ID required)
    # games/:game_id/entries/leaderboard
    #
    # @return [Hash] Parsed body of the API response
    def leaderboard(params = {})
      @game.verify_no_id(@id)
      @game.get(params, 'entries/leaderboard')
    end

    # GET on-demand winners from pool of active Entries (no ID required)
    # games/:game_id/entries/on-demand-winners
    #
    # @return [Hash] Parsed body of the API response
    def on_demand_winners(params = {})
      @game.verify_no_id(@id)
      @game.get(params, 'entries/on-demand-winners')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strutta-api-1.0.3.1 lib/strutta-api/entries.rb