Class: Jikanrb::Resources::MangaResource

Inherits:
BaseResource show all
Defined in:
lib/jikanrb/resources/manga_resource.rb

Overview

Resource class for accessing Manga sub-resources from the Jikan API. Provides fluent API access to manga details, characters, news, forum topics, pictures, statistics, and more.

Examples:

Basic usage

client = Jikanrb::Client.new
manga = client.manga(1)
manga.info                   # GET /manga/1
manga.info(full: true)       # GET /manga/1/full
manga.characters             # GET /manga/1/characters

See Also:

Instance Attribute Summary

Attributes inherited from BaseResource

#id

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from Jikanrb::Resources::BaseResource

Instance Method Details

#charactersHash

Returns characters for this manga

Examples:

client.manga(1).characters
# => { data: [{ character: { mal_id: 1, name: "Kenzou Tenma" }, role: "Main" }, ...] }

Returns:

  • (Hash)

    List of characters as IndifferentHash



43
44
45
# File 'lib/jikanrb/resources/manga_resource.rb', line 43

def characters
  get("manga/#{@id}/characters")
end

#externalHash

Returns external links for this manga

Examples:

client.manga(1).external
# => { data: [{ name: "Official Site", url: "https://..." }, ...] }

Returns:

  • (Hash)

    List of external links as IndifferentHash



120
121
122
# File 'lib/jikanrb/resources/manga_resource.rb', line 120

def external
  get("manga/#{@id}/external")
end

#forumHash

Returns forum topics related to this manga

Examples:

client.manga(1).forum
# => { data: [{ mal_id: 1, title: "...", date: "...", author_username: "..." }, ...] }

Returns:

  • (Hash)

    List of forum topics as IndifferentHash



65
66
67
# File 'lib/jikanrb/resources/manga_resource.rb', line 65

def forum
  get("manga/#{@id}/forum")
end

#info(full: false) ⇒ Hash

Returns manga details

Examples:

Get basic info

client.manga(1).info
# => { data: { mal_id: 1, title: "Monster", ... } }

Get full info

client.manga(1).info(full: true)
# => { data: { mal_id: 1, title: "...", relations: [...], external: [...] } }

Parameters:

  • full (Boolean) (defaults to: false)

    If true, returns extended information including relations, external links, etc.

Returns:

  • (Hash)

    Manga data as IndifferentHash



31
32
33
34
# File 'lib/jikanrb/resources/manga_resource.rb', line 31

def info(full: false)
  path = full ? "manga/#{@id}/full" : "manga/#{@id}"
  get(path)
end

#newsHash

Returns news articles related to this manga

Examples:

client.manga(1).news
# => { data: [{ mal_id: 1, title: "...", date: "...", author_username: "..." }, ...] }

Returns:

  • (Hash)

    List of news articles as IndifferentHash



54
55
56
# File 'lib/jikanrb/resources/manga_resource.rb', line 54

def news
  get("manga/#{@id}/news")
end

#picturesHash

Returns pictures of this manga

Examples:

client.manga(1).pictures
# => { data: [{ jpg: { image_url: "https://..." }, webp: { ... } }, ...] }

Returns:

  • (Hash)

    List of pictures as IndifferentHash



76
77
78
# File 'lib/jikanrb/resources/manga_resource.rb', line 76

def pictures
  get("manga/#{@id}/pictures")
end

#recommendationsHash

Returns user recommendations for this manga

Examples:

client.manga(1).recommendations
# => { data: [{ entry: { mal_id: 5, title: "..." }, votes: 123 }, ...] }

Returns:

  • (Hash)

    List of recommendations as IndifferentHash



98
99
100
# File 'lib/jikanrb/resources/manga_resource.rb', line 98

def recommendations
  get("manga/#{@id}/recommendations")
end

#relationsHash

Returns related anime/manga entries

Examples:

client.manga(1).relations
# => { data: [{ relation: "Adaptation", entry: [{ mal_id: 19, type: "anime", name: "..." }] }, ...] }

Returns:

  • (Hash)

    List of relations as IndifferentHash



109
110
111
# File 'lib/jikanrb/resources/manga_resource.rb', line 109

def relations
  get("manga/#{@id}/relations")
end

#statisticsHash

Returns statistics for this manga

Examples:

client.manga(1).statistics
# => { data: { reading: 12345, completed: 67890, on_hold: 1234, ... } }

Returns:

  • (Hash)

    Statistics data as IndifferentHash



87
88
89
# File 'lib/jikanrb/resources/manga_resource.rb', line 87

def statistics
  get("manga/#{@id}/statistics")
end