Class: Nexpose::DiscoveryConnection::Criterion

Inherits:
Criterion
  • Object
show all
Defined in:
lib/nexpose/discovery.rb

Overview

Override of filter criterion to account for proper JSON naming.

Instance Attribute Summary

Attributes inherited from Criterion

#field, #operator, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Criterion

#initialize, parse

Constructor Details

This class inherits a constructor from Nexpose::Criterion

Class Method Details

.parseHash(hash) ⇒ Criterion

Create a Criterion object from a JSON-derived Hash.

Parameters:

  • json (Hash)

    JSON-derived Hash of a Criterion object.

Returns:



257
258
259
260
261
# File 'lib/nexpose/discovery.rb', line 257

def self.parseHash(hash)
  Criterion.new(hash[:field_name],
                hash[:operator],
                hash[:values])
end

Instance Method Details

#to_hObject

Convert to Hash, which can be converted to JSON for API calls.



246
247
248
249
250
# File 'lib/nexpose/discovery.rb', line 246

def to_h
  { operator: operator,
    values: Array(value),
    field_name: field }
end