Class: Mangadex::Author

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

Instance Attribute Summary

Attributes included from Internal::WithAttributes

#attributes, #id, #related_type, #relationships, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MangadexObject

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

Methods included from Concern

#append_features, #class_methods, extended, #included, #prepend_features, #prepended

Constructor Details

This class inherits a constructor from Mangadex::MangadexObject

Class Method Details

.create(**args) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/mangadex/author.rb', line 54

def self.create(**args)
  Mangadex::Internal::Request.post(
    '/author',
    payload: Mangadex::Internal::Definition.validate(args, {
      name: { accepts: String, required: true },
      version: { accepts: Integer },
    })
  )
end

.delete(id) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/mangadex/author.rb', line 106

def self.delete(id)
  Mangadex::Internal::Definition.must(id)

  Mangadex::Internal::Request.delete(
    format('/author/%{id}', id: id)
  )
end

.get(id, **args) ⇒ Object Also known as: view



70
71
72
73
74
75
76
77
78
79
# File 'lib/mangadex/author.rb', line 70

def self.get(id, **args)
  Mangadex::Internal::Definition.must(id)

  Mangadex::Internal::Request.get(
    format('/author/%{id}', id: id),
    Mangadex::Internal::Definition.validate(args, {
      includes: { accepts: [String] },
    })
  )
end

.inspect_attributesObject



114
115
116
# File 'lib/mangadex/author.rb', line 114

def self.inspect_attributes
  [:name]
end

.list(**args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mangadex/author.rb', line 34

def self.list(**args)
  Mangadex::Internal::Request.get(
    '/author',
    Mangadex::Internal::Definition.validate(args, {
      limit: { accepts: Integer },
      offset: { accepts: Integer },
      ids: { accepts: [String] },
      name: { accepts: String },
      order: { accepts: Hash },
      includes: { accepts: [String] },
    })
  )
end

.update(id, **args) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mangadex/author.rb', line 87

def self.update(id, **args)
  Mangadex::Internal::Definition.must(id)

  Mangadex::Internal::Request.put(
    format('/author/%{id}', id: id),
    payload: Mangadex::Internal::Definition.validate(args, {
      name: { accepts: String },
      version: { accepts: Integer, required: true },
    })
  )
end

Instance Method Details

#artist?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/mangadex/author.rb', line 126

def artist?
  false
end