Class: BitbucketServer::Representation::PullRequest
- Defined in:
- lib/bitbucket_server/representation/pull_request.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #author ⇒ Object
- #author_email ⇒ Object
- #author_username ⇒ Object
- #created_at ⇒ Object
- #description ⇒ Object
- #iid ⇒ Object
- #merged? ⇒ Boolean
- #reviewers ⇒ Object
- #source_branch_name ⇒ Object
- #source_branch_sha ⇒ Object
- #state ⇒ Object
- #target_branch_name ⇒ Object
- #target_branch_sha ⇒ Object
- #title ⇒ Object
- #to_hash ⇒ Object
- #updated_at ⇒ Object
Methods inherited from Base
convert_timestamp, decorate, #initialize
Constructor Details
This class inherits a constructor from BitbucketServer::Representation::Base
Instance Method Details
#author ⇒ Object
6 7 8 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 6 def raw.dig('author', 'user', 'name') end |
#author_email ⇒ Object
10 11 12 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 10 def 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 raw.dig('author', 'user', 'username') || raw.dig('author', 'user', 'slug') || raw.dig('author', 'user', 'displayName') end |
#created_at ⇒ Object
47 48 49 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 47 def created_at self.class.(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
28 29 30 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 28 def iid raw['id'] end |
#merged? ⇒ Boolean
43 44 45 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 43 def merged? state == 'merged' end |
#reviewers ⇒ Object
24 25 26 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 24 def reviewers raw['reviewers'] end |
#source_branch_name ⇒ Object
59 60 61 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 59 def source_branch_name raw.dig('fromRef', 'id') end |
#source_branch_sha ⇒ Object
63 64 65 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 63 def source_branch_sha raw.dig('fromRef', 'latestCommit') end |
#state ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 32 def state case raw['state'] when 'MERGED' 'merged' when 'DECLINED' 'closed' else 'opened' end end |
#target_branch_name ⇒ Object
67 68 69 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 67 def target_branch_name raw.dig('toRef', 'id') end |
#target_branch_sha ⇒ Object
71 72 73 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 71 def target_branch_sha raw.dig('toRef', 'latestCommit') end |
#title ⇒ Object
55 56 57 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 55 def title raw['title'] end |
#to_hash ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 75 def to_hash { iid: iid, author: , author_email: , author_username: , description: description, reviewers: reviewers, created_at: created_at, updated_at: updated_at, state: state, title: title, source_branch_name: source_branch_name, source_branch_sha: source_branch_sha, target_branch_name: target_branch_name, target_branch_sha: target_branch_sha } end |
#updated_at ⇒ Object
51 52 53 |
# File 'lib/bitbucket_server/representation/pull_request.rb', line 51 def updated_at self.class.(updated_date) end |