class Atlassian::Stash::CreatePullRequestResource

Attributes

resource[RW]

Public Class Methods

new(projectKey, slug, title, description, reviewers, source, target) click to toggle source
# File lib/atlassian/stash/pull_request.rb, line 16
def initialize(projectKey, slug, title, description, reviewers, source, target)
  repository = {
  'slug' => slug,
  'project' => {
    'key' => projectKey
    }
  }
  fromRef = {
    'id' => source,
    'repository' => repository
  }
  toRef = {
    'id' => target,
    'repository' => 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