lib/tracker_api/resources/comment.rb in tracker_api-1.4.1 vs lib/tracker_api/resources/comment.rb in tracker_api-1.5.0
- old
+ new
@@ -1,10 +1,13 @@
module TrackerApi
module Resources
class Comment
include Shared::Base
+ attribute :client
+
+ attribute :project_id, Integer
attribute :story_id, Integer
attribute :epic_id, Integer
attribute :text, String
attribute :person_id, Integer
attribute :created_at, DateTime
@@ -12,8 +15,21 @@
attribute :file_attachment_ids, [Integer]
attribute :google_attachment_ids, [Integer]
attribute :commit_identifier, String
attribute :commit_type, String
attribute :kind, String
+
+ class UpdateRepresenter < Representable::Decorator
+ include Representable::JSON
+
+ property :id
+ property :text
+ end
+
+ def save
+ raise ArgumentError, 'Cannot update a comment with an unknown story_id.' if story_id.nil?
+
+ Endpoints::Comment.new(client).update(self, UpdateRepresenter.new(Comment.new(self.dirty_attributes)))
+ end
end
end
end