mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-05 04:15:35 -04:00
Include chapter information in MangaDex::Manga#to_info_json
output
This commit is contained in:
parent
fd342fe1ee
commit
676f2ae032
@ -142,13 +142,22 @@ module Mangadex
|
|||||||
def initialize(@id, json_obj : JSON::Any)
|
def initialize(@id, json_obj : JSON::Any)
|
||||||
self.parse_json json_obj
|
self.parse_json json_obj
|
||||||
end
|
end
|
||||||
def to_info_json
|
def to_info_json(with_chapters = true)
|
||||||
JSON.build do |json|
|
JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
{% for name in ["id", "title", "description",
|
{% for name in ["id", "title", "description",
|
||||||
"author", "artist", "cover_url"] %}
|
"author", "artist", "cover_url"] %}
|
||||||
json.field {{name}}, @{{name.id}}
|
json.field {{name}}, @{{name.id}}
|
||||||
{% end %}
|
{% end %}
|
||||||
|
if with_chapters
|
||||||
|
json.field "chapters" do
|
||||||
|
json.array do
|
||||||
|
@chapters.each do |c|
|
||||||
|
json.raw c.to_info_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user