Class: Aptly::PublishedRepository
- Inherits:
-
Representation
- Object
- OpenStruct
- Representation
- Aptly::PublishedRepository
- Defined in:
- lib/aptly/publish.rb
Overview
A published repository representation. Published repositories are not Repository instances as they are in fact comprised of one or more different repositories.
Instance Attribute Summary
Attributes inherited from Representation
Class Method Summary collapse
-
.list(connection = Connection.new, **kwords) ⇒ Array<PublishedRepository>
List all published repositories.
Instance Method Summary collapse
-
#drop(**kwords) ⇒ Object
Drops a published repository.
-
#initialize(*args) ⇒ PublishedRepository
constructor
A new instance of PublishedRepository.
-
#update!(**kwords) ⇒ self?
Update this published repository using new contents of Sources.
Constructor Details
#initialize(*args) ⇒ PublishedRepository
Returns a new instance of PublishedRepository.
11 12 13 14 |
# File 'lib/aptly/publish.rb', line 11 def initialize(*args) super(*args) self.Sources.collect! { |s| Repository.new(connection, s) } end |
Class Method Details
.list(connection = Connection.new, **kwords) ⇒ Array<PublishedRepository>
List all published repositories.
40 41 42 43 44 45 |
# File 'lib/aptly/publish.rb', line 40 def list(connection = Connection.new, **kwords) kwords = kwords.map { |k, v| [k.to_s.capitalize, v] }.to_h response = connection.send(:get, '/publish', query: kwords) JSON.parse(response.body).collect { |h| new(connection, h) } end |
Instance Method Details
#drop(**kwords) ⇒ Object
Drops a published repository. This removes the published repository but leaves its soures intact.
18 19 20 21 |
# File 'lib/aptly/publish.rb', line 18 def drop(**kwords) connection.send(:delete, "/publish/#{self.Prefix}/#{self.Distribution}", query: kwords) end |
#update!(**kwords) ⇒ self?
Note:
this possibly mutates the attributes depending on the HTTP response
Update this published repository using new contents of Sources
27 28 29 30 31 32 33 34 35 |
# File 'lib/aptly/publish.rb', line 27 def update!(**kwords) response = connection.send(:put, "/publish/#{self.Prefix}/#{self.Distribution}", body: JSON.generate(kwords)) hash = JSON.parse(response.body) return nil if hash == marshal_dump marshal_load(hash) self end |