Class: FetcheableOnApi::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fetcheable_on_api/configuration.rb

Overview

Configuration class for FetcheableOnApi gem settings.

This class holds global configuration options that affect the behavior of filtering, sorting, and pagination across all controllers that use the FetcheableOnApi module.

Configuration is typically set in a Rails initializer file, but can also be modified at runtime if needed.

Examples:

Setting configuration in an initializer

# config/initializers/fetcheable_on_api.rb
FetcheableOnApi.configure do |config|
  config.pagination_default_size = 50
end

Runtime configuration changes

FetcheableOnApi.configuration.pagination_default_size = 100

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initialize configuration with default values. Sets up sensible defaults that work well for most applications.

Since:

  • 0.1.0



41
42
43
# File 'lib/fetcheable_on_api/configuration.rb', line 41

def initialize
  @pagination_default_size = 25
end

Instance Attribute Details

#pagination_default_sizeInteger

Default number of records per page when no page parameter is provided. This value is used by the Pageable module when clients don’t specify a page size in their requests.

Examples:

# With default configuration (25):
# GET /users?page[number]=2
# Returns 25 records starting from record 26

# With custom configuration (50):
# GET /users?page[number]=2
# Returns 50 records starting from record 51

Returns:

  • (Integer)

    The default pagination size

Since:

  • 0.1.0



37
38
39
# File 'lib/fetcheable_on_api/configuration.rb', line 37

def pagination_default_size
  @pagination_default_size
end