Class: HttpObservatory::Api
- Inherits:
-
Object
- Object
- HttpObservatory::Api
- Defined in:
- lib/http_observatory/api.rb
Overview
Api for application
Class Method Summary collapse
- .get_analyze(host) ⇒ Object
- .get_grade_distribution ⇒ Object
- .get_host_history(host) ⇒ Object
- .get_recent_scans(params = {}) ⇒ Object
- .get_scan_results(scan_id) ⇒ Object
- .get_scanner_states ⇒ Object
- .post_analyze(host, params = {}) ⇒ Object
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_distribution ⇒ Object
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_states ⇒ Object
40 41 42 43 |
# File 'lib/http_observatory/api.rb', line 40 def get_scanner_states response = Request.get('getScannerStates') ScannerStates.new(response) end |