Module: Uricp::CurlPrimitives
- Included in:
- Segmenter, Strategy::Common
- Defined in:
- lib/uricp/curl_primitives.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #authentication ⇒ Object
- #curl_command ⇒ Object
- #curl_download_to_pipe ⇒ Object
- #curl_manifest(object_manifest, destination = to) ⇒ Object
- #curl_upload_from(source, destination = to) ⇒ Object
- #from ⇒ Object
- #from=(target) ⇒ Object
- #http_authentication? ⇒ Boolean
- #to ⇒ Object
- #to=(target) ⇒ Object
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/uricp/curl_primitives.rb', line 2 def @options end |
Instance Method Details
#authentication ⇒ Object
24 25 26 |
# File 'lib/uricp/curl_primitives.rb', line 24 def authentication "-H X-Auth-Token:#{['authenticator'].call}" if http_authentication? end |
#curl_command ⇒ Object
20 21 22 |
# File 'lib/uricp/curl_primitives.rb', line 20 def curl_command 'curl --fail --silent' end |
#curl_download_to_pipe ⇒ Object
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 |
#from ⇒ Object
4 5 6 |
# File 'lib/uricp/curl_primitives.rb', line 4 def from ['from_uri'] end |
#from=(target) ⇒ Object
8 9 10 |
# File 'lib/uricp/curl_primitives.rb', line 8 def from=(target) ['from_uri'] = target end |
#http_authentication? ⇒ Boolean
28 29 30 |
# File 'lib/uricp/curl_primitives.rb', line 28 def http_authentication? ['authenticator'] end |
#to ⇒ Object
12 13 14 |
# File 'lib/uricp/curl_primitives.rb', line 12 def to ['to_uri'] end |
#to=(target) ⇒ Object
16 17 18 |
# File 'lib/uricp/curl_primitives.rb', line 16 def to=(target) ['to_uri'] = target end |