Sha256: 56addf9b6fec65bd1f1d2f61c906ace1e656ae087a866035d593eddab3f7f506

Contents?: true

Size: 941 Bytes

Versions: 7

Compression:

Stored size: 941 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['auth-token']}" if http_authentication?
    end

    def http_authentication?
      options['auth-token']
    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

7 entries across 7 versions & 1 rubygems

Version Path
uricp-0.0.7 lib/uricp/curl_primitives.rb
uricp-0.0.6 lib/uricp/curl_primitives.rb
uricp-0.0.5 lib/uricp/curl_primitives.rb
uricp-0.0.4 lib/uricp/curl_primitives.rb
uricp-0.0.3 lib/uricp/curl_primitives.rb
uricp-0.0.2 lib/uricp/curl_primitives.rb
uricp-0.0.1 lib/uricp/curl_primitives.rb