Class: MangaedenApi::Manga
- Inherits:
-
Object
- Object
- MangaedenApi::Manga
- Defined in:
- lib/mangaeden_api/manga.rb
Overview
Class containing all manga informations.
Instance Attribute Summary collapse
-
#aka ⇒ Object
Returns the value of attribute aka.
-
#aka_alias ⇒ Object
Returns the value of attribute aka_alias.
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#artist_kw ⇒ Object
Returns the value of attribute artist_kw.
-
#author ⇒ Object
Returns the value of attribute author.
-
#author_kw ⇒ Object
Returns the value of attribute author_kw.
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#chapters_info ⇒ Object
Returns the value of attribute chapters_info.
-
#chapters_len ⇒ Object
Returns the value of attribute chapters_len.
-
#created ⇒ Object
Returns the value of attribute created.
-
#description ⇒ Object
Returns the value of attribute description.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#image ⇒ Object
Returns the value of attribute image.
-
#language ⇒ Object
Returns the value of attribute language.
-
#last_chapter_date ⇒ Object
Returns the value of attribute last_chapter_date.
-
#manga_id ⇒ Object
Returns the value of attribute manga_id.
-
#random ⇒ Object
Returns the value of attribute random.
-
#released ⇒ Object
Returns the value of attribute released.
-
#starts_with ⇒ Object
Returns the value of attribute starts_with.
-
#status ⇒ Object
Returns the value of attribute status.
-
#title ⇒ Object
Returns the value of attribute title.
-
#title_kw ⇒ Object
Returns the value of attribute title_kw.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_keywords ⇒ Object
Returns the value of attribute updated_keywords.
Class Method Summary collapse
-
.search(title) ⇒ Object
Search for mangas with the specified title (case-insensitive) and return an array of manga objects.
Instance Method Summary collapse
-
#chapters ⇒ Object
Return Chapter objects.
-
#initialize(manga_info, manga_id = nil) ⇒ Manga
constructor
A new instance of Manga.
Constructor Details
#initialize(manga_info, manga_id = nil) ⇒ Manga
Returns a new instance of Manga.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mangaeden_api/manga.rb', line 10 def initialize(manga_info, manga_id = nil) @manga_id = manga_id @aka = manga_info['aka'] @aka_alias = manga_info['aka-alias'] @alias = manga_info['alias'] @artist = manga_info['artist'] @artist_kw = manga_info['artist_kw'] = manga_info['author'] = manga_info['author_kw'] @categories = manga_info['categories'] @chapters_len = manga_info['chapters_len'] @chapters_info = manga_info['chapters'] @created = manga_info['created'] @description = manga_info['description'] @hits = manga_info['hits'] @image = MangaedenApi::IMAGE_HOST + manga_info['image'] @language = manga_info['language'] @last_chapter_date = manga_info['last_chapter_date'] @random = manga_info['random'] @released = manga_info['release'] @starts_with = manga_info['startsWith'] @status = manga_info['status'] @title = manga_info['title'] @title_kw = manga_info['title_kw'] @type = manga_info['type'] @updated_keywords = manga_info['updatedKeywords'] end |
Instance Attribute Details
#aka ⇒ Object
Returns the value of attribute aka.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def aka @aka end |
#aka_alias ⇒ Object
Returns the value of attribute aka_alias.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def aka_alias @aka_alias end |
#alias ⇒ Object
Returns the value of attribute alias.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def alias @alias end |
#artist ⇒ Object
Returns the value of attribute artist.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def artist @artist end |
#artist_kw ⇒ Object
Returns the value of attribute artist_kw.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def artist_kw @artist_kw end |
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def end |
#author_kw ⇒ Object
Returns the value of attribute author_kw.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def end |
#categories ⇒ Object
Returns the value of attribute categories.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def categories @categories end |
#chapters_info ⇒ Object
Returns the value of attribute chapters_info.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def chapters_info @chapters_info end |
#chapters_len ⇒ Object
Returns the value of attribute chapters_len.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def chapters_len @chapters_len end |
#created ⇒ Object
Returns the value of attribute created.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def created @created end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def description @description end |
#hits ⇒ Object
Returns the value of attribute hits.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def hits @hits end |
#image ⇒ Object
Returns the value of attribute image.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def image @image end |
#language ⇒ Object
Returns the value of attribute language.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def language @language end |
#last_chapter_date ⇒ Object
Returns the value of attribute last_chapter_date.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def last_chapter_date @last_chapter_date end |
#manga_id ⇒ Object
Returns the value of attribute manga_id.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def manga_id @manga_id end |
#random ⇒ Object
Returns the value of attribute random.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def random @random end |
#released ⇒ Object
Returns the value of attribute released.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def released @released end |
#starts_with ⇒ Object
Returns the value of attribute starts_with.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def starts_with @starts_with end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def status @status end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def title @title end |
#title_kw ⇒ Object
Returns the value of attribute title_kw.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def title_kw @title_kw end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def type @type end |
#updated_keywords ⇒ Object
Returns the value of attribute updated_keywords.
4 5 6 |
# File 'lib/mangaeden_api/manga.rb', line 4 def updated_keywords @updated_keywords end |
Class Method Details
.search(title) ⇒ Object
Search for mangas with the specified title (case-insensitive) and return an array of manga objects
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mangaeden_api/manga.rb', line 40 def self.search(title) manga_list = MangaedenApi::Mangaeden.get_manga_list.select do |m| m['t'].downcase == title.downcase end mangas = [] manga_list.each do |m| mangas << MangaedenApi::Mangaeden.get_manga_info(m['i']) end mangas end |
Instance Method Details
#chapters ⇒ Object
Return Chapter objects
52 53 54 55 56 57 58 |
# File 'lib/mangaeden_api/manga.rb', line 52 def chapters chapters = [] @chapters_info.each do |c| chapters << MangaedenApi::Mangaeden.get_chapter_images(c) end chapters end |