Sha256: 3178fccb8b388261b9ab89268931089595c9e5f318ad80d7f37f7eee5a146eb8

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
strutta-api-1.0.2 lib/strutta-api/entries.rb
strutta-api-1.0.1 lib/strutta-api/entries.rb