lib/hackerone/client/report.rb in hackerone-client-0.9.1 vs lib/hackerone/client/report.rb in hackerone-client-0.10.0
- old
+ new
@@ -152,28 +152,29 @@
# id: the ID of the report
# state: the state in which the report is to be put in
#
# returns an HackerOne::Client::Report object or raises an error if
# no report is found.
- def state_change(state, message = nil)
+ def state_change(state, message = nil, attributes = {})
raise ArgumentError, "state (#{state}) must be one of #{STATES}" unless STATES.include?(state)
body = {
type: "state-change",
attributes: {
state: state
}
}
+ body[:attributes] = body[:attributes].reverse_merge(attributes)
+
if message
body[:attributes][:message] = message
elsif STATES_REQUIRING_STATE_CHANGE_MESSAGE.include?(state)
fail ArgumentError, "State #{state} requires a message. No message was supplied."
else
# message is in theory optional, but a value appears to be required.
body[:attributes][:message] = ""
end
-
response_json = make_post_request("reports/#{id}/state_changes", request_body: body)
@report = response_json
self
end