Class: Qualys::Scans

Inherits:
Api
  • Object
show all
Defined in:
lib/qualys/scans.rb

Constant Summary

Constants inherited from Api

Api::PRODUCTION_ENDPOINT

Class Method Summary collapse

Methods inherited from Api

api_get, api_post, base_uri=

Class Method Details

.allObject



3
4
5
6
7
8
9
10
11
# File 'lib/qualys/scans.rb', line 3

def self.all
  response = api_get('/scan/', query: { action: 'list' })
  unless response.parsed_response['SCAN_LIST_OUTPUT']['RESPONSE'].key? 'SCAN_LIST'
    return []
  end

  scanlist = response.parsed_response['SCAN_LIST_OUTPUT']['RESPONSE']['SCAN_LIST']['SCAN']
  scanlist.map! { |scan| Scan.new(scan) }
end

.get(ref) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/qualys/scans.rb', line 13

def self.get(ref)
  response = api_get('/scan/', query: {
                       action: 'fetch',
                       scan_ref: ref,
                       mode: 'extended',
                       output_format: 'json'
                     })

  JSON.parse(response.parsed_response)
end