No release in over a year
Client for AniLibria API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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('wrong@example.com', 'WrongPassword')
# => nil

# session = anilibria.auth!('wrong@example.com', 'WrongPassword')
# raises an error Anilibria::Api::Exceptions::AuthError

session = anilibria.auth('correct@example.com', '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.