Module: Uricp::CurlPrimitives

Included in:
Segmenter, Strategy::Common
Defined in:
lib/uricp/curl_primitives.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/uricp/curl_primitives.rb', line 2

def options
  @options
end

Instance Method Details

#authenticationObject



24
25
26
# File 'lib/uricp/curl_primitives.rb', line 24

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

#curl_commandObject



20
21
22
# File 'lib/uricp/curl_primitives.rb', line 20

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

#curl_download_to_pipeObject



36
37
38
# File 'lib/uricp/curl_primitives.rb', line 36

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

#curl_manifest(object_manifest, destination = to) ⇒ Object



40
41
42
# File 'lib/uricp/curl_primitives.rb', line 40

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

#curl_upload_from(source, destination = to) ⇒ Object



32
33
34
# File 'lib/uricp/curl_primitives.rb', line 32

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

#fromObject



4
5
6
# File 'lib/uricp/curl_primitives.rb', line 4

def from
  options['from_uri']
end

#from=(target) ⇒ Object



8
9
10
# File 'lib/uricp/curl_primitives.rb', line 8

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

#http_authentication?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/uricp/curl_primitives.rb', line 28

def http_authentication?
  options['authenticator']
end

#toObject



12
13
14
# File 'lib/uricp/curl_primitives.rb', line 12

def to
  options['to_uri']
end

#to=(target) ⇒ Object



16
17
18
# File 'lib/uricp/curl_primitives.rb', line 16

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