class HQTrivia::User::SeasonXP

The User SeasonXP Class. A user's season.

Public Class Methods

new(data) click to toggle source

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

# File lib/hqtrivia/user/seasonxp.rb, line 5
def initialize(data)
  @data = data[0]
end

Public Instance Methods

active?() click to toggle source

@return [true, false] if this season is active.

# File lib/hqtrivia/user/seasonxp.rb, line 25
def active?
  @data['active']
end
current_level() click to toggle source

@return [Integer] the current level this user is on.

# File lib/hqtrivia/user/seasonxp.rb, line 36
def current_level
  @data['currentLevel']['level']
end
current_level_range() click to toggle source

The range of the current level. This is returned as a range. Do current_level_range.min to find min Do current_level_range.max to find max @return [Range] the range of this level

# File lib/hqtrivia/user/seasonxp.rb, line 45
def current_level_range
  Range.new(@data['currentLevel']['minPoints'], @data['currentLevel']['maxPoints'])
end
current_points() click to toggle source

@return [Integer] the user's current points

# File lib/hqtrivia/user/seasonxp.rb, line 10
def current_points
  @data['currentPoints']
end
display() click to toggle source

@return [Hash<String, String>] the display, as shown in the app.

# File lib/hqtrivia/user/seasonxp.rb, line 50
def display
  @data['display']
end
name() click to toggle source

@return [String] the name of this season

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

General is HQ Trivia, Sports is HQ Sports, Words is HQ Words @return [Array<String>] what game modes contribute towards the points

# File lib/hqtrivia/user/seasonxp.rb, line 31
def participating_gamemodes
  @data['verticals']
end
referrals() click to toggle source

@return [Integer] the amount of referrals

# File lib/hqtrivia/user/seasonxp.rb, line 55
def referrals
  @data['quotas']['currentReferrals']
end
remaining_points() click to toggle source

@return [Integer] the points this user needs to level up

# File lib/hqtrivia/user/seasonxp.rb, line 15
def remaining_points
  @data['remainingPoints']
end
shares_to_facebook() click to toggle source

@return [Integer] the amount of shares to facebook

# File lib/hqtrivia/user/seasonxp.rb, line 60
def shares_to_facebook
  @data['quotas']['currentSharesToFacebook']
end
shares_to_twitter() click to toggle source

@return [Integer] the amount of shares to Twitter

# File lib/hqtrivia/user/seasonxp.rb, line 65
def shares_to_twitter
  @data['quotas']['currentSharesToTwitter']
end