Class: Mangadex::User
Instance Attribute Summary
#attributes, #id, #relationships, #type
Class Method Summary
collapse
#eq?, #hash, #initialize, #inspect
Class Method Details
.attributes_to_inspect ⇒ Object
99
100
101
|
# File 'lib/mangadex/user.rb', line 99
def self.attributes_to_inspect
[:username, :roles]
end
|
.followed_groups(**args) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mangadex/user.rb', line 19
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
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/mangadex/user.rb', line 72
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
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/mangadex/user.rb', line 32
def self.follows_group(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
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/mangadex/user.rb', line 85
def self.follows_manga(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
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/mangadex/user.rb', line 57
def self.follows_user(id)
return if Mangadex::Api::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
|