Class: Wanikani::User

Inherits:
Object
  • Object
show all
Defined in:
lib/wanikani/user.rb

Class Method Summary collapse

Class Method Details

.informationHash

Gets the user information from WaniKani.

Returns:

  • (Hash)

    The user information for the WaniKani account by from the API key.



7
8
9
10
# File 'lib/wanikani/user.rb', line 7

def self.information
  api_response = Wanikani.api_response("user-information")
  return api_response["user_information"]
end

.on_vacation?Boolean

Checks if the user is currently in vacation mode.

Returns:

  • (Boolean)

    true if vacation_date contains a timestamp, false if vacation_date is null.



16
17
18
19
20
# File 'lib/wanikani/user.rb', line 16

def self.on_vacation?
  api_response = Wanikani.api_response("user-information")
  vacation_date = api_response["user_information"]["vacation_date"]
  return !vacation_date.nil?
end