Class: Atlassian::Stash::CreatePullRequestResource

Inherits:
Object
  • Object
show all
Defined in:
lib/atlassian/stash/pull_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sourceRepoInfo, targetRepoInfo, title, description, reviewers, source, target) ⇒ CreatePullRequestResource

Returns a new instance of CreatePullRequestResource.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/atlassian/stash/pull_request.rb', line 13

def initialize(sourceRepoInfo, targetRepoInfo, title, description, reviewers, source, target)
  src_repository = {
  'slug' => sourceRepoInfo.slug,
  'project' => {
    'key' => sourceRepoInfo.projectKey
    }
  }
  target_repository = {
  'slug' => targetRepoInfo.slug,
  'project' => {
    'key' => targetRepoInfo.projectKey
    }
  }
  fromRef = {
    'id' => source,
    'repository' => src_repository
  }
  toRef = {
    'id' => target,
    'repository' => target_repository
  }
  @resource = {
    'title' => title,
    'fromRef' => fromRef,
    'toRef' => toRef
  }

  @resource["description"] = description unless description.empty?

  @resource["reviewers"] = reviewers.collect { |r|
      {
        'user' => {
          'name' => r
        }
      }
  } unless reviewers.empty?
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource


11
12
13
# File 'lib/atlassian/stash/pull_request.rb', line 11

def resource
  @resource
end