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:



269
270
271
272
273
# File 'lib/nexpose/discovery.rb', line 269

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.



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

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