class Artifactory::Resource::Artifact

def copy_or_move(action, destination, options = {})

Returns:
  • (Hash) -

Options Hash: (**options)
  • :dry_run (Boolean) --
  • :suppress_layouts (Boolean) --
  • :fail_fast (Boolean) --

Parameters:
  • options (Hash) --
  • destination (String) --
  • action (Symbol) --

Other tags:
    Example: Copy the current artifact to +ext-releases-local+ -
    Example: Move the current artifact to +ext-releases-local+ -
def copy_or_move(action, destination, options = {})
  params = {}.tap do |param|
    param[:to]              = destination
    param[:failFast]        = 1 if options[:fail_fast]
    param[:suppressLayouts] = 1 if options[:suppress_layouts]
    param[:dry]             = 1 if options[:dry_run]
  end
  # Okay, seriously, WTF Artifactory? Are you fucking serious? You want me
  # to make a POST request, but you don't actually read the contents of the
  # POST request, you read the URL-params. Sigh, whoever claimed this was a
  # RESTful API should seriously consider a new occupation.
  params = params.map do |k, v|
    key   = URI.escape(k.to_s)
    value = URI.escape(v.to_s)
    "#{key}=#{value}"
  end
  endpoint = File.join('/api', action.to_s, relative_path) + '?' + params.join('&')
  client.post(endpoint)
end