Class: Mangadex::ReportReason

Inherits:
MangadexObject show all
Defined in:
lib/mangadex/report_reason.rb

Instance Attribute Summary

Attributes included from Internal::WithAttributes

#attributes, #id, #relationships, #type

Class Method Summary collapse

Methods inherited from MangadexObject

#eq?, #hash, #initialize, #inspect

Constructor Details

This class inherits a constructor from Mangadex::MangadexObject

Class Method Details

.attributes_to_inspectObject



34
35
36
# File 'lib/mangadex/report_reason.rb', line 34

def self.attributes_to_inspect
  self.attributes
end

.create(**args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mangadex/report_reason.rb', line 21

def create(**args)
  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

.list(category) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/mangadex/report_reason.rb', line 11

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

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