Class: Runcible::Resources::RepositoryGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/runcible/resources/repository_group.rb

Overview

Instance Attribute Summary

Attributes inherited from Base

#logs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #exception_to_log, #format_payload_json, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #log_info, #logger, #path, #process_response, #required_params

Constructor Details

This class inherits a constructor from Runcible::Base

Class Method Details

.path(id = nil) ⇒ String

Generates the API path for Repository Groups

Parameters:

  • id (String) (defaults to: nil)

    the ID of the Repository group

Returns:

  • (String)

    the Repository group path, may contain the id if passed



11
12
13
14
# File 'lib/runcible/resources/repository_group.rb', line 11

def self.path(id = nil)
  groups = 'repo_groups/'
  id.nil? ? groups : groups + "#{id}/"
end

Instance Method Details

#associate(id, criteria) ⇒ RestClient::Response

Associates Repositories with a Repository Group

Parameters:

  • id (String)

    the ID of the Repository group

  • criteria (Hash)

    criteria based on Mongo syntax representing repos to associate

Returns:

  • (RestClient::Response)


62
63
64
# File 'lib/runcible/resources/repository_group.rb', line 62

def associate(id, criteria)
  call(:post, path(id) + 'actions/associate/', :payload => {:required => criteria})
end

#create(id, optional = {}) ⇒ RestClient::Response

Creates a Repository Group

Parameters:

  • id (String)

    the ID of the group

  • optional (Hash) (defaults to: {})

    container for all optional parameters

Returns:

  • (RestClient::Response)


21
22
23
24
# File 'lib/runcible/resources/repository_group.rb', line 21

def create(id, optional = {})
  required = required_params(binding.send(:local_variables), binding)
  call(:post, path, :payload => { :required => required, :optional => optional })
end

#delete(id) ⇒ RestClient::Response

Deletes a Repository Group

Parameters:

  • id (String)

    the ID of the Repository group

Returns:

  • (RestClient::Response)


53
54
55
# File 'lib/runcible/resources/repository_group.rb', line 53

def delete(id)
  call(:delete, path(id))
end

#publish(id, distributor_id, optional = {}) ⇒ RestClient::Response

Publishes a repository group using the specified distributor

Parameters:

  • id (String)

    the id of the repository

  • distributor_id (String)

    the id of the distributor

  • optional (Hash) (defaults to: {})

    optional params

Returns:

  • (RestClient::Response)


81
82
83
84
# File 'lib/runcible/resources/repository_group.rb', line 81

def publish(id, distributor_id, optional = {})
  call(:post, "#{path(id)}actions/publish/",
       :payload => {:required => {:id => distributor_id}, :optional => optional})
end

#retrieve(id) ⇒ RestClient::Response

Retrieves a Repository Group

Parameters:

  • id (String)

    the ID of the Repository group

Returns:

  • (RestClient::Response)


30
31
32
# File 'lib/runcible/resources/repository_group.rb', line 30

def retrieve(id)
  call(:get, path(id))
end

#retrieve_allRestClient::Response

Retrieves all Repository Group

Returns:

  • (RestClient::Response)


45
46
47
# File 'lib/runcible/resources/repository_group.rb', line 45

def retrieve_all
  call(:get, path)
end

#retrieve_distributors(id) ⇒ RestClient::Response

Retrieves a Repository Group’s distributors

Parameters:

  • id (String)

    the ID of the Repository group

Returns:

  • (RestClient::Response)


38
39
40
# File 'lib/runcible/resources/repository_group.rb', line 38

def retrieve_distributors(id)
  call(:get, path(id) + 'distributors/')
end

#unassociate(id, criteria) ⇒ RestClient::Response

Unassociates Repositories with a Repository Group

Parameters:

  • id (String)

    the ID of the Repository group

  • criteria (Hash)

    criteria based on Mongo syntax representing repos ta unassociate

Returns:

  • (RestClient::Response)


71
72
73
# File 'lib/runcible/resources/repository_group.rb', line 71

def unassociate(id, criteria)
  call(:post, path(id) + 'actions/unassociate/', :payload => {:required => criteria})
end