Class: HttpObservatory::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/http_observatory/api.rb

Overview

Api for application

Class Method Summary collapse

Class Method Details

.get_analyze(host) ⇒ Object



8
9
10
11
# File 'lib/http_observatory/api.rb', line 8

def get_analyze(host)
  response = Request.get('analyze', { 'host' => host })
  Scan.new(response)
end

.get_grade_distributionObject



35
36
37
38
# File 'lib/http_observatory/api.rb', line 35

def get_grade_distribution
  response = Request.get('getGradeDistribution')
  GradeDistribution.new(response)
end

.get_host_history(host) ⇒ Object



30
31
32
33
# File 'lib/http_observatory/api.rb', line 30

def get_host_history(host)
  response = Request.get("getHostHistory", { 'host' => host })
  response.map{|history| HostHistory.new(history) }
end

.get_recent_scans(params = {}) ⇒ Object



23
24
25
26
27
28
# File 'lib/http_observatory/api.rb', line 23

def get_recent_scans(params={})
  params[:min] = params[:min] ? params[:min] : 0
  params[:max] = params[:max] ? params[:max] : 20
  response = Request.get('getRecentScans', { min: params[:min], max: params[:max] })
  RecentScans.new(response)
end

.get_scan_results(scan_id) ⇒ Object



18
19
20
21
# File 'lib/http_observatory/api.rb', line 18

def get_scan_results(scan_id)
  response = Request.get("getScanResults", { 'scan' => scan_id })
  response.keys.map{|key| TestResult.new(response[key]) }
end

.get_scanner_statesObject



40
41
42
43
# File 'lib/http_observatory/api.rb', line 40

def get_scanner_states
  response = Request.get('getScannerStates')
  ScannerStates.new(response)
end

.post_analyze(host, params = {}) ⇒ Object



13
14
15
16
# File 'lib/http_observatory/api.rb', line 13

def post_analyze(host, params={})
  response = Request.post('analyze', { 'host' => host, 'hidden' => params[:hidden], 'rescan' => params[:rescan] })
  Scan.new(response)
end