Project

Anilistrb

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A simple API wrapper for AniList's GraphQL API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.17
~> 10.0
~> 3.0

Runtime

>= 0.13.7
>= 2.2
 Project Readme

Anilistrb

pipeline status Gem Version Gem GitHub GitHub repo size in bytes

A simple API wrapper for AniList's GraphQL APIv2

This is a small side project for a practical introduction to both Ruby and GraphQL, so its not perfect

Also learned some of the basics of Rubocop, Rspec, Rake, Ruby metaprogramming, and publishing a ruby gem

Installation

Usage

require 'Anilistrb/Client'

client = Anilistrb::Client.new
anime = client.search_anime('Konosuba')
puts anime
# [ANIME] 21202 - {
#  "romaji"=>"Kono Subarashii Sekai ni Shukufuku wo!", 
#  "english"=>"KONOSUBA -God's blessing on this wonderful world!",
#  "native"=>"この素晴らしい世界に祝福を!" }

p anime.attributes # ["id", "title", "type", "format", "status", "description", "start_date", "end_date", "season", ... ]

puts anime.data # Raw request data as a hash

user = client.search_user('barrettotte') 
puts user # [USER] 247578 - barrettotte

list = client.get_animelist(247578)
puts list
# ANIME list for [USER] 247578 - barrettotte
#       Completed: 244   item(s)
#       Current:   9     item(s)
#       Dropped:   1     item(s)
#       Paused:    0     item(s)
#       Planning:  284   item(s)
#       Repeating: 0     item(s)

Note: Media, MediaList, and User objects extend from AnilistObj which is an object with properies dynamically built from the fields returned from a GraphQL query results. To easily get a list of a child's properties: call some_obj.attributes

  • get_anime(id)
  • get_manga(id)
  • get_animelist(userId)
  • get_mangalist(userId)
  • search_anime(search)
  • search_manga(search)
  • search_anime_paged(search, perPage, page)
  • search_manga_paged(search, perPage, page)
  • search_user(search)
  • gql_request(query string, variables struct)

Development

  • bundle install to install dependencies
  • rake spec run tests
  • bundle exec rake install install locally

Building/Publishing

  • commit + push all changes, increment version in ./lib/Anilistrb/version.rb
  • gem build Anilistrb.gemspec && gem push Anilistrb-x.x.x.gem

Sources