Module: Wanikani::CriticalItems

Included in:
Client
Defined in:
lib/wanikani/critical_items.rb

Instance Method Summary collapse

Instance Method Details

#critical_items(percentage = 75) ⇒ Array<Hash>

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

Parameters:

  • percentage (Integer) (defaults to: 75)

    the maximum percentage of correctness.

Returns:

  • (Array<Hash>)

    critical items and their related information.

Raises:

  • (ArgumentError)


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

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

#full_critical_items_response(percentage = 75) ⇒ Hash

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

Parameters:

  • percentage (Integer) (defaults to: 75)

    the maximum percentage of correctness.

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 full_critical_items_response(percentage = 75)
  raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
  return api_response("critical-items", percentage)
end