Sha256: fd3b0ee24a8869854d9c3b37b8cb156a5295b6aea8d3a22f5aee3e025c43bec7

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

# typed: true
require "psych"

module Mangadex
  module Api
    class Version
      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

4 entries across 4 versions & 1 rubygems

Version Path
mangadex-5.3.3 lib/mangadex/api/version_checker.rb
mangadex-5.3.2 lib/mangadex/api/version_checker.rb
mangadex-5.3.1.3 lib/mangadex/api/version_checker.rb
mangadex-5.3.1.2 lib/mangadex/api/version_checker.rb