A class containing a series of accessors that describe allowed parameters in a “list” call for a service implementation. The middleware uses this validate incoming query strings for lists and reject requests that ask for unsupported things. When instantiated the class sets itself up with defaults that match those described by the your platform's API. When passed to a Hoodoo::Services::Interface::ToListDSL instance, the DSL methods, if called, update the values stored herein.

Methods
D
N
Attributes
[RW] default_sort_key

Default sort key.

[RW] do_not_filter

Array of prohibited framework filter keys as Strings; empty for none defined.

[RW] filter

Array of supported filter keys as Strings; empty for none defined.

[RW] limit

Limit value; an integer that limits page size in lists.

[RW] sort

Sort hash. Keys are supported sort fields, values are arrays of supported sort directions. The first array entry is the default sort order for the sort field.

Class Public methods
new()

Create an instance with default settings.

# File lib/hoodoo/services/services/interface.rb, line 77
def initialize

  # Remember, these are defaults for the "to_list" object of an
  # interface only. For interface-wide top level defaults, use the
  # embedded calls to the DSL in Interface::interface.

  @limit            = 50
  @sort             = { 'created_at' => Set.new( [ 'desc', 'asc' ] ) }
  @default_sort_key = 'created_at'
  @search           = []
  @do_not_search    = []
  @filter           = []
  @do_not_filter    = []
end
Instance Public methods
default_sort_direction()

Default sort direction.

# File lib/hoodoo/services/services/interface.rb, line 53
def default_sort_direction
  @sort[ default_sort_key() ].first
end