Class: Html2rss::Config::Validator
- Inherits:
-
Dry::Validation::Contract
- Object
- Dry::Validation::Contract
- Html2rss::Config::Validator
- Defined in:
- lib/html2rss/config/validator.rb
Overview
Validates the configuration hash using Dry::Validation. The configuration options adhere to the documented schema in README.md.
Constant Summary collapse
- URI_REGEXP =
Url::URI_REGEXP
- STYLESHEET_TYPES =
RssBuilder::Stylesheet::TYPES
- LANGUAGE_FORMAT_REGEX =
/\A[a-z]{2}(-[A-Z]{2})?\z/- ChannelConfig =
Dry::Schema.Params do required(:url).filled(:string, format?: URI_REGEXP) optional(:title).maybe(:string) optional(:description).maybe(:string) optional(:language).maybe(:string, format?: LANGUAGE_FORMAT_REGEX) optional(:ttl).maybe(:integer, gt?: 0) optional(:time_zone).maybe(:string) end
- StylesheetConfig =
Dry::Schema.Params do required(:href).filled(:string) required(:type).filled(:string, included_in?: STYLESHEET_TYPES) optional(:media).maybe(:string) end
- BrowserlessPreloadClickSelectorConfig =
Dry::Schema.Params do required(:selector).filled(:string) optional(:max_clicks).filled(:integer, gt?: 0) optional(:wait_after_ms).filled(:integer, gteq?: 0) end
- BrowserlessPreloadScrollConfig =
Dry::Schema.Params do optional(:iterations).filled(:integer, gt?: 0) optional(:wait_after_ms).filled(:integer, gteq?: 0) end
- BrowserlessPreloadConfig =
Dry::Schema.Params do optional(:wait_after_ms).filled(:integer, gteq?: 0) optional(:click_selectors).array(BrowserlessPreloadClickSelectorConfig) optional(:scroll_down).hash(BrowserlessPreloadScrollConfig) end
- BrowserlessRequestConfig =
Dry::Schema.Params do optional(:preload).hash(BrowserlessPreloadConfig) end
- RequestConfig =
Dry::Schema.Params do optional(:max_redirects).filled(:integer, gteq?: 0) optional(:max_requests).filled(:integer, gt?: 0) optional(:browserless).hash(BrowserlessRequestConfig) end