Skip to content

Commit

Permalink
Merge pull request #93 from gschneider-r7/incomplete-assets-from-scan
Browse files Browse the repository at this point in the history
Add incomplete_assets method
  • Loading branch information
mdaines-r7 committed Nov 17, 2014
2 parents c5abc98 + 027f29f commit bd3bdab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/nexpose/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ def completed_assets(scan_id)
end
end

# Retrieve a list of assets which are incomplete in a given scan. If called
# during a scan, this method returns currently incomplete assets which may
# be in progress.
#
# @param [Fixnum] scan_id Unique identifier of a scan.
# @return [Array[IncompleteAsset]] List of incomplete assets.
#
def incomplete_assets(scan_id)
uri = "/data/asset/scan/#{scan_id}/incomplete-assets"
AJAX.preserving_preference(self, 'scan-incomplete-assets') do
data = DataTable._get_json_table(self, uri, {}, 500, nil, false)
data.map(&IncompleteAsset.method(:parse_json))
end
end

def delete_device(device_id)
r = execute(make_xml('DeviceDeleteRequest', { 'device-id' => device_id }))
r.success
Expand Down Expand Up @@ -188,4 +203,9 @@ def self.parse_json(json)
end
end
end

# Summary object of an incomplete asset for a scan.
#
class IncompleteAsset < CompletedAsset
end
end

0 comments on commit bd3bdab

Please sign in to comment.