# frozen_string_literal: true module EvilMartiansAPI class Config < Anyway::Config REQUIRED_ATTRIBUTES = %i[access_token].freeze # Load config from `config/evil_martians_api.yml` and `EVIL_MARTIANS_API_*` env variables. config_name :evil_martians_api # @!attribute api_endpoint # @return [String] Base URL for accessing Evil Martians API attr_config api_endpoint: "https://evilmartians.com/" # @!attribute access_token # @return [String] Token for accessing Evil Martians API attr_config :access_token # @!attribute open_timeout # @return [Integer] Connection establishment waiting time, in seconds attr_config open_timeout: 2 # @!attribute read_timeout # @return [Integer] Response reading waiting time, in seconds attr_config read_timeout: 5 # @!attribute user_agent # @return [String] User-Agent for debugging purposes attr_config user_agent: "evil_martians_api_client" # @!attribute logger # @return [Logger] Logging facility attr_config :logger # @!attribute max_retries # @return [Integer] Number of attempts to retry the request attr_config max_retries: 3 # @!attribute retry_interval # @return [Integer] Delay in seconds between retry attempts attr_config retry_interval: 1 # @!attribute retry_backoff_factor # @return [Integer] Delay in seconds between retry attempts increase factor attr_config retry_backoff_factor: 1 # @!attribute retriable_errors # @return [StandardError] Errors that require request retry attr_config retriable_errors: [Errors::ConnectionError, Errors::ServerError] end end