anilibria-api-ruby
Ruby wrapper for AniLibria API.
Installation
Add this line to your application's Gemfile:
gem 'anilibria-api-ruby'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install anilibria-api-ruby
Usage
Client
Usage example:
require 'anilibria/api'
anilibria = Anilibria::Api::Client.new
# => #<Anilibria::Api::Client:0x00007f25c52fc1b8 ...
anilibria.get_years
# => [1996, 1998, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, ...
title = anilibria.get_title(code: 'steinsgate')
# => #<Anilibria::Api::Types::Title id=8674 code="steinsgate" ...
title.names.en
# => "Steins;Gate"
anilibria
object implements AniLibria API methods as is. All methods are available in snake_case notation. Same with the title
object - it implements the Title specification.
Authorization
The gem supports authorization:
# session = anilibria.auth('[email protected]', 'WrongPassword')
# => nil
# session = anilibria.auth!('[email protected]', 'WrongPassword')
# raises an error Anilibria::Api::Exceptions::AuthError
session = anilibria.auth('[email protected]', 'CorrectPassword')
# => "VdZnNZRpEl9w2HcKNRyj1BWXLqdynpog"
anilibria.add_favorite(title_id: 9114, session: session)
# => true
titles = anilibria.get_favorites(filter: 'id,code,names,description', session: session)
# => [#<Anilibria::Api::Types::Title id=9114 code="shingeki-no-kyojin-the-final-season-part-2" ...
API Version
You can get the currently used version of AniLibria API:
anilibria.api_version
# => "2.13.10"
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/psychosocial88/anilibria-api-ruby.
License
The gem is available as open source under the terms of the MIT License.