class HQTrivia::User::StreakInfo

The User StreakInfo Class. A user's streak information.

Public Class Methods

new(data) click to toggle source

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

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

Public Instance Methods

current() click to toggle source

@return [Integer] the current streak duration

# File lib/hqtrivia/user/streakinfo.rb, line 25
def current
  @data['current']
end
id() click to toggle source

@return [Integer] the ID of this streak's user.

# File lib/hqtrivia/user/streakinfo.rb, line 10
def id
  @data['userId']
end
last_played() click to toggle source

@return [Time] when this user last played

# File lib/hqtrivia/user/streakinfo.rb, line 35
def last_played
  Time.parse(@data['lastPlayed'])
end
notify?() click to toggle source

@return [true, false] if the user should be notified

# File lib/hqtrivia/user/streakinfo.rb, line 40
def notify?
  @data['notify']
end
start_date() click to toggle source

@return [Time] the date this streak started

# File lib/hqtrivia/user/streakinfo.rb, line 20
def start_date
  Time.parse(@data['startDate'])
end
target() click to toggle source

@return [Integer] the target goals (in consecutive days)

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

@return [Integer] the total streak duration

# File lib/hqtrivia/user/streakinfo.rb, line 30
def total
  @data['total']
end