Class: BitbucketServer::Representation::Activity
- Defined in:
- lib/bitbucket_server/representation/activity.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #approved_event? ⇒ Boolean
- #approver_email ⇒ Object
- #approver_name ⇒ Object
- #approver_username ⇒ Object
- #comment ⇒ Object
- #comment? ⇒ Boolean
- #committer_email ⇒ Object
- #committer_name ⇒ Object
- #committer_user ⇒ Object
- #committer_username ⇒ Object
- #created_at ⇒ Object
- #declined_event? ⇒ Boolean
- #decliner_email ⇒ Object
- #decliner_name ⇒ Object
- #decliner_username ⇒ Object
- #id ⇒ Object
- #inline_comment? ⇒ Boolean
- #merge_commit ⇒ Object
-
#merge_event? ⇒ Boolean
TODO Move this into MergeEvent.
- #merge_timestamp ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Base
convert_timestamp, decorate, #initialize
Constructor Details
This class inherits a constructor from BitbucketServer::Representation::Base
Instance Method Details
#approved_event? ⇒ Boolean
60 61 62 |
# File 'lib/bitbucket_server/representation/activity.rb', line 60 def approved_event? action == 'APPROVED' end |
#approver_email ⇒ Object
72 73 74 |
# File 'lib/bitbucket_server/representation/activity.rb', line 72 def approver_email raw.dig('user', 'emailAddress') end |
#approver_name ⇒ Object
64 65 66 |
# File 'lib/bitbucket_server/representation/activity.rb', line 64 def approver_name raw.dig('user', 'displayName') end |
#approver_username ⇒ Object
68 69 70 |
# File 'lib/bitbucket_server/representation/activity.rb', line 68 def approver_username raw.dig('user', 'slug') end |
#comment ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bitbucket_server/representation/activity.rb', line 18 def comment return unless comment? @comment ||= if inline_comment? PullRequestComment.new(raw) else Comment.new(raw) end end |
#comment? ⇒ Boolean
10 11 12 |
# File 'lib/bitbucket_server/representation/activity.rb', line 10 def comment? action == 'COMMENTED' end |
#committer_email ⇒ Object
46 47 48 |
# File 'lib/bitbucket_server/representation/activity.rb', line 46 def committer_email commit.dig('committer', 'emailAddress') end |
#committer_name ⇒ Object
38 39 40 |
# File 'lib/bitbucket_server/representation/activity.rb', line 38 def committer_name commit.dig('committer', 'displayName') end |
#committer_user ⇒ Object
34 35 36 |
# File 'lib/bitbucket_server/representation/activity.rb', line 34 def committer_user commit.dig('committer', 'displayName') end |
#committer_username ⇒ Object
42 43 44 |
# File 'lib/bitbucket_server/representation/activity.rb', line 42 def committer_username commit.dig('committer', 'slug') end |
#created_at ⇒ Object
92 93 94 |
# File 'lib/bitbucket_server/representation/activity.rb', line 92 def created_at self.class.(created_date) end |
#declined_event? ⇒ Boolean
76 77 78 |
# File 'lib/bitbucket_server/representation/activity.rb', line 76 def declined_event? action == 'DECLINED' end |
#decliner_email ⇒ Object
88 89 90 |
# File 'lib/bitbucket_server/representation/activity.rb', line 88 def decliner_email raw.dig('user', 'emailAddress') end |
#decliner_name ⇒ Object
80 81 82 |
# File 'lib/bitbucket_server/representation/activity.rb', line 80 def decliner_name raw.dig('user', 'displayName') end |
#decliner_username ⇒ Object
84 85 86 |
# File 'lib/bitbucket_server/representation/activity.rb', line 84 def decliner_username raw.dig('user', 'slug') end |
#id ⇒ Object
6 7 8 |
# File 'lib/bitbucket_server/representation/activity.rb', line 6 def id raw['id'] end |
#inline_comment? ⇒ Boolean
14 15 16 |
# File 'lib/bitbucket_server/representation/activity.rb', line 14 def inline_comment? !!(comment? && comment_anchor) end |
#merge_commit ⇒ Object
56 57 58 |
# File 'lib/bitbucket_server/representation/activity.rb', line 56 def merge_commit commit['id'] end |
#merge_event? ⇒ Boolean
TODO Move this into MergeEvent
30 31 32 |
# File 'lib/bitbucket_server/representation/activity.rb', line 30 def merge_event? action == 'MERGED' end |
#merge_timestamp ⇒ Object
50 51 52 53 54 |
# File 'lib/bitbucket_server/representation/activity.rb', line 50 def = commit['committerTimestamp'] self.class.() end |
#to_hash ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/bitbucket_server/representation/activity.rb', line 96 def to_hash { id: id, committer_name: committer_user, committer_user: committer_user, committer_username: committer_username, committer_email: committer_email, merge_timestamp: , merge_commit: merge_commit, approver_name: approver_name, approver_username: approver_username, approver_email: approver_email, decliner_name: decliner_name, decliner_username: decliner_username, decliner_email: decliner_email, created_at: created_at } end |