class RitoPlz::API::Tournament

Public Class Methods

new(region) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 7
def initialize(region)
  @region = region
end

Public Instance Methods

create_provider(params) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 33
def create_provider(params)
  params[:region] ||= @region
  request = Request.new(@region, api_path('/provider'))
  request.post(params)
end
create_tournament(params) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 39
def create_tournament(params)
  request = Request.new(@region, api_path('/tournament'))
  request.post(params)
end
generate_code(tournament_id, params) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 11
def generate_code(tournament_id, params)
  query_params = { tournamentId: tournament_id, count: params[:count] || 1 }
  params.delete(:count)
  request = Request.new(@region, api_path('/code'))
  request.post(params, query_params)
end
get_code_info(tournament_code) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 18
def get_code_info(tournament_code)
  request = Request.new(@region, api_path("/code/#{tournament_code}"))
  request.get
end
get_lobby_events(tournament_code) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 28
def get_lobby_events(tournament_code)
  request = Request.new(@region, api_path("/lobby/events/by-code/#{tournament_code}"))
  request.get
end
update_code_info(tournament_code, params) click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 23
def update_code_info(tournament_code, params)
  request = Request.new(@region, api_path("/code/#{tournament_code}"))
  request.put(params)
end

Protected Instance Methods

api_path(additional_path = "") click to toggle source
# File lib/RitoPlz/API/tournament.rb, line 46
def api_path(additional_path = "")
  "/tournament/public/v1" + additional_path
end