comment.rb 439 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 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