Class: AptlyCli::AptlyFile
- Inherits:
-
AptlyCommand
- Object
- AptlyCommand
- AptlyCli::AptlyFile
- Defined in:
- lib/aptly_file.rb
Overview
Uploading file into Aptly
Instance Attribute Summary collapse
-
#file_uri ⇒ Object
Returns the value of attribute file_uri.
-
#local_file_path ⇒ Object
Returns the value of attribute local_file_path.
-
#package ⇒ Object
Returns the value of attribute package.
Attributes inherited from AptlyCommand
Instance Method Summary collapse
- #file_delete(file_uri) ⇒ Object
- #file_dir ⇒ Object
- #file_get(file_uri) ⇒ Object
- #file_post(post_options = {}) ⇒ Object
Methods inherited from AptlyCommand
#delete, #get, #initialize, #post, #process_response, #put
Constructor Details
This class inherits a constructor from AptlyCli::AptlyCommand
Instance Attribute Details
#file_uri ⇒ Object
Returns the value of attribute file_uri.
9 10 11 |
# File 'lib/aptly_file.rb', line 9 def file_uri @file_uri end |
#local_file_path ⇒ Object
Returns the value of attribute local_file_path.
9 10 11 |
# File 'lib/aptly_file.rb', line 9 def local_file_path @local_file_path end |
#package ⇒ Object
Returns the value of attribute package.
9 10 11 |
# File 'lib/aptly_file.rb', line 9 def package @package end |
Instance Method Details
#file_delete(file_uri) ⇒ Object
27 28 29 30 31 |
# File 'lib/aptly_file.rb', line 27 def file_delete(file_uri) uri = '/files' + file_uri response = delete uri response.parsed_response end |
#file_dir ⇒ Object
11 12 13 14 15 |
# File 'lib/aptly_file.rb', line 11 def file_dir uri = '/files' response = get uri response.parsed_response end |
#file_get(file_uri) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/aptly_file.rb', line 17 def file_get(file_uri) uri = if file_uri == '/' '/files' else '/files/' + file_uri end response = get uri response.parsed_response end |
#file_post(post_options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/aptly_file.rb', line 33 def file_post( = {}) api_file_uri = '/files' + [:file_uri].to_s response = post(api_file_uri, body: { package: [:package], file: File.new([:local_file]) }) response.parsed_response end |