Class: Verquest::Configuration
- Inherits:
-
Object
- Object
- Verquest::Configuration
- Defined in:
- lib/verquest/configuration.rb
Overview
Configuration for the Verquest gem
This class manages configuration settings for the Verquest gem, including validation behavior, JSON Schema version, and version resolution strategy. It’s used to customize the behavior of versioned API requests.
Instance Attribute Summary collapse
-
#current_version ⇒ #call
A callable object that returns the current API version to use when not explicitly specified.
-
#json_schema_version ⇒ Symbol
The JSON Schema draft version to use for validation and schema generation (see the json-schema gem).
-
#remove_extra_root_keys ⇒ Boolean
Controls if extra root keys not defined in the schema should be removed from the parameters.
-
#validate_params ⇒ Boolean
Controls whether parameters are automatically validated against the schema.
-
#validation_error_handling ⇒ Symbol
Controls how errors during parameter processing are handled.
-
#version_resolver ⇒ Object
Returns the value of attribute version_resolver.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initialize a new Configuration with default values.
Constructor Details
#initialize ⇒ Configuration
Initialize a new Configuration with default values
43 44 45 46 47 48 49 |
# File 'lib/verquest/configuration.rb', line 43 def initialize @validate_params = true @json_schema_version = :draft6 @validation_error_handling = :raise # or :result @remove_extra_root_keys = true @version_resolver = VersionResolver end |
Instance Attribute Details
#current_version ⇒ #call
A callable object that returns the current API version to use when not explicitly specified
38 39 40 |
# File 'lib/verquest/configuration.rb', line 38 def current_version @current_version end |
#json_schema_version ⇒ Symbol
The JSON Schema draft version to use for validation and schema generation (see the json-schema gem)
29 |
# File 'lib/verquest/configuration.rb', line 29 attr_accessor :validate_params, :json_schema_version, :validation_error_handling, :remove_extra_root_keys |
#remove_extra_root_keys ⇒ Boolean
Controls if extra root keys not defined in the schema should be removed from the parameters
29 |
# File 'lib/verquest/configuration.rb', line 29 attr_accessor :validate_params, :json_schema_version, :validation_error_handling, :remove_extra_root_keys |
#validate_params ⇒ Boolean
Controls whether parameters are automatically validated against the schema
29 30 31 |
# File 'lib/verquest/configuration.rb', line 29 def validate_params @validate_params end |
#validation_error_handling ⇒ Symbol
Controls how errors during parameter processing are handled
29 |
# File 'lib/verquest/configuration.rb', line 29 attr_accessor :validate_params, :json_schema_version, :validation_error_handling, :remove_extra_root_keys |
#version_resolver ⇒ Object
Returns the value of attribute version_resolver.
38 |
# File 'lib/verquest/configuration.rb', line 38 attr_reader :current_version, :version_resolver |