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.



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

def options
  @options
end

Instance Method Details

#authenticationObject



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

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

#curl_commandObject



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

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

#curl_download_to_pipeObject



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

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

#curl_manifest(object_manifest, destination = to) ⇒ Object



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

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



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

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

#fromObject



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

def from
  options['from_uri']
end

#from=(target) ⇒ Object



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

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

#http_authentication?Boolean

Returns:

  • (Boolean)


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

def http_authentication?
  options['authenticator']
end

#toObject



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

def to
  options['to_uri']
end

#to=(target) ⇒ Object



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

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