Sha256: bfac44ace8c35feeb5e644138abbd42454b2e96cab45e739e6f509bb47adb845

Contents?: true

Size: 789 Bytes

Versions: 14

Compression:

Stored size: 789 Bytes

Contents

# typed: true
require "psych"

module Mangadex
  module Api
    class VersionChecker
      extend T::Sig

      sig { returns(T.nilable(String)) }
      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
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mangadex-5.10.0 lib/mangadex/api/version_checker.rb
mangadex-5.9.0 lib/mangadex/api/version_checker.rb
mangadex-5.8.0 lib/mangadex/api/version_checker.rb
mangadex-5.7.5.3 lib/mangadex/api/version_checker.rb
mangadex-5.7.5.2 lib/mangadex/api/version_checker.rb
mangadex-5.7.5.1 lib/mangadex/api/version_checker.rb
mangadex-5.7.5 lib/mangadex/api/version_checker.rb
mangadex-5.5.8 lib/mangadex/api/version_checker.rb
mangadex-5.5.6 lib/mangadex/api/version_checker.rb
mangadex-5.4.16 lib/mangadex/api/version_checker.rb
mangadex-5.4.11.3 lib/mangadex/api/version_checker.rb
mangadex-5.4.11.2 lib/mangadex/api/version_checker.rb
mangadex-5.4.11.1 lib/mangadex/api/version_checker.rb
mangadex-5.4.11 lib/mangadex/api/version_checker.rb