Sha256: e840436881e6ef868c599f6b621b67889e7a156009283d2a01d85230f5aefdb6

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 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::Internal::Request::BASE_URI} for more information.",
          )
        end

        version
      rescue => error
        nil
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mangadex-5.4.9 lib/mangadex/api/version_checker.rb
mangadex-5.3.3.4 lib/mangadex/api/version_checker.rb
mangadex-5.3.3.3 lib/mangadex/api/version_checker.rb
mangadex-5.3.3.2 lib/mangadex/api/version_checker.rb
mangadex-5.3.3.1 lib/mangadex/api/version_checker.rb