diff options
author | Stan Hu <stanhu@gmail.com> | 2016-11-16 00:13:17 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-11-21 16:47:28 -0800 |
commit | ea393e6f308e5dcdd5c48433285594db0539b203 (patch) | |
tree | 28056b3682bd21cf08bedb564039291fb975b17a /lib/bitbucket/representation/pull_request_comment.rb | |
parent | 489d241c8d68ed527fccb73a1f7e46e9a567c971 (diff) | |
download | gitlab-ce-ea393e6f308e5dcdd5c48433285594db0539b203.tar.gz |
Import pull request comments
Diffstat (limited to 'lib/bitbucket/representation/pull_request_comment.rb')
-rw-r--r-- | lib/bitbucket/representation/pull_request_comment.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/bitbucket/representation/pull_request_comment.rb b/lib/bitbucket/representation/pull_request_comment.rb new file mode 100644 index 00000000000..94719edbf38 --- /dev/null +++ b/lib/bitbucket/representation/pull_request_comment.rb @@ -0,0 +1,39 @@ +module Bitbucket + module Representation + class PullRequestComment < Comment + def iid + raw['id'] + end + + def file_path + inline.fetch('path', nil) + end + + def old_pos + inline.fetch('from', nil) || 1 + end + + def new_pos + inline.fetch('to', nil) || 1 + end + + def parent_id + raw.fetch('parent', {}).fetch('id', nil) + end + + def inline? + raw.has_key?('inline') + end + + def has_parent? + raw.has_key?('parent') + end + + private + + def inline + raw.fetch('inline', {}) + end + end + end +end |