Class: Wanikani::SRS
- Inherits:
-
Object
- Object
- Wanikani::SRS
- Defined in:
- lib/wanikani/srs.rb
Constant Summary collapse
- ITEM_TYPES =
%w(apprentice guru master enlighten burned all)
Class Method Summary collapse
-
.distribution(item_type = "all") ⇒ Hash
Gets the counts for each SRS level and item types.
Class Method Details
.distribution(item_type = "all") ⇒ Hash
Gets the counts for each SRS level and item types.
10 11 12 13 14 15 16 17 18 |
# File 'lib/wanikani/srs.rb', line 10 def self.distribution(item_type = "all") raise ArgumentError, "Please use a valid SRS type (or none for all types)" if !ITEM_TYPES.include?(item_type) api_response = Wanikani.api_response("srs-distribution") srs_distribution = api_response["requested_information"] return srs_distribution if item_type == "all" return srs_distribution[item_type] end |