class Nexpose::Criterion

Individual search criterion.

Attributes

field[RW]

Search field. One of Nexpose::Search::Field @see Nexpose::Search::Field for any restrictions on the other attibutes.

operator[RW]
value[RW]

Search value. A search string or one of Nexpose::Search::Value

Public Class Methods

new(field, operator, value = '') click to toggle source
# File lib/nexpose/filter.rb, line 288
def initialize(field, operator, value = '')
  @field    = field.upcase
  @operator = operator.upcase
  if value.is_a? Array
    @value = value.map(&:to_s)
  else
    @value = value.to_s
  end
end
parse(json) click to toggle source
# File lib/nexpose/filter.rb, line 306
def self.parse(json)
  Criterion.new(json['metadata']['fieldName'],
                json['operator'],
                json['values'])
end

Public Instance Methods

to_h() click to toggle source

Convert this object into the map format expected by Nexpose.

# File lib/nexpose/filter.rb, line 300
def to_h
  { 'metadata' => { 'fieldName' => field },
    'operator' => operator,
    'values' => Array(value) }
end