Coder Social home page Coder Social logo

rintaun / anilist-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from barrettotte/anilist-ruby

0.0 0.0 0.0 126 KB

A simple API wrapper gem for AniList's GraphQL API. https://rubygems.org/gems/Anilistrb

License: MIT License

Ruby 93.78% Shell 0.92% Python 2.55% Batchfile 2.13% Dockerfile 0.62%

anilist-ruby's Introduction

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

anilist-ruby's People

Contributors

barrettotte avatar rintaun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.