class Mangadex::Chapter

Public Class Methods

attributes_to_inspect() click to toggle source
# File lib/mangadex/chapter.rb, line 84
def self.attributes_to_inspect
  [:id, :type, :title, :volume, :chapter, :pages, :publish_at]
end
delete(id) click to toggle source
# 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) click to toggle source
# 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] },
    }),
  )
end
Also aliased as: view
list(**args) click to toggle source
# 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) click to toggle source
# 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] },
      version: { accepts: Integer, required: true },
    }),
  )
end
view(id, **args)
Alias for: get

Public Instance Methods

page_urls(data_saver: true) click to toggle source
# File lib/mangadex/chapter.rb, line 80
def page_urls(data_saver: true)
  Mangadex::AtHome.page_urls(id, data_saver: data_saver)
end
title() click to toggle source
# File lib/mangadex/chapter.rb, line 75
def title
  attributes&.title.presence || chapter.presence && "Chapter #{chapter}" || "N/A"
end