Class: Strutta::Entries

Inherits:
APIObject show all
Defined in:
lib/strutta-api/entries.rb

Overview

Entries belong to a Strutta::Games object Instance methods found in Strutta::APIObject

Instance Attribute Summary

Attributes inherited from APIObject

#game

Instance Method Summary collapse

Methods inherited from APIObject

#all, #create, #delete, #get, #method_disabled, #update

Constructor Details

#initialize(id = nil, game) ⇒ Strutta::Entries

Initializes the Strutta::Entries object

Parameters:

  • id (Integer, nil) (defaults to: nil)

    Entry id

  • game (Strutta::Games)

    Master Strutta::Games object


10
11
12
13
14
15
# File 'lib/strutta-api/entries.rb', line 10

def initialize(id = nil, game)
  @id = id
  @game = game
  @root_path = "entries/#{@id}"
  @no_id_error = Errors::ENTRY_ID_REQUIRED
end

Instance Method Details

#leaderboard(params = {}) ⇒ Hash

GET leaderboard history for Entries in Points Rounds (no ID required) games/:game_id/entries/leaderboard

Returns:

  • (Hash)

    Parsed body of the API response


30
31
32
33
# File 'lib/strutta-api/entries.rb', line 30

def leaderboard(params = {})
  @game.verify_no_id(@id)
  @game.get(params, 'entries/leaderboard')
end

#transitions(params = {}) ⇒ Hash

GET transition history for Entry (no ID required) games/:game_id/entries/:id/transitions

Returns:

  • (Hash)

    Parsed body of the API response


21
22
23
24
# File 'lib/strutta-api/entries.rb', line 21

def transitions(params = {})
  @game.verify_id(@id, Errors::ENTRY_ID_REQUIRED)
  @game.get(params, "entries/#{@id}/transitions")
end