Class: Mangadex::User
Instance Attribute Summary
#attributes, #id, #related_type, #relationships, #type
Class Method Summary
collapse
#eq?, #hash, #initialize, #inspect
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
|
.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
.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::Api::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