class HQTrivia::Me

The user themselves

Public Class Methods

new(key) click to toggle source

Get that user info! @param key [String] the key of the user

# File lib/hqtrivia/me.rb, line 5
def initialize(key)
  @key = key
  @data = JSON.parse(RestClient.get('https://api-quiz.hype.space/users/me', Authorization: key, 'x-hq-client': 'iOS/1.4.15 b146'))
end

Public Instance Methods

device_tokens() click to toggle source

@return [Array<String>] an array of this user's device tokens.

# File lib/hqtrivia/me.rb, line 11
def device_tokens
  @data['deviceTokens']
end
erasers() click to toggle source

@return [Integer] how many erasers you have

# File lib/hqtrivia/me.rb, line 64
def erasers
  @data['erase1s']
end
friend_ids() click to toggle source

@return [Array<Integer>] all of your friends. All. Of. Them. Max 50.

# File lib/hqtrivia/me.rb, line 48
def friend_ids
  @data['friendIds']
end
lives() click to toggle source

@return [Integer] how many lives you have

# File lib/hqtrivia/me.rb, line 27
def lives
  @data['lives']
end
phone?() click to toggle source

This is most likely always true, you need one to sign up! @return [true, false] if this user has a phone number.

# File lib/hqtrivia/me.rb, line 17
def phone?
  @data['hasPhone']
end
phone_number() click to toggle source

@return [String] your phone number

# File lib/hqtrivia/me.rb, line 22
def phone_number
  @data['phoneNumber']
end
point_multiplier_count() click to toggle source

Your point multipliers. 2x, 3x, 4x. @return [Hash<Integer, Integer>] your multipliers.

# File lib/hqtrivia/me.rb, line 75
def point_multiplier_count
  @data['pointsMultiplierCounts']
end
preferences() click to toggle source

Your HQ Preferences @return [Hash<String, Boolean>] your preferences

# File lib/hqtrivia/me.rb, line 43
def preferences
  @data['preferences']
end
referred?() click to toggle source

@return [true, false] if you have been referred by someone

# File lib/hqtrivia/me.rb, line 32
def referred?
  @data['referred']
end
referring_user_id() click to toggle source

@return [Integer] the user id of the person who referred you.

# File lib/hqtrivia/me.rb, line 37
def referring_user_id
  @data['referringUserId']
end
stk() click to toggle source

Base64 for a number between 1-4, this dicates the country you're from. This doesn't matter anymore, everyone is forced to be American.

# File lib/hqtrivia/me.rb, line 54
def stk
  @data['stk']
end
streak_info() click to toggle source

@return [StreakInfo] your streak info!

# File lib/hqtrivia/me.rb, line 59
def streak_info
  HQTrivia::User::StreakInfo.new(@data['streakInfo'])
end
super_spins() click to toggle source

@return [Integer] how many super spins you have

# File lib/hqtrivia/me.rb, line 69
def super_spins
  @data['items']['superSpins']
end