class Mangadex::Api::VersionChecker

Public Class Methods

check_mangadex_version() click to toggle source
# File lib/mangadex/api/version_checker.rb, line 10
def self.check_mangadex_version
  puts("Checking Mangadex's latest API version...")
  version = Psych.load(
    RestClient.get(
      'https://api.mangadex.org/api.yaml',
    ).body,
  ).dig('info', 'version')

  if version != Mangadex::Version::STRING
    warn(
      "[Warning] This gem is compatible with #{Mangadex::Version::STRING} but it looks like Mangadex is at #{version}",
      "[Warning] Check out #{Mangadex.configuration.mangadex_url} for more information.",
    )
  end

  version
rescue => error
  nil
end