Class: HackerOne::Client::Report
- Inherits:
-
Object
- Object
- HackerOne::Client::Report
- Defined in:
- lib/hackerone/client/report.rb
Instance Method Summary collapse
- #activities ⇒ Object
- #assign_to_group(name) ⇒ Object
- #assign_to_user(name) ⇒ Object
- #classification_label ⇒ Object
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(report) ⇒ Report
constructor
A new instance of Report.
- #issue_tracker_reference_url ⇒ Object
- #payment_total ⇒ Object
- #program ⇒ Object
- #reporter ⇒ Object
-
#risk ⇒ Object
Excludes reports where the payout amount is 0 indicating swag-only or no payout for the issue supplied.
- #structured_scope ⇒ Object
- #summary ⇒ Object
- #title ⇒ Object
- #unassign ⇒ Object
- #weakness ⇒ Object
-
#writeup_classification ⇒ Object
Bounty writeups just use the key, and not the label value.
Constructor Details
#initialize(report) ⇒ Report
Returns a new instance of Report.
7 8 9 |
# File 'lib/hackerone/client/report.rb', line 7 def initialize(report) @report = report end |
Instance Method Details
#activities ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/hackerone/client/report.rb', line 74 def activities if ships = relationships.fetch(:activities, {}).fetch(:data, []) ships.map do |activity_data| Activities.build(activity_data) end end end |
#assign_to_group(name) ⇒ Object
91 92 93 94 |
# File 'lib/hackerone/client/report.rb', line 91 def assign_to_group(name) group = program.find_group(name) _assign_to(group.id, :group) end |
#assign_to_user(name) ⇒ Object
86 87 88 89 |
# File 'lib/hackerone/client/report.rb', line 86 def assign_to_user(name) member = program.find_member(name) _assign_to(member.user.id, :user) end |
#classification_label ⇒ Object
65 66 67 |
# File 'lib/hackerone/client/report.rb', line 65 def classification_label weakness.to_owasp end |
#created_at ⇒ Object
19 20 21 |
# File 'lib/hackerone/client/report.rb', line 19 def created_at attributes[:created_at] end |
#id ⇒ Object
11 12 13 |
# File 'lib/hackerone/client/report.rb', line 11 def id @report[:id] end |
#issue_tracker_reference_url ⇒ Object
23 24 25 |
# File 'lib/hackerone/client/report.rb', line 23 def issue_tracker_reference_url attributes[:issue_tracker_reference_url] end |
#payment_total ⇒ Object
34 35 36 |
# File 'lib/hackerone/client/report.rb', line 34 def payment_total payments.reduce(0) { |total, payment| total + payment_amount(payment) } end |
#program ⇒ Object
82 83 84 |
# File 'lib/hackerone/client/report.rb', line 82 def program @program || Program.find(relationships[:program][:data][:attributes][:handle]) end |
#reporter ⇒ Object
27 28 29 30 31 32 |
# File 'lib/hackerone/client/report.rb', line 27 def reporter relationships .fetch(:reporter, {}) .fetch(:data, {}) .fetch(:attributes, {}) end |
#risk ⇒ Object
Excludes reports where the payout amount is 0 indicating swag-only or no payout for the issue supplied
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/hackerone/client/report.rb', line 44 def risk case payment_total when HackerOne::Client.low_range || DEFAULT_LOW_RANGE "low" when HackerOne::Client.medium_range || DEFAULT_MEDIUM_RANGE "medium" when HackerOne::Client.high_range || DEFAULT_HIGH_RANGE "high" when HackerOne::Client.critical_range || DEFAULT_CRITICAL_RANGE "critical" end end |
#structured_scope ⇒ Object
38 39 40 |
# File 'lib/hackerone/client/report.rb', line 38 def structured_scope StructuredScope.new(relationships[:structured_scope].fetch(:data, {})) end |
#summary ⇒ Object
57 58 59 |
# File 'lib/hackerone/client/report.rb', line 57 def summary attributes[:vulnerability_information] end |
#title ⇒ Object
15 16 17 |
# File 'lib/hackerone/client/report.rb', line 15 def title attributes[:title] end |
#unassign ⇒ Object
96 97 98 |
# File 'lib/hackerone/client/report.rb', line 96 def unassign _assign_to(nil, :nobody) end |
#weakness ⇒ Object
61 62 63 |
# File 'lib/hackerone/client/report.rb', line 61 def weakness @weakness ||= Weakness.new(relationships.fetch(:weakness, {}).fetch(:data, {}).fetch(:attributes, {})) end |
#writeup_classification ⇒ Object
Bounty writeups just use the key, and not the label value.
70 71 72 |
# File 'lib/hackerone/client/report.rb', line 70 def writeup_classification classification_label().split("-").first end |