Sha256: 817c5692d69f37a3f27dba4793811fecec3a0df26eb9c0bac47fb31792d5c0f3

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# typed: true
module Mangadex
  class ReportReason < MangadexObject
    has_attributes \
      :reason,
      :details_required,
      :category,
      :version

    class << self
      def list(category)
        args = Mangadex::Internal::Definition.validate({category: category}, {
          category: { accepts: %w(manga chapter scanlation_group user author), required: true },
        })

        Mangadex::Internal::Request.get(
          '/report/reasons/%{category}' % args,
        )
      end

      def create(**args)
        # TODO: create a "deprecated" log function
        puts("[DEPRECATED] Use Mangadex::Report.create(...) instead.")

        Mangadex::Internal::Request.post(
          '/report',
          payload: Mangadex::Internal::Definition.validate(args, {
            category: { accepts: %w(manga chapter scanlation_group user), required: true },
            reason: { accepts: String, required: true },
            object_id: { accepts: String, required: true },
            details: { accepts: String },
          }),
        )
      end
    end

    def self.attributes_to_inspect
      self.attributes
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mangadex-5.10.0 lib/mangadex/report_reason.rb
mangadex-5.9.0 lib/mangadex/report_reason.rb
mangadex-5.8.0 lib/mangadex/report_reason.rb
mangadex-5.7.5.3 lib/mangadex/report_reason.rb
mangadex-5.7.5.2 lib/mangadex/report_reason.rb
mangadex-5.7.5.1 lib/mangadex/report_reason.rb
mangadex-5.7.5 lib/mangadex/report_reason.rb