Class: BitbucketServer::Representation::PullRequest
- Inherits:
-
Base
- Object
- Base
- BitbucketServer::Representation::PullRequest
show all
- Defined in:
- lib/bitbucket_server/representation/pull_request.rb
Instance Attribute Summary
Attributes inherited from Base
#raw
Instance Method Summary
collapse
Methods inherited from Base
convert_timestamp, decorate, #initialize
Instance Method Details
#author ⇒ Object
6
7
8
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 6
def author
raw.dig('author', 'user', 'name')
end
|
#author_email ⇒ Object
10
11
12
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 10
def author_email
raw.dig('author', 'user', 'emailAddress')
end
|
#author_username ⇒ Object
14
15
16
17
18
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 14
def author_username
raw.dig('author', 'user', 'username') ||
raw.dig('author', 'user', 'slug') ||
raw.dig('author', 'user', 'displayName')
end
|
#created_at ⇒ Object
43
44
45
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 43
def created_at
self.class.convert_timestamp(created_date)
end
|
#description ⇒ Object
20
21
22
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 20
def description
raw['description']
end
|
#iid ⇒ Object
24
25
26
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 24
def iid
raw['id']
end
|
#merged? ⇒ Boolean
39
40
41
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 39
def merged?
state == 'merged'
end
|
#source_branch_name ⇒ Object
55
56
57
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 55
def source_branch_name
raw.dig('fromRef', 'id')
end
|
#source_branch_sha ⇒ Object
59
60
61
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 59
def source_branch_sha
raw.dig('fromRef', 'latestCommit')
end
|
#state ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 28
def state
case raw['state']
when 'MERGED'
'merged'
when 'DECLINED'
'closed'
else
'opened'
end
end
|
#target_branch_name ⇒ Object
63
64
65
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 63
def target_branch_name
raw.dig('toRef', 'id')
end
|
#target_branch_sha ⇒ Object
67
68
69
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 67
def target_branch_sha
raw.dig('toRef', 'latestCommit')
end
|
#title ⇒ Object
51
52
53
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 51
def title
raw['title']
end
|
#updated_at ⇒ Object
47
48
49
|
# File 'lib/bitbucket_server/representation/pull_request.rb', line 47
def updated_at
self.class.convert_timestamp(updated_date)
end
|