class Strutta::Participants

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

Public Class Methods

new(id = nil, game) click to toggle source

Initializes the Strutta::Participants object

@param id [Integer, nil] Entry id @param game [Strutta::Games] Master Strutta::Games object @return [Strutta::Participants] instantiated Strutta::Participants object

# File lib/strutta-api/participants.rb, line 10
def initialize(id = nil, game)
  @id = id
  @game = game
  @root_path = "participants/#{@id}"
  @no_id_error = Errors::PARTICIPANT_ID_REQUIRED
end

Public Instance Methods

permissions(params = {}) click to toggle source

GET participant permissions games/:game_id/participants/:id/permissions

@return [Hash] Parsed body of the API response

# File lib/strutta-api/participants.rb, line 40
def permissions(params = {})
  participant_id_required
  @game.get(params, "participants/#{@id}/permissions")
end
permissions_update(params = {}) click to toggle source

PATCH participant permissions games/:game_id/participants/:id/permissions

@return [Hash] Parsed body of the API response

# File lib/strutta-api/participants.rb, line 49
def permissions_update(params = {})
  participant_id_required
  @game.update(params, "participants/#{@id}/permissions")
end
token_renew(params = {}) click to toggle source

PATCH update Participant token games/:game_id/participants/:id/token

@return [Hash] Parsed body of the API response

# File lib/strutta-api/participants.rb, line 31
def token_renew(params = {})
  participant_id_required
  @game.update(params, "participants/#{@id}/token")
end

Private Instance Methods

participant_id_required() click to toggle source
# File lib/strutta-api/participants.rb, line 56
def participant_id_required
  @game.verify_id(@id, Errors::PARTICIPANT_ID_REQUIRED)
end