Class: BitbucketServer::Representation::Activity

Inherits:
Base
  • Object
show all
Defined in:
lib/bitbucket_server/representation/activity.rb

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods inherited from Base

convert_timestamp, decorate, #initialize

Constructor Details

This class inherits a constructor from BitbucketServer::Representation::Base

Instance Method Details

#commentObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/bitbucket_server/representation/activity.rb', line 14

def comment
  return unless comment?

  @comment ||=
    if inline_comment?
      PullRequestComment.new(raw)
    else
      Comment.new(raw)
    end
end

#comment?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/bitbucket_server/representation/activity.rb', line 6

def comment?
  action == 'COMMENTED'
end

#committer_emailObject



34
35
36
# File 'lib/bitbucket_server/representation/activity.rb', line 34

def committer_email
  commit.dig('committer', 'emailAddress')
end

#committer_userObject



30
31
32
# File 'lib/bitbucket_server/representation/activity.rb', line 30

def committer_user
  commit.dig('committer', 'displayName')
end

#created_atObject



48
49
50
# File 'lib/bitbucket_server/representation/activity.rb', line 48

def created_at
  self.class.convert_timestamp(created_date)
end

#inline_comment?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/bitbucket_server/representation/activity.rb', line 10

def inline_comment?
  !!(comment? && comment_anchor)
end

#merge_commitObject



44
45
46
# File 'lib/bitbucket_server/representation/activity.rb', line 44

def merge_commit
  commit['id']
end

#merge_event?Boolean

TODO Move this into MergeEvent

Returns:

  • (Boolean)


26
27
28
# File 'lib/bitbucket_server/representation/activity.rb', line 26

def merge_event?
  action == 'MERGED'
end

#merge_timestampObject



38
39
40
41
42
# File 'lib/bitbucket_server/representation/activity.rb', line 38

def merge_timestamp
  timestamp = commit['committerTimestamp']

  self.class.convert_timestamp(timestamp)
end