Class: Bitbucket::Representation::PullRequest
- Defined in:
- lib/bitbucket/representation/pull_request.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #author ⇒ Object
- #author_nickname ⇒ Object
- #created_at ⇒ Object
- #description ⇒ Object
- #iid ⇒ Object
- #merge_commit_sha ⇒ Object
- #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
Constructor Details
This class inherits a constructor from Bitbucket::Representation::Base
Instance Method Details
#author ⇒ Object
6 7 8 |
# File 'lib/bitbucket/representation/pull_request.rb', line 6 def raw.dig('author', 'uuid') end |
#author_nickname ⇒ Object
10 11 12 |
# File 'lib/bitbucket/representation/pull_request.rb', line 10 def raw.dig('author', 'nickname') end |
#created_at ⇒ Object
33 34 35 |
# File 'lib/bitbucket/representation/pull_request.rb', line 33 def created_at raw['created_on'] end |
#description ⇒ Object
14 15 16 |
# File 'lib/bitbucket/representation/pull_request.rb', line 14 def description raw['description'] end |
#iid ⇒ Object
18 19 20 |
# File 'lib/bitbucket/representation/pull_request.rb', line 18 def iid raw['id'] end |
#merge_commit_sha ⇒ Object
65 66 67 |
# File 'lib/bitbucket/representation/pull_request.rb', line 65 def merge_commit_sha raw['merge_commit']&.dig('hash') end |
#reviewers ⇒ Object
61 62 63 |
# File 'lib/bitbucket/representation/pull_request.rb', line 61 def reviewers raw['reviewers']&.pluck('uuid') end |
#source_branch_name ⇒ Object
45 46 47 |
# File 'lib/bitbucket/representation/pull_request.rb', line 45 def source_branch_name source_branch&.dig('branch', 'name') end |
#source_branch_sha ⇒ Object
49 50 51 |
# File 'lib/bitbucket/representation/pull_request.rb', line 49 def source_branch_sha source_branch&.dig('commit', 'hash') end |
#state ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bitbucket/representation/pull_request.rb', line 22 def state case raw['state'] when 'MERGED' 'merged' when 'DECLINED', 'SUPERSEDED' 'closed' else 'opened' end end |
#target_branch_name ⇒ Object
53 54 55 |
# File 'lib/bitbucket/representation/pull_request.rb', line 53 def target_branch_name target_branch&.dig('branch', 'name') end |
#target_branch_sha ⇒ Object
57 58 59 |
# File 'lib/bitbucket/representation/pull_request.rb', line 57 def target_branch_sha target_branch&.dig('commit', 'hash') end |
#title ⇒ Object
41 42 43 |
# File 'lib/bitbucket/representation/pull_request.rb', line 41 def title raw['title'] end |
#to_hash ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/bitbucket/representation/pull_request.rb', line 69 def to_hash { iid: iid, author: , author_nickname: , description: description, created_at: created_at, updated_at: updated_at, state: state, title: title, source_branch_name: source_branch_name, source_branch_sha: source_branch_sha, merge_commit_sha: merge_commit_sha, target_branch_name: target_branch_name, target_branch_sha: target_branch_sha, source_and_target_project_different: source_and_target_project_different, reviewers: reviewers, closed_by: closed_by } end |
#updated_at ⇒ Object
37 38 39 |
# File 'lib/bitbucket/representation/pull_request.rb', line 37 def updated_at raw['updated_on'] end |