Class: AptlyAPI::Repo
- Inherits:
-
Object
- Object
- AptlyAPI::Repo
- Defined in:
- lib/repo.rb
Overview
This class represents an Aptly repo
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#distribution ⇒ Object
readonly
Returns the value of attribute distribution.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#edit(properties) ⇒ Object
Edit repo
properties. -
#import_files(directory, options = {}) ⇒ Object
Import all files uploaded to
directory. -
#initialize(server, json) ⇒ Repo
constructor
Creates a new Repo definitation with data
jsonlocated onserver. -
#packages(query = nil) ⇒ Object
Return a listing of Packages for the repo.
Constructor Details
#initialize(server, json) ⇒ Repo
Creates a new Repo definitation with data json located on server
12 13 14 15 16 17 18 19 20 |
# File 'lib/repo.rb', line 12 def initialize(server, json) @server = server @http = Net::HTTP.new(@server.host, @server.port) @name = json['Name'] @comment = json['Comment'] @distrubution = json['DefaultDistribution'] @component = json['DefaultComponent'] end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
49 50 51 |
# File 'lib/repo.rb', line 49 def comment @comment end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
49 50 51 |
# File 'lib/repo.rb', line 49 def component @component end |
#distribution ⇒ Object (readonly)
Returns the value of attribute distribution.
49 50 51 |
# File 'lib/repo.rb', line 49 def distribution @distribution end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/repo.rb', line 49 def name @name end |
Instance Method Details
#edit(properties) ⇒ Object
Edit repo properties
30 31 32 |
# File 'lib/repo.rb', line 30 def edit(properties) hput("/api/repos/#{@name}", properties) end |
#import_files(directory, options = {}) ⇒ Object
Import all files uploaded to directory
24 25 26 |
# File 'lib/repo.rb', line 24 def import_files(directory, = {}) hpost("/api/repos/#{@name}/file/#{directory}", ) end |
#packages(query = nil) ⇒ Object
Return a listing of Packages for the repo
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/repo.rb', line 36 def packages(query = nil) packages = Array.new if !query url = "/api/repos/#{@name}/packages" else url = "/api/repos/#{@name}/packages?q=#{URI.escape(query)}" end hget(url).each do |key| packages.push(Package.new(@server, key)) end packages end |