Sha256: 4ae740d838f93a61c8475038adaf90896c5bac85bc202d5571d59e0f43224b43
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'readability_parser/version' module ReadabilityParser module Configuration VALID_CONNECTION_KEYS = [:api_endpoint, :user_agent].freeze VALID_OPTIONS_KEYS = [:api_token, :format].freeze VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS DEFAULT_API_ENDPOINT = "https://readability.com/api/content/v1/parser" DEFAULT_USER_AGENT = "ReadabilityParser Ruby Gem #{ReadabilityParser::VERSION}".freeze DEFAULT_API_TOKEN = nil DEFAULT_FORMAT = :json attr_accessor *VALID_CONFIG_KEYS def self.extended(base) base.reset end # Convenience method to allow configuration options to be set in a block def configure yield self end def options Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end def reset self.api_endpoint = DEFAULT_API_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.api_token = DEFAULT_API_TOKEN self.format = DEFAULT_FORMAT end end # Configuration end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
readability_parser-0.0.2 | lib/readability_parser/configuration.rb |
readability_parser-0.0.1 | lib/readability_parser/configuration.rb |