lib/hackerone/client/report.rb in hackerone-client-0.16.0 vs lib/hackerone/client/report.rb in hackerone-client-0.17.0

- old
+ new

@@ -24,10 +24,18 @@ needs-more-info informative duplicate ).map(&:to_sym).freeze + SEVERITY_RATINGS = %w( + none + low + medium + high + critical + ).freeze + class << self def add_on_state_change_hook(proc) on_state_change_hooks << proc end @@ -62,10 +70,14 @@ def issue_tracker_reference_id attributes[:issue_tracker_reference_id] end + def severity + attributes[:severity] + end + def state attributes[:state] end def reporter @@ -157,9 +169,26 @@ response_body = make_post_request( "reports/#{id}/swags", request_body: request_body ) Swag.new(response_body, program) + end + + def update_severity(rating:) + raise ArgumentError, "Invalid severity rating" unless SEVERITY_RATINGS.include?(rating) + + request_body = { + type: "severity", + attributes: { + rating: rating + } + } + response_body = make_post_request( + "reports/#{id}/severities", + request_body: request_body + ) + @report[:attributes][:severity] = { rating: rating } + Activities.build(response_body) end def suggest_bounty(message:, amount:, bonus_amount: nil) request_body = { message: message,