Class: ArtRest::Repositories

Inherits:
Resources show all
Defined in:
lib/artrest/repositories.rb

Overview

Represents an Artifactory Repositories resource.

Example

repos = ArtRest::Repositories.new('http://localhost:8081/artifactory/api/repositories', { ... })

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resources

#each, resources_creator=

Methods inherited from Resource

#[], #base_url, check_options, #content, #content!, #content=, create, inherited, #initialize, mime_type=, resource_attributes, #unparsed_content

Constructor Details

This class inherits a constructor from ArtRest::Resource

Class Method Details

.get(base_url, options) ⇒ Object

Shortcut method to retrieve the ArtRest::Repositories instance.

  • Args :

    • base_url -> Our Artifactory server’s base URL

    • options -> A Hash containing username and password

  • Returns :

    • The ArtRest::Repositories instance representing the collection of all Artifactory repositories



27
28
29
# File 'lib/artrest/repositories.rb', line 27

def get(base_url, options)
    Repositories.new("#{base_url}/api/repositories", options)
end

.matches_path(path, options) ⇒ Object

:nodoc:



31
32
33
# File 'lib/artrest/repositories.rb', line 31

def matches_path(path, options) # :nodoc:
    path =~ %r|^/api/repositories/?$|
end

Instance Method Details

#repository(repo_name) {|repo| ... } ⇒ Object

Look up and return the repository named repo_name. Optionally yield that repository to a block provided a block is given.

  • Args :

[+repo_name+] Name of the repository to return
  • Returns :

    • The repository named repo_name, an ArtRest::Repository instance

  • Raises :

[+RestClient::ResourceNotFound+] If +repo_name+ does not point to an
                                 existing repository

Yields:

  • (repo)


54
55
56
57
58
59
# File 'lib/artrest/repositories.rb', line 54

def repository(repo_name) # :yields: repository
    repo_url = concat_urls(base_url, "/#{repo_name}/")
    repo = ArtRest::Repository.new(repo_url, options, block)
    yield repo if block_given?
    repo
end