Class: Wanikani::CriticalItems

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

Class Method Summary collapse

Class Method Details

.critical(percentage = 75) ⇒ Array

Gets the user’s current items under ‘Critical Items’.

Parameters:

  • percentage (Integer) (defaults to: 75)

    maximum percentage

Returns:

  • (Array)

    Returns hashes of critical items and their related information.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/wanikani/critical_items.rb', line 8

def self.critical(percentage = 75)
  raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
  api_response = Wanikani.api_response("critical-items", percentage)
  return api_response["requested_information"]
end

.full_response(percentage = 75) ⇒ Hash

Gets the full response of the Critical Items List API call.

Parameters:

  • percentage (Integer) (defaults to: 75)

    maximum percentage

Returns:

  • (Hash)

    Full response from the Critical Items List API call.

Raises:

  • (ArgumentError)


18
19
20
21
# File 'lib/wanikani/critical_items.rb', line 18

def self.full_response(percentage = 75)
  raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
  return Wanikani.api_response("critical-items", percentage)
end