summaryrefslogtreecommitdiff
path: root/lib/bitbucket/representation/comment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bitbucket/representation/comment.rb')
-rw-r--r--lib/bitbucket/representation/comment.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/bitbucket/representation/comment.rb b/lib/bitbucket/representation/comment.rb
new file mode 100644
index 00000000000..94bc18cbfab
--- /dev/null
+++ b/lib/bitbucket/representation/comment.rb
@@ -0,0 +1,27 @@
+module Bitbucket
+ module Representation
+ class Comment < Representation::Base
+ def author
+ user.fetch('username', 'Anonymous')
+ end
+
+ def note
+ raw.dig('content', 'raw')
+ end
+
+ def created_at
+ raw['created_on']
+ end
+
+ def updated_at
+ raw['updated_on'] || raw['created_on']
+ end
+
+ private
+
+ def user
+ raw.fetch('user', {})
+ end
+ end
+ end
+end