Module: Shikimori::API::V1::Mangas

Included in:
Shikimori::API::V1
Defined in:
lib/shikimori/api/v1/mangas.rb

Overview

Methods for the Mangas API

Instance Method Summary collapse

Instance Method Details

#manga(id, headers: nil, **query) ⇒ Hash

Get an manga by id

Examples:

Get manga with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga(1) #=> { id: 1, ... }

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing Manga

See Also:



83
84
85
# File 'lib/shikimori/api/v1/mangas.rb', line 83

def manga(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s).url, headers: headers, query: query
end

Get an manga external links

Examples:

Get related external links for manga with id equal 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_external_links(1) #=> [{ id: 1, ... }, { id: nil, ... }]

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing manga’s extenal links

See Also:



184
185
186
# File 'lib/shikimori/api/v1/mangas.rb', line 184

def manga_external_links(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'external_links').url, headers: headers, query: query
end

#manga_franchise(id, headers: nil, **query) ⇒ Hash

Get an manga franchise

Examples:

Get manga franchise tree for manga with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_franchise(1) #=> { links: [{ id: 1, ... }], nodes: [{ id: 1, ... }], current_id: 1 }

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing of manga’s franchise tree

See Also:



164
165
166
# File 'lib/shikimori/api/v1/mangas.rb', line 164

def manga_franchise(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'franchise').url, headers: headers, query: query
end

Get an related mangas

Examples:

Get a related anime, manga and ranobe titles for anime with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_related(1)
#=> [{ relation: "...", relation_russian: "...", anime: { id: 3, ... }, manga: { id: 1, ... } }]

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing related mangas

See Also:



144
145
146
# File 'lib/shikimori/api/v1/mangas.rb', line 144

def manga_related(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'related').url, headers: headers, query: query
end

#manga_roles(id, headers: nil, **query) ⇒ Hash

Get an manga roles

Examples:

Get a first manga roles

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_roles(1) #=> { roles: [...], roles_russian: [...], character: {...}, person: {...} }

Parameters:

  • id (#to_s)

    manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing manga roles

See Also:



103
104
105
# File 'lib/shikimori/api/v1/mangas.rb', line 103

def manga_roles(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'roles').url, headers: headers, query: query
end

#manga_similar(id, headers: nil, **query) ⇒ Array<Hash>

Get an manga similar

Examples:

Get a similar manga titles for manga with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_similar(1) #=> { id: 2, ... }

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing similar mangas

See Also:



123
124
125
# File 'lib/shikimori/api/v1/mangas.rb', line 123

def manga_similar(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'similar').url, headers: headers, query: query
end

#manga_topics(id, headers: nil, **query) ⇒ Array<Hash>

Get an manga topics

Examples:

Get topics for manga with id equal 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.manga_topics(1) #=> [{ id: 1, ... }]

Parameters:

  • id (#to_s)

    Manga id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Options Hash (**query):

  • :page (Integer)

    Number of page. Must be between 1 and 100000

  • :limit (Integer)

    Number of titles per page. Must be a lower or equal that 50

Returns:

  • (Array<Hash>)

    Array of hashes representing manga’s topics

See Also:



205
206
207
# File 'lib/shikimori/api/v1/mangas.rb', line 205

def manga_topics(id, headers: nil, **query)
  rest.get base_url.join('mangas', id.to_s, 'topics').url, headers: headers, query: query
end

#mangas(headers: nil, **query) ⇒ Array<Hash>

Get list of manga titles

Examples:

Get 20 manga titles on second page

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.mangas(page: 2, limit: 20) #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Get top 50 ongoing manga titles

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.mangas(limit: 50, status: 'ongoing', order: 'ranked') #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Get 10 random manga titles released in the 90s

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.mangas(limit: 10, order: 'random', season: '199x') #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Parameters:

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Filters and pagination for mangas

Options Hash (**query):

  • :page (Integer)

    Number of page. Must be between 1 and 100000

  • :limit (Integer)

    Number of titles per page. Must be a lower or equal that 50

  • :order ("id", "id_desc", "ranked", "chapters", "kind", "popularity", "name", "aired_on", "volumes", "status", "random", "ranked_random", "ranked_shiki", "created_at", "created_at_desc")

    Sorting type.

  • :type (String, Symbol)

    Type of title. Deprecated! use :kind instead

  • :kind ("manga", "manhwa", "manhua", "light_novel", "novel", "one_shot", "doujin")

    Type of manga title

  • :status ("anons", "ongoing", "released", "paused", "discontinued")

    Manga title status

  • :season (String)

    Manga season. Examples: “summer_2017”, “2016”, “2014_2016”, “199x”

  • :score (Integer)

    Minimal manga score

  • :genre (String)

    List of genre ids separated by comma

  • :genre_v2 (String)

    List of genre v2 ids separated by comma

  • :publisher (String)

    List of publisher ids separated by comma

  • :franchise (String)

    List of franchises separated by comma

  • :censored (TrueClass, FalseClass)

    Set to false to allow hentai, yaoi and yuri

  • :mylist ("planned", "watching", "rewatching", "completed", "on_hold", "dropped")

    Status of anime in current user list

  • :ids (String)

    List of anime ids separated by comma

  • :exclude_ids (String)

    List of anime ids separated by comma

  • :search (String)

    Search phrase to filter mangas by name

Returns:

  • (Array<Hash>)

    Array of hashes representing mangas

See Also:



63
64
65
# File 'lib/shikimori/api/v1/mangas.rb', line 63

def mangas(headers: nil, **query)
  rest.get base_url.join('mangas').url, headers: headers, query: query
end