Class: Mangadex::ScanlationGroup

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

Instance Attribute Summary

Attributes included from Internal::WithAttributes

#attributes, #id, #relationships, #type

Class Method Summary collapse

Methods inherited from MangadexObject

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

Constructor Details

This class inherits a constructor from Mangadex::MangadexObject

Class Method Details

.create(**args) ⇒ Object



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

def create(**args)
  Mangadex::Internal::Request.post(
    '/group',
    payload: Mangadex::Internal::Definition.validate(args, {
      name: { accepts: String, required: true },
      website: { accepts: String },
      irc_server: { accepts: String },
      irc_channel: { accepts: String },
      discord: { accepts: String },
      contact_email: { accepts: String },
      description: { accepts: String },
    }),
  )
end

.delete(id) ⇒ Object



75
76
77
78
79
# File 'lib/mangadex/scanlation_group.rb', line 75

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

.follow(id) ⇒ Object



81
82
83
84
85
# File 'lib/mangadex/scanlation_group.rb', line 81

def follow(id)
  Mangadex::Internal::Request.post(
    '/group/%{id}/follow' % {id: id},
  )
end

.inspect_attributesObject



94
95
96
# File 'lib/mangadex/scanlation_group.rb', line 94

def self.inspect_attributes
  self.attributes - [:version, :created_at, :updated_at]
end

.list(**args) ⇒ Object



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

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

.unfollow(id) ⇒ Object



87
88
89
90
91
# File 'lib/mangadex/scanlation_group.rb', line 87

def unfollow(id)
  Mangadex::Internal::Request.delete(
    '/group/%{id}/follow' % {id: id},
  )
end

.update(id, **args) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mangadex/scanlation_group.rb', line 58

def update(id, **args)
  Mangadex::Internal::Request.put(
    '/group/%{id}' % {id: id},
    payload: Mangadex::Internal::Definition.validate(args, {
      name: { accepts: String },
      website: { accepts: String },
      irc_server: { accepts: String },
      irc_channel: { accepts: String },
      discord: { accepts: String },
      contact_email: { accepts: String },
      description: { accepts: String },
      locked: { accepts: [true, false] },
      version: { accepts: Integer, required: true },
    }),
  )
end

.view(id) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/mangadex/scanlation_group.rb', line 49

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