class HttpObservatory::Api

Api for application

Public Class Methods

get_analyze(host) click to toggle source
# File lib/http_observatory/api.rb, line 8
def get_analyze(host)
  response = Request.get('analyze', { 'host' => host })
  Scan.new(response)
end
get_grade_distribution() click to toggle source
# File lib/http_observatory/api.rb, line 35
def get_grade_distribution
  response = Request.get('getGradeDistribution')
  GradeDistribution.new(response)
end
get_host_history(host) click to toggle source
# 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={}) click to toggle source
# 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) click to toggle source
# 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_states() click to toggle source
# File lib/http_observatory/api.rb, line 40
def get_scanner_states
  response = Request.get('getScannerStates')
  ScannerStates.new(response)
end
post_analyze(host, params={}) click to toggle source
# 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