Sha256: eca6947d1eb1281d7f8fdcebf64a97f72d370d2c3f637ae1f05c049138f3da9a

Contents?: true

Size: 869 Bytes

Versions: 8

Compression:

Stored size: 869 Bytes

Contents

module Uricp::CurlPrimitives
  attr_reader :options

  def from
    options['from_uri']
  end

  def from=(target)
    options['from_uri'] = target
  end

  def to
    options['to_uri']
  end

  def to=(target)
    options['to_uri'] = target
  end

  def curl_command
    'curl --fail --silent'
  end

  def authentication
    "-H X-Auth-Token:#{options['authenticator'].call}" if http_authentication?
  end

  def http_authentication?
    options['authenticator']
  end

  def curl_upload_from(source, destination = to)
    "#{curl_command} #{authentication} -T #{source} #{destination};"
  end

  def curl_download_to_pipe
    "#{curl_command} #{authentication} #{from} |"
  end

  def curl_manifest(object_manifest, destination = to)
    "#{curl_command} #{authentication} -X PUT -H 'X-Object-Manifest: #{object_manifest}' #{destination} --data-binary ''"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/curl_primitives.rb
uricp-0.0.23 lib/uricp/curl_primitives.rb
uricp-0.0.22 lib/uricp/curl_primitives.rb
uricp-0.0.21 lib/uricp/curl_primitives.rb
uricp-0.0.20 lib/uricp/curl_primitives.rb
uricp-0.0.18 lib/uricp/curl_primitives.rb
uricp-0.0.17 lib/uricp/curl_primitives.rb
uricp-0.0.16 lib/uricp/curl_primitives.rb