Class: OwaspZap::Alert
- Inherits:
-
Object
- Object
- OwaspZap::Alert
- Defined in:
- lib/owasp_zap/alert.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Alert
constructor
A new instance of Alert.
-
#view(format = "JSON") ⇒ Object
the API has an option to give an offset (start) and the amount of alerts (count) as parameter.
Constructor Details
#initialize(params = {}) ⇒ Alert
Returns a new instance of Alert.
3 4 5 6 7 |
# File 'lib/owasp_zap/alert.rb', line 3 def initialize(params = {}) #handle params @base = params[:base] @target = params[:target] end |
Instance Method Details
#view(format = "JSON") ⇒ Object
the API has an option to give an offset (start) and the amount of alerts (count) as parameter
11 12 13 14 15 16 17 |
# File 'lib/owasp_zap/alert.rb', line 11 def view(format = "JSON") raise OwaspZap::WrongFormatException,"Output format not accepted" unless ["JSON","HTML","XML"].include?(format) #http://localhost:8080/JSON/core/view/alerts/?zapapiformat=JSON&baseurl=http%3A%2F%2F192.168.1.113&start=&count= url = Addressable::URI.parse "#{@base}/#{format}/core/view/alerts/" url.query_values = {:zapapiformat=>format,:baseurl=>@target} RestClient::get url.normalize.to_str end |