class Atlassian::Stash::CreatePullRequestResource

Attributes

resource[RW]

Public Class Methods

new(sourceRepoInfo, targetRepoInfo, title, description, reviewers, source, target) click to toggle source
# 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