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.



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

def options
  @options
end

Instance Method Details

#authenticationObject



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

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

#curl_commandObject



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

def curl_command
  "curl --fail --silent"
end

#curl_download_to_pipeObject



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

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

#curl_manifest(object_manifest, destination = to) ⇒ Object



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

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

#curl_upload_from(source, destination = to) ⇒ Object



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

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

#fromObject



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

def from
  options['from_uri']
end

#from=(target) ⇒ Object



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

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

#http_authentication?Boolean

Returns:

  • (Boolean)


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

def http_authentication?
  options['authenticator']
end

#toObject



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

def to
  options['to_uri']
end

#to=(target) ⇒ Object



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

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