{"id":19365216,"url":"https://github.com/eltercero/saru","last_synced_at":"2025-06-23T17:06:40.690Z","repository":{"id":56894282,"uuid":"88980271","full_name":"eltercero/saru","owner":"eltercero","description":"Wanikani SRS items fetcher","archived":false,"fork":false,"pushed_at":"2020-12-24T08:28:18.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-23T06:22:57.801Z","etag":null,"topics":["api-wrapper","ruby","wanikani"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eltercero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-21T12:12:52.000Z","updated_at":"2020-12-24T08:28:20.000Z","dependencies_parsed_at":"2022-08-20T16:10:47.534Z","dependency_job_id":null,"html_url":"https://github.com/eltercero/saru","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eltercero%2Fsaru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eltercero%2Fsaru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eltercero%2Fsaru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eltercero%2Fsaru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eltercero","download_url":"https://codeload.github.com/eltercero/saru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968737,"owners_count":21191159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","ruby","wanikani"],"created_at":"2024-11-10T07:39:27.261Z","updated_at":"2025-04-23T14:31:12.825Z","avatar_url":"https://github.com/eltercero.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/eltercero/saru.png)](https://travis-ci.org/eltercero/saru)\n\n# Saru (猿)\n\nSaru (猿) 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).\n\n## Installation\n\nTo get the latest stable, add this to your Gemfile:\n\n    gem 'saru'\n\nTo get the latest code, add this:\n\n    gem 'saru', git: https://github.com/eltercero/saru\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install saru\n\n## Usage\n\n### Setup\n\nYou'd need to add your API key before doing anything.\n\n```ruby\nrequire 'saru'\n\n# You can also have them in your env =\u003e ENV[\"WANIKANI_API_KEY\"]\nSaru.setup do |config|\n  config.api_key = 'your_api_key'\nend\n```\n\n### Request items using Wanikani API\n\n```ruby\nrequire 'saru'\n\n# With Saru you can replicate the API behaviour.\n# For instance, let's get all Kanjis for the first level with\n# the user's specific information\n\n\u003e kanjis_1 = Saru.kanji 1\n=\u003e #\u003cSaru::List:0x007f871a1defb8\n @items=\n  [#\u003cSaru::Kanji:0x007f8719bc34a8\n    @available_date=1472052600,\n    @burned=true,\n    @burned_date=1472057541,\n    @character=\"二\",\n    @important_reading=\"onyomi\"\n    ...\n\n\u003e first_kanji = kanjis_1.items.first\n=\u003e #\u003cSaru::Kanji:0x007fa2b5a1c430\n @available_date=1472052600,\n @burned=true,\n @burned_date=1472057541,\n @character=\"二\",\n @important_reading=\"onyomi\",\n @kunyomi=\"ふた\",\n @level=1,\n @meaning=\"two\",\n @meaning_correct=8\n ...\n\n# You can also request more than one level. For example:\n\u003e kanjis_4_5 = Saru.kanji [4,5]\n=\u003e #\u003cSaru::List:0x007f871a888df0\n @items=\n  [#\u003cSaru::Kanji:0x007f871a21c9f8\n    @available_date=1474518600,\n    @burned=true,\n    @burned_date=1474523699,\n    @character=\"花\",\n    @important_reading=\"kunyomi\",\n    @kunyomi=\"はな\"\n    ...\n```\n\n### Extended search\n\n**Note:** These methods are not supported by Wanikani API queries. This means they are done _after_ the request in Wanikani.\n\n```ruby\n\u003e Saru.vocabulary(20..25).unlocked_between(DateTime.parse('2017/01/01'), DateTime.parse('2017/02/01'))\n=\u003e #\u003cSaru::List:0x007f8719c4e698\n @items=\n  [#\u003cSaru::Vocabulary:0x007f8719cdeb30\n    @available_date=1501066800,\n    @burned=false,\n    @burned_date=0,\n    @character=\"崎\",\n    @kana=\"さき\",\n    @level=23,\n    @meaning=\"cape, small peninsula\"\n    ...\n\n# You can chain methods too.\n\n\u003e Saru.kanji(1..26).srs_is_not_burned.total_incorrect_larger_than(10)\n=\u003e #\u003cSaru::List:0x007f871a92e368\n @items=\n  [#\u003cSaru::Kanji:0x007f871a339778\n    @available_date=1500118200,\n    @burned=false,\n    @burned_date=0,\n    @character=\"組\",\n    @important_reading=\"onyomi\",\n    @kunyomi=\"くみ\"\n    ...\n```\n\n### Anki export\n\n```ruby\n# You can export any search to an anki deck, in case you need extra SRS\n\n\u003e Saru.kanji(1..26).srs_is_not_burned.total_incorrect_larger_than(10).export_to_anki\nAnki file generated in saru_deck_1704211620.txt\n=\u003e nil\n```\n\n### Available search methods\n\n#### SRS\n* List#srs_numeric_larger_than(number)\n* List#srs_numeric_smaller_than(number)\n* List#srs_in(states)\n* List#srs_is_apprentice\n* List#srs_is_guru\n* List#srs_is_master\n* List#srs_is_enlighten\n* List#srs_is_burned\n* List#srs_is_not_apprentice\n* List#srs_is_not_guru\n* List#srs_is_not_master\n* List#srs_is_not_enlighten\n* List#srs_is_not_burned\n\n#### Unlocked date\n* List#unlocked_after(date)\n* List#unlocked_before(date)\n* List#unlocked_between(start_date, end_date)\n\n#### Available date\n* List#available_after(date)\n* List#available_before(date)\n* List#available_between(start_date, end_date)\n\n#### Incorrect counters\n* List#meaning_incorrect_larger_than(number)\n* List#meaning_incorrect_smaller_than(number)\n* List#reading_incorrect_larger_than(number)\n* List#reading_incorrect_smaller_than(number)\n* List#total_incorrect_larger_than(number)\n* List#total_incorrect_smaller_than(number)\n\n#### Kanji Related (only for Kanji requests)\n* List#onyomi_is(reading)\n* List#kunyomi_is(reading)\n* List#important_reading_is(reading)\n\n## Contributing\n\nWhat? Really? So nice of you for considering, you are the best.\n\nI 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.\n\n1. Fork it ( http://github.com/eltercero/saru/fork )\n2. Create your feature branch (`git checkout -b missing_features`)\n3. Commit your changes (`git commit -am 'いいといいですね！'`). Don't forget to add a spec!\n4. Push to the branch (`git push origin missing_features`)\n5. Create new Pull Request\n\n## License\n\nReleased under the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feltercero%2Fsaru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feltercero%2Fsaru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feltercero%2Fsaru/lists"}