Module: FetcheableOnApi
- Defined in:
- lib/fetcheable_on_api.rb,
lib/fetcheable_on_api/version.rb,
lib/fetcheable_on_api/pageable.rb,
lib/fetcheable_on_api/sortable.rb,
lib/fetcheable_on_api/filterable.rb,
lib/fetcheable_on_api/configuration.rb,
lib/generators/fetcheable_on_api/install_generator.rb
Overview
FetcheableOnApi provides standardized sorting, filtering and pagination for Rails API controllers following the JSONAPI specification.
This gem automatically adds support for query parameters like:
Defined Under Namespace
Modules: Filterable, Generators, Pageable, Sortable Classes: Configuration
Constant Summary collapse
- ArgumentError =
Raised when invalid parameters are provided to filtering, sorting, or pagination
Class.new(ArgumentError)
- NotImplementedError =
Raised when a feature is not yet implemented or supported
Class.new(NotImplementedError)
- VERSION =
Current version of the FetcheableOnApi gem. Follows semantic versioning (semver.org) principles.
'0.6.1'.freeze
Class Method Summary collapse
-
.configuration ⇒ Configuration
Global configuration settings for FetcheableOnApi.
-
.configure {|Configuration| ... } ⇒ Object
Configure FetcheableOnApi using a block.
-
.included(klass) ⇒ Object
Hook called when this module is included in a class.
Class Method Details
.configuration ⇒ Configuration
Global configuration settings for FetcheableOnApi. This method provides access to the singleton configuration instance that can be used to customize default behavior across the application.
56 57 58 |
# File 'lib/fetcheable_on_api.rb', line 56 def self.configuration @configuration ||= Configuration.new end |
.configure {|Configuration| ... } ⇒ Object
Configure FetcheableOnApi using a block. This is the recommended way to set up configuration in an initializer.
70 71 72 |
# File 'lib/fetcheable_on_api.rb', line 70 def self.configure yield(configuration) end |
.included(klass) ⇒ Object
Hook called when this module is included in a class. Automatically includes the three main concern modules that provide filtering, sorting, and pagination functionality.
94 95 96 97 98 99 100 |
# File 'lib/fetcheable_on_api.rb', line 94 def self.included(klass) klass.class_eval do include Filterable include Sortable include Pageable end end |