lib/hackerone/client/activity.rb in hackerone-client-0.19.0 vs lib/hackerone/client/activity.rb in hackerone-client-0.20.0
- old
+ new
@@ -13,10 +13,16 @@
def internal?
attributes.internal
end
+ def attachments
+ @attachments ||= activity.relationships.fetch(:attachments, {})
+ .fetch(:data, [])
+ .map { |attachment| HackerOne::Client::Attachment.new(attachment) }
+ end
+
private
def relationships
OpenStruct.new(activity.relationships)
end
@@ -83,18 +89,22 @@
class BountySuggested < Activity
delegate :message, :bounty_amount, :bonus_amount, to: :attributes
end
+ class ReportLocked < Activity
+ end
+
ACTIVITY_TYPE_CLASS_MAPPING = {
"activity-bounty-awarded" => BountyAwarded,
"activity-swag-awarded" => SwagAwarded,
"activity-user-assigned-to-bug" => UserAssignedToBug,
"activity-group-assigned-to-bug" => GroupAssignedToBug,
"activity-bug-triaged" => BugTriaged,
"activity-reference-id-added" => ReferenceIdAdded,
"activity-comment" => CommentAdded,
- "activity-bounty-suggested" => BountySuggested
+ "activity-bounty-suggested" => BountySuggested,
+ "activity-comments-closed" => ReportLocked
}.freeze
def self.build(activity_data)
activity_type_class = ACTIVITY_TYPE_CLASS_MAPPING.fetch \
activity_data[:type], Activity