summaryrefslogtreecommitdiff
path: root/lib/bitbucket/representation/pull_request_comment.rb
blob: c52acbc3ddcb4fc1d3dfa2fa0947a0770a5ebb2a (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
module Bitbucket
  module Representation
    class PullRequestComment < Comment
      def iid
        raw['id']
      end

      def file_path
        inline.fetch('path')
      end

      def old_pos
        inline.fetch('from')
      end

      def new_pos
        inline.fetch('to')
      end

      def parent_id
        raw.fetch('parent', {}).fetch('id', nil)
      end

      def inline?
        raw.key?('inline')
      end

      def has_parent?
        raw.key?('parent')
      end

      private

      def inline
        raw.fetch('inline', {})
      end
    end
  end
end