https://github.com/eltercero/saru
Wanikani SRS items fetcher
https://github.com/eltercero/saru
api-wrapper ruby wanikani
Last synced: about 1 year ago
JSON representation
Wanikani SRS items fetcher
- Host: GitHub
- URL: https://github.com/eltercero/saru
- Owner: eltercero
- License: mit
- Created: 2017-04-21T12:12:52.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T08:28:18.000Z (over 5 years ago)
- Last Synced: 2024-02-23T06:22:57.801Z (over 2 years ago)
- Topics: api-wrapper, ruby, wanikani
- Language: Ruby
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/eltercero/saru)
# Saru (猿)
Saru (猿) is a wrapper for the Wanikani API, but it is focused on the SRS system, including a lot of searching methods not available in the API. If you're looking for a complete Wanikani API wrapper, check out [dennmart's great gem](https://github.com/dennmart/wanikani-gem).
## Installation
To get the latest stable, add this to your Gemfile:
gem 'saru'
To get the latest code, add this:
gem 'saru', git: https://github.com/eltercero/saru
And then execute:
$ bundle
Or install it yourself as:
$ gem install saru
## Usage
### Setup
You'd need to add your API key before doing anything.
```ruby
require 'saru'
# You can also have them in your env => ENV["WANIKANI_API_KEY"]
Saru.setup do |config|
config.api_key = 'your_api_key'
end
```
### Request items using Wanikani API
```ruby
require 'saru'
# With Saru you can replicate the API behaviour.
# For instance, let's get all Kanjis for the first level with
# the user's specific information
> kanjis_1 = Saru.kanji 1
=> # first_kanji = kanjis_1.items.first
=> # kanjis_4_5 = Saru.kanji [4,5]
=> # Saru.vocabulary(20..25).unlocked_between(DateTime.parse('2017/01/01'), DateTime.parse('2017/02/01'))
=> # Saru.kanji(1..26).srs_is_not_burned.total_incorrect_larger_than(10)
=> # Saru.kanji(1..26).srs_is_not_burned.total_incorrect_larger_than(10).export_to_anki
Anki file generated in saru_deck_1704211620.txt
=> nil
```
### Available search methods
#### SRS
* List#srs_numeric_larger_than(number)
* List#srs_numeric_smaller_than(number)
* List#srs_in(states)
* List#srs_is_apprentice
* List#srs_is_guru
* List#srs_is_master
* List#srs_is_enlighten
* List#srs_is_burned
* List#srs_is_not_apprentice
* List#srs_is_not_guru
* List#srs_is_not_master
* List#srs_is_not_enlighten
* List#srs_is_not_burned
#### Unlocked date
* List#unlocked_after(date)
* List#unlocked_before(date)
* List#unlocked_between(start_date, end_date)
#### Available date
* List#available_after(date)
* List#available_before(date)
* List#available_between(start_date, end_date)
#### Incorrect counters
* List#meaning_incorrect_larger_than(number)
* List#meaning_incorrect_smaller_than(number)
* List#reading_incorrect_larger_than(number)
* List#reading_incorrect_smaller_than(number)
* List#total_incorrect_larger_than(number)
* List#total_incorrect_smaller_than(number)
#### Kanji Related (only for Kanji requests)
* List#onyomi_is(reading)
* List#kunyomi_is(reading)
* List#important_reading_is(reading)
## Contributing
What? Really? So nice of you for considering, you are the best.
I could really use a hand adding more modules for Saru::List so it could be more helpful. Right now there are many radical/kanji/vocabulary attributes without a search method.
1. Fork it ( http://github.com/eltercero/saru/fork )
2. Create your feature branch (`git checkout -b missing_features`)
3. Commit your changes (`git commit -am 'いいといいですね!'`). Don't forget to add a spec!
4. Push to the branch (`git push origin missing_features`)
5. Create new Pull Request
## License
Released under the [MIT License](http://opensource.org/licenses/MIT).