def promote(target_repo, options = {})
      request_body = {}.tap do |body|
        body[:status]       = options[:status] || "promoted"
        body[:comment]      = options[:comment] || ""
        body[:ciUser]       = options[:user] || Artifactory.username
        body[:dryRun]       = options[:dry_run] || false
        body[:targetRepo]   = target_repo
        body[:copy]         = options[:copy] || false
        body[:artifacts]    = true # always move/copy the build's artifacts
        body[:dependencies] = options[:dependencies] || false
        body[:scopes]       = options[:scopes] || []
        body[:properties]   = options[:properties] || {}
        body[:failFast]     = options[:fail_fast] || true
      end

      endpoint = "/api/build/promote/#{url_safe(name)}/#{url_safe(number)}"
      client.post(endpoint, JSON.fast_generate(request_body),
        "Content-Type" => "application/json"
      )
    end
def promote(target_repo, options = {})
      request_body = {}.tap do |body|
        body[:status]       = options[:status] || "promoted"
        body[:comment]      = options[:comment] || ""
        body[:ciUser]       = options[:user] || Artifactory.username
        body[:dryRun]       = options[:dry_run] || false
        body[:targetRepo]   = target_repo
        body[:copy]         = options[:copy] || false
        body[:artifacts]    = true # always move/copy the build's artifacts
        body[:dependencies] = options[:dependencies] || false
        body[:scopes]       = options[:scopes] || []
        body[:properties]   = options[:properties] || {}
        body[:failFast]     = options[:fail_fast] || true
      end

      endpoint = "/api/build/promote/#{url_safe(name)}/#{url_safe(number)}"
      client.post(endpoint, JSON.fast_generate(request_body),
        "Content-Type" => "application/json"
      )
    end
Move a build's artifacts to a new repository optionally moving or
 copying the build's dependencies to the target repository
 and setting properties on promoted artifacts.

 @example promote the build to 'omnibus-stable-local'
   build.promote('omnibus-stable-local')
 @example promote a build attaching some new properites
   build.promote('omnibus-stable-local'
     properties: {
       'promoted_by' => 'hipchat:schisamo@chef.io'
     }
   )

 @param [String] target_repo
   repository to move or copy the build's artifacts and/or dependencies
 @param [Hash] options
   the list of options to pass

 @option options [String] :status (default: 'promoted')
   new build status (any string)
 @option options [String] :comment (default: '')
   an optional comment describing the reason for promotion
 @option options [String] :user (default: +Artifactory.username+)
   the user that invoked promotion
 @option options [Boolean] :dry_run (default: +false+)
   pretend to do the promotion
 @option options [Boolean] :copy (default: +false+)
   whether to copy instead of move
 @option options [Boolean] :dependencies (default: +false+)
   whether to move/copy the build's dependencies
 @option options [Array] :scopes (default: [])
   an array of dependency scopes to include when "dependencies" is true
 @option options [Hash<String, Array<String>>] :properties (default: [])
   a list of properties to attach to the build's artifacts
 @option options [Boolean] :fail_fast (default: +true+)
   fail and abort the operation upon receiving an error

 @return [Hash]
   the parsed JSON response from the server