class Mangadex::User

Public Class Methods

attributes_to_inspect() click to toggle source
# File lib/mangadex/user.rb, line 106
def self.attributes_to_inspect
  [:username, :roles]
end
feed(**args) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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