Class: Wanikani::User
- Inherits:
-
Object
- Object
- Wanikani::User
- Defined in:
- lib/wanikani/user.rb
Class Method Summary collapse
-
.full_response ⇒ Hash
Gets the full response of the User Information API call.
-
.gravatar_url(options = {}) ⇒ String
Returns the Gravatar image URL using the Gravatar hash from the user’s information.
-
.information ⇒ Hash
Gets the user information from WaniKani.
-
.on_vacation? ⇒ Boolean
Checks if the user is currently in vacation mode.
Class Method Details
.full_response ⇒ Hash
Gets the full response of the User Information API call.
39 40 41 |
# File 'lib/wanikani/user.rb', line 39 def self.full_response return Wanikani.api_response("user-information") end |
.gravatar_url(options = {}) ⇒ String
Returns the Gravatar image URL using the Gravatar hash from the user’s information.
27 28 29 30 31 32 33 34 |
# File 'lib/wanikani/user.rb', line 27 def self.gravatar_url( = {}) raise ArgumentError, "The size parameter must be an integer" if [:size] && ![:size].is_a?(Integer) api_response = Wanikani.api_response("user-information") hash = api_response["user_information"]["gravatar"] return nil if hash.nil? return build_gravatar_url(hash, ) end |
.information ⇒ Hash
Gets the user information from WaniKani.
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.
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 |