class Runcible::Resources::Repository

@see docs.pulpproject.org/dev-guide/integration/rest-api/repo/index.html

Public Class Methods

path(id = nil) click to toggle source

Generates the API path for Repositories

@param [String] id the id of the repository @return [String] the repository path, may contain the id if passed

# File lib/runcible/resources/repository.rb, line 11
def self.path(id = nil)
  id.nil? ? 'repositories/' : "repositories/#{id}/"
end

Public Instance Methods

associate_distributor(id, distributor_type_id, distributor_config, optional = {}) click to toggle source

Associates a distributor to a repository

@param [String] id the ID of the repository @param [String] distributor_type_id the type ID of the distributor being associated @param [Hash] distributor_config configuration options for the distributor @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 87
def associate_distributor(id, distributor_type_id, distributor_config, optional = {})
  required = required_params(binding.send(:local_variables), binding, ['id'])
  call(:post, path("#{id}/distributors"), :payload => { :required => required, :optional => optional })
end
associate_importer(id, importer_type_id, importer_config) click to toggle source

Associates an importer to a repository

@param [String] id the ID of the repository @param [String] importer_type_id the type ID of the importer being associated @param [Hash] importer_config configuration options for the importer @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 75
def associate_importer(id, importer_type_id, importer_config)
  required = required_params(binding.send(:local_variables), binding)
  call(:post, path("#{id}/importers"), :payload => { :required => required })
end
create(id, optional = {}) click to toggle source

Creates a repository

@param [String] id the id of the repository @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 20
def create(id, optional = {})
  required = required_params(binding.send(:local_variables), binding)
  call(:post, path, :payload => { :required => required, :optional => optional })
end
delete(id) click to toggle source

Deletes a repository

@param [String] id the id of the repository @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 47
def delete(id)
  call(:delete, path(id))
end
delete_distributor(id, distributor_id) click to toggle source

Deletes the specified distributor from the repository

@param [String] id the id of the repository @param [String] distributor_id the id of the distributor @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 166
def delete_distributor(id, distributor_id)
  call(:delete, "#{path(id)}/distributors/#{distributor_id}/")
end
delete_importer(id, importer_id) click to toggle source

Deletes the specified importer from the repository

@param [String] id the id of the repository @param [String] importer_id the id of the importer @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 186
def delete_importer(id, importer_id)
  call(:delete, "#{path(id)}/importers/#{importer_id}/")
end
download(id, optional = {}) click to toggle source

Downloads all units in a repository (useful in the case of on_demand repositories)

@param [String] id the id of the repository @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 106
def download(id, optional = {})
  call(:post, "#{path(id)}actions/download/", :payload => { :optional => optional })
end
publish(id, distributor_id, optional = {}) click to toggle source

Publishes a repository using the specified distributor

@param [String] id the id of the repository @param [String] distributor_id the id of the distributor @param [Hash] optional optional params @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 156
def publish(id, distributor_id, optional = {})
  call(:post, "#{path(id)}actions/publish/",
       :payload => {:required => {:id => distributor_id}, :optional => optional})
end
regenerate_applicability(options = {}) click to toggle source

Regenerate the applicability for consumers bound to a given set of repositories

@param [Hash] options payload representing criteria @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 205
def regenerate_applicability(options = {})
  call(:post, path('actions/content/regenerate_applicability/'), :payload => { :required => options})
end
retrieve(id, params = {}) click to toggle source

Retrieves a repository

@param [String] id the id of the repository @param [Hash] params container for optional query parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 30
def retrieve(id, params = {})
  call(:get, path(id), :params => params)
end
retrieve_all(optional = {}) click to toggle source

Retrieve all repositories

@param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 55
def retrieve_all(optional = {})
  call(:get, path, :payload => { :optional => optional })
end
sync(id, optional = {}) click to toggle source

Syncs a repository

@param [String] id the id of the repository @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 97
def sync(id, optional = {})
  call(:post, "#{path(id)}actions/sync/", :payload => { :optional => optional })
end
sync_history(id) click to toggle source

History of all sync actions on a repository

@param [String] id the id of the repository @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 114
def sync_history(id)
  call(:get, "#{path(id)}/history/sync/")
end
unassociate_units(source_repo_id, criteria = {}) click to toggle source

Unassociates units from the repository

@param [String] source_repo_id the id of the source repository @param [Hash] criteria criteria object containing Mongo syntax @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 135
def unassociate_units(source_repo_id, criteria = {})
  required = required_params(binding.send(:local_variables), binding, ['source_repo_id'])
  call(:post, "#{path(source_repo_id)}actions/unassociate/",
       :payload => { :required => required })
end
unit_copy(destination_repo_id, source_repo_id, optional = {}) click to toggle source

Copies units from one repository to another

@param [String] destination_repo_id the id of the destination repository @param [String] source_repo_id the id of the source repository @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 124
def unit_copy(destination_repo_id, source_repo_id, optional = {})
  required = required_params(binding.send(:local_variables), binding, ['destination_repo_id'])
  call(:post, "#{path(destination_repo_id)}actions/associate/",
       :payload => { :required => required, :optional => optional })
end
update(id, optional = {}) click to toggle source

Updates a repository

@param [String] id the id of the repository @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 39
def update(id, optional = {})
  call(:put, path(id), :payload => { :delta => optional })
end
update_distributor(id, distributor_id, distributor_config, optional = {}) click to toggle source

Updates the specified distributor from the repository

@param [String] id the id of the repository @param [String] distributor_id the id of the distributor @param [Hash] distributor_config attributes to change @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 176
def update_distributor(id, distributor_id, distributor_config, optional = {})
  required = required_params(binding.send(:local_variables), binding, ['id', 'distributor_id'])
  call(:put, path("#{id}/distributors/#{distributor_id}/"), :payload => { :required => required, :optional => optional})
end
update_importer(id, importer_id, importer_config) click to toggle source

Updates the specified distributor from the repository

@param [String] id the id of the repository @param [String] importer_id the id of the importer @param [Hash] importer_config attributes to change @return [RestClient::Response]

# File lib/runcible/resources/repository.rb, line 196
def update_importer(id, importer_id, importer_config)
  required = required_params(binding.send(:local_variables), binding, ['id', 'importer_id'])
  call(:put, path("#{id}/importers/#{importer_id}/"), :payload => { :required => required})
end