Class: Mangadex::User
- Inherits:
-
MangadexObject
- Object
- MangadexObject
- Mangadex::User
- Defined in:
- lib/mangadex/user.rb
Instance Attribute Summary
Attributes included from Internal::WithAttributes
#attributes, #id, #related_type, #relationships, #type
Class Method Summary collapse
- .attributes_to_inspect ⇒ Object
- .feed(**args) ⇒ Object
- .followed_groups(**args) ⇒ Object
- .followed_manga(**args) ⇒ Object
- .followed_users(**args) ⇒ Object
- .follows_group(id) ⇒ Object
- .follows_manga(id) ⇒ Object
- .follows_user(id) ⇒ Object
Methods inherited from MangadexObject
#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
.attributes_to_inspect ⇒ Object
106 107 108 |
# File 'lib/mangadex/user.rb', line 106 def self.attributes_to_inspect [:username, :roles] end |
.feed(**args) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/mangadex/user.rb', line 10 def self.feed(**args) Mangadex::Internal::Request.get( '/user/follows/manga/feed', Mangadex::Internal::Definition.chapter_list(args), content_rating: true, auth: true, ) end |
.followed_groups(**args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mangadex/user.rb', line 20 def self.followed_groups(**args) Mangadex::Internal::Request.get( '/user/follows/group', Mangadex::Internal::Definition.validate(args, { limit: { accepts: Integer }, offset: { accepts: Integer }, includes: { accepts: Array }, }), auth: true, ) end |
.followed_manga(**args) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/mangadex/user.rb', line 77 def self.followed_manga(**args) Mangadex::Internal::Request.get( '/user/follows/manga', Mangadex::Internal::Definition.validate(args, { limit: { accepts: Integer }, offset: { accepts: Integer }, includes: { accepts: Array }, }), auth: true, ) end |
.followed_users(**args) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/mangadex/user.rb', line 48 def self.followed_users(**args) Mangadex::Internal::Request.get( '/user/follows/user', Mangadex::Internal::Definition.validate(args, { limit: { accepts: Integer }, offset: { accepts: Integer }, }), auth: true, ) end |
.follows_group(id) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mangadex/user.rb', line 33 def self.follows_group(id) Mangadex::Internal::Definition.must(id) data = Mangadex::Internal::Request.get( '/user/follows/group/%{id}' % {id: id}, raw: true, auth: true, ) JSON.parse(data)['result'] == 'ok' rescue JSON::ParserError => error warn(error) false end |
.follows_manga(id) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/mangadex/user.rb', line 90 def self.follows_manga(id) Mangadex::Internal::Definition.must(id) return if Mangadex.context.user.nil? data = Mangadex::Internal::Request.get( '/user/follows/manga/%{id}' % {id: id}, raw: true, auth: true, ) JSON.parse(data)['result'] == 'ok' rescue JSON::ParserError => error warn(error) false end |
.follows_user(id) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mangadex/user.rb', line 60 def self.follows_user(id) Mangadex::Internal::Definition.must(id) return if Mangadex.context.user.nil? data = Mangadex::Internal::Request.get( '/user/follows/user/%{id}' % {id: id}, raw: true, auth: true, ) JSON.parse(data)['result'] == 'ok' rescue JSON::ParserError => error warn(error) false end |