class HQTrivia::User::Leaderboard

The User Leaderboard Class. A user's stats.

Public Class Methods

new(data) click to toggle source

@param data [JSON] the data. @!visibility private

# File lib/hqtrivia/user/leaderboard.rb, line 5
def initialize(data)
  @data = data
end

Public Instance Methods

alltime_rank() click to toggle source

This is only based on HQ Trivia I believe. Most likely accurate based on the information. @return [String] the all time ranking.

# File lib/hqtrivia/user/leaderboard.rb, line 50
def alltime_rank
  @data['alltime']['rank']
end
alltime_total() click to toggle source

This is only based on HQ Trivia I believe, and sometimes isn't even accurate! @return [String] the all time total.

# File lib/hqtrivia/user/leaderboard.rb, line 38
def alltime_total
  @data['alltime']['total']
end
alltime_wins() click to toggle source

This is only based on HQ Trivia I believe, and sometimes isn't even accurate! @return [String] the all time win count.

# File lib/hqtrivia/user/leaderboard.rb, line 44
def alltime_wins
  @data['alltime']['wins']
end
rank() click to toggle source

@return [Integer, nil] the rank of this user this week, nil if no rank

# File lib/hqtrivia/user/leaderboard.rb, line 30
def rank
  return nil if @data['rank'] == 101 && @data['wins'] == 0

  @data['rank']
end
total() click to toggle source

@return [String] the total earnings

# File lib/hqtrivia/user/leaderboard.rb, line 10
def total
  @data['total']
end
total_cents() click to toggle source

@return [Integer] the total earnings, in cents.

# File lib/hqtrivia/user/leaderboard.rb, line 15
def total_cents
  @data['totalCents']
end
unclaimed() click to toggle source

@return [String] the amount of unclaimed money!

# File lib/hqtrivia/user/leaderboard.rb, line 20
def unclaimed
  @data['unclaimed']
end
weekly_rank() click to toggle source

This is only based on HQ Trivia I believe. Most likely accurate based on the information. @return [String] the weekly ranking.

# File lib/hqtrivia/user/leaderboard.rb, line 68
def weekly_rank
  @data['weekly']['rank']
end
weekly_total() click to toggle source

This is only based on HQ Trivia I believe, and sometimes isn't even accurate! @return [String] the weekly total.

# File lib/hqtrivia/user/leaderboard.rb, line 56
def weekly_total
  @data['weekly']['total']
end
weekly_wins() click to toggle source

This is only based on HQ Trivia I believe, and sometimes isn't even accurate! @return [String] the weekly win count.

# File lib/hqtrivia/user/leaderboard.rb, line 62
def weekly_wins
  @data['weekly']['wins']
end
wins() click to toggle source

@return [Integer] the amount of wins on this week's leaderboard

# File lib/hqtrivia/user/leaderboard.rb, line 25
def wins
  @data['wins']
end