lib/mangadex.rb in mangadex-5.3.3.1 vs lib/mangadex.rb in mangadex-5.3.3.2
- old
+ new
@@ -1,6 +1,6 @@
-# typed: strict
+# typed: true
require 'sorbet-runtime'
require 'active_support'
require_relative 'extensions'
@@ -12,24 +12,37 @@
require "mangadex/types"
# API, to interact with Mangadex
require "mangadex/api"
+# Persist strategies
+require "mangadex/storage"
+
+require_relative "config"
+require_relative "errors"
+
# Namespace for classes and modules for this gem.
# @since 5.3.0
module Mangadex
- # Standard error class for this gem.
- #
- # @author thedrummeraki
- # @since 0.6.0
- class Error < StandardError
- extend T::Sig
- end
+ class << self
+ def configuration
+ @configuration ||= Config.new
+ end
- class UserNotLoggedIn < Error
- sig { returns(String) }
- def message
- "You are not logged in. Use [Mangadex::Auth.login] to log in."
+ def context
+ @context ||= Internal::Context.new
+ end
+
+ def configure(&block)
+ yield(configuration)
+ end
+
+ def storage
+ configuration.storage
+ end
+
+ def api_version
+ context.version
end
end
end