Class: AptlyCli::AptlyFile

Inherits:
AptlyCommand show all
Defined in:
lib/aptly_file.rb

Overview

Uploading file into Aptly

Instance Attribute Summary collapse

Attributes inherited from AptlyCommand

#config

Instance Method Summary collapse

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_uriObject

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_pathObject

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

#packageObject

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_dirObject



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(post_options = {})
  api_file_uri = '/files' + post_options[:file_uri].to_s
  response = post(api_file_uri,
                  body: {
                    package: post_options[:package],
                    file: File.new(post_options[:local_file])
                  })
  response.parsed_response
end