Sha256: 8a77f2f3816317ce2724fd11d60b2f7bcb36ac5f9e4f2cc4ad4cecc290f3718f

Contents?: true

Size: 952 Bytes

Versions: 8

Compression:

Stored size: 952 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.to_s};"
    end

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.15 lib/uricp/curl_primitives.rb
uricp-0.0.14 lib/uricp/curl_primitives.rb
uricp-0.0.13 lib/uricp/curl_primitives.rb
uricp-0.0.12 lib/uricp/curl_primitives.rb
uricp-0.0.11 lib/uricp/curl_primitives.rb
uricp-0.0.10 lib/uricp/curl_primitives.rb
uricp-0.0.9 lib/uricp/curl_primitives.rb
uricp-0.0.8 lib/uricp/curl_primitives.rb