Class: Mangadex::Chapter
Instance Attribute Summary
#attributes, #id, #related_type, #relationships, #type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Concern
#append_features, #class_methods, extended, #included, #prepend_features, #prepended
#eq?, #hash, #initialize, #inspect
Class Method Details
.attributes_to_inspect ⇒ Object
84
85
86
|
# File 'lib/mangadex/chapter.rb', line 84
def self.attributes_to_inspect
[:id, :type, :title, :volume, :chapter, :pages, :publish_at]
end
|
.delete(id) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/mangadex/chapter.rb', line 62
def self.delete(id)
Mangadex::Internal::Definition.must(id)
Mangadex::Internal::Request.delete(
'/chapter/%{id}' % {id: id},
)
end
|
.get(id, **args) ⇒ Object
Also known as:
view
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/mangadex/chapter.rb', line 33
def self.get(id, **args)
Mangadex::Internal::Definition.must(id)
Mangadex::Internal::Request.get(
'/chapter/%{id}' % {id: id},
Mangadex::Internal::Definition.validate(args, {
includes: { accepts: [String], converts: :to_a },
}),
)
end
|
.list(**args) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/mangadex/chapter.rb', line 24
def self.list(**args)
Mangadex::Internal::Request.get(
'/chapter',
Mangadex::Internal::Definition.chapter_list(args),
content_rating: true,
)
end
|
.update(id, **args) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/mangadex/chapter.rb', line 45
def self.update(id, **args)
Mangadex::Internal::Definition.must(id)
Mangadex::Internal::Request.put(
'/chapter/%{id}' % {id: id},
payload: Mangadex::Internal::Definition.validate(args, {
title: { accepts: String },
volume: { accepts: String },
chapter: { accepts: String },
translated_language: { accepts: %r{^[a-zA-Z\-]{2,5}$} },
groups: { accepts: [String], converts: :to_a },
version: { accepts: Integer, required: true },
}),
)
end
|
Instance Method Details
#page_urls(data_saver: true) ⇒ Object
80
81
82
|
# File 'lib/mangadex/chapter.rb', line 80
def page_urls(data_saver: true)
Mangadex::AtHome.page_urls(id, data_saver: data_saver)
end
|
75
76
77
|
# File 'lib/mangadex/chapter.rb', line 75
def title
attributes&.title.presence || chapter.presence && "Chapter #{chapter}" || "N/A"
end
|