lib/runcible/extensions/repository.rb in runcible-1.0.6 vs lib/runcible/extensions/repository.rb in runcible-1.0.7

- old
+ new

@@ -28,31 +28,31 @@ # Utility function that allows an importer to be added at repository creation time # # @param [String] id the id of the repository being created # @param [Hash, Runcible::Extensions::Importer] importer either a hash representing an importer or an Importer object - # @return [RestClient::Response] the created repository + # @return [RestClient::Response] the created repository def create_with_importer(id, importer) create_with_importer_and_distributors(id, importer) end # Utility function that allows distributors to be added at repository creation time # # @param [String] id the id of the repository being created # @param [Array] distributors an array of hashes representing distributors or an array of Distributor objects - # @return [RestClient::Response] the created repository + # @return [RestClient::Response] the created repository def create_with_distributors(id, distributors) create_with_importer_and_distributors(id, nil, distributors) end # Utility function that allows an importer and distributors to be added at repository creation time # # @param [String] id the id of the repository being created # @param [Hash, Runcible::Extensions::Importer] importer either a hash representing an importer or an Importer object # @param [Array] distributors an array of hashes representing distributors or an array of Distributor objects # @param [Hash] optional container for all optional parameters - # @return [RestClient::Response] the created repository + # @return [RestClient::Response] the created repository def create_with_importer_and_distributors(id, importer, distributors=[], optional={}) if importer.is_a?(Runcible::Models::Importer) optional[:importer_type_id] = importer.id optional[:importer_config] = importer.config else @@ -111,11 +111,11 @@ # Retrieves a set of repositories by their IDs # # @param [Array] repository_ids the repository ID # @return [RestClient::Response] the set of repositories requested def search_by_repository_ids(repository_ids) - criteria = {:filters => + criteria = {:filters => { "id" => {"$in" => repository_ids}} } search(criteria) end @@ -273,22 +273,22 @@ # Removes a scheduled sync from a repository # # @param [String] repo_id the ID of the repository # @param [String] type the importer type - # @return [RestClient::Response] + # @return [RestClient::Response] def remove_schedules(repo_id, type) schedules = Runcible::Resources::RepositorySchedule.new(self.config).list(repo_id, type) schedules.each do |schedule| Runcible::Resources::RepositorySchedule.new(self.config).delete(repo_id, type, schedule['_id']) end end # Publishes a repository for all of it's distributors # # @param [String] repo_id the ID of the repository - # @return [RestClient::Response] set of tasks representing each publish + # @return [RestClient::Response] set of tasks representing each publish def publish_all(repo_id) to_ret = [] retrieve_with_details(repo_id)['distributors'].each do |d| to_ret << publish(repo_id, d['id']) end @@ -299,9 +299,20 @@ # # @param [String] repo_id the ID of the repository # @return [RestClient::Response] the repository with full details def retrieve_with_details(repo_id) retrieve(repo_id, {:details => true}) + end + + # Regenerate the applicability for consumers bound to a given set of repositories + # + # @param [String, Array] ids array of repo ids + # @return [RestClient::Response] + def regenerate_applicability_by_ids(ids) + criteria = { + 'repo_criteria' => { 'filters' => { 'id' => { '$in' => ids } } } + } + regenerate_applicability(criteria) end end end end