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
105
106
107
|
# File 'lib/mangadex/user.rb', line 105
def self.attributes_to_inspect
[:username, :roles]
end
|
.feed(**args) ⇒ Object
10
11
12
13
14
15
16
|
# 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),
auth: true,
)
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
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/mangadex/user.rb', line 76
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
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/mangadex/user.rb', line 47
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
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/mangadex/user.rb', line 32
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/mangadex/user.rb', line 89
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/mangadex/user.rb', line 59
def self.follows_user(id)
Mangadex::Internal::Definition.must(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
|