gitlab-org--gitlab-foss/lib/bitbucket/representation/pull_request_comment.rb

40 lines
585 B
Ruby
Raw Normal View History

2016-11-16 03:13:17 -05:00
module Bitbucket
module Representation
class PullRequestComment < Comment
def iid
raw['id']
end
def file_path
2016-12-12 13:41:55 -05:00
inline.fetch('path')
2016-11-16 03:13:17 -05:00
end
def old_pos
2016-12-12 13:41:55 -05:00
inline.fetch('from')
2016-11-16 03:13:17 -05:00
end
def new_pos
2016-12-12 13:41:55 -05:00
inline.fetch('to')
2016-11-16 03:13:17 -05:00
end
def parent_id
raw.fetch('parent', {}).fetch('id', nil)
2016-11-16 03:13:17 -05:00
end
def inline?
raw.key?('inline')
2016-11-16 03:13:17 -05:00
end
def has_parent?
raw.key?('parent')
2016-11-16 03:13:17 -05:00
end
private
def inline
raw.fetch('inline', {})
end
end
end
end