Class: OData::Query::Criteria

Inherits:
Object
  • Object
show all
Defined in:
lib/odata/query/criteria.rb

Overview

Represents a discreet detail about an OData query. It also validates the criteria based on what the gem knows how to support.

Constant Summary collapse

REQUIRED_OPTIONS =

Defines the options required to create a new OData::Query::Criteria.

[:operation, :argument]
SUPPORTED_OPERATIONS =

Defines the operations the OData gem knows how to support.

[
  :filter, :order_by, :skip, :top, :select, :expand, :inline_count
]

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Criteria

Creates a new OData::Query::Criteria with the supplied options.

Parameters:

  • options (Hash) (defaults to: {})


16
17
18
19
20
# File 'lib/odata/query/criteria.rb', line 16

def initialize(options = {})
  @options = process_options(options)
  validate_required_options
  validate_supported_operation
end

Instance Method Details

#argumentString

The query argument of a particular criteria.

Returns:

  • (String)


30
31
32
# File 'lib/odata/query/criteria.rb', line 30

def argument
  options[:argument]
end

#operationSymbol

The query operation of a particular criteria.

Returns:

  • (Symbol)


24
25
26
# File 'lib/odata/query/criteria.rb', line 24

def operation
  options[:operation]
end