class Artifactory::Resource::URLBase
Public Class Methods
all(options = {})
click to toggle source
List UrlBase in the system configuration.
@param [Hash] options
the list of options
@option options [Artifactory::Client] :client
the client object to make the request with
@return [Array<Resource::URLBase>]
the list of UrlBases
# File lib/artifactory/resources/url_base.rb, line 34 def all(options = {}) config = Resource::System.configuration(options) simple_text_from_config("config/urlBase", config, options) end
find(url, options = {})
click to toggle source
Find (fetch) the url base.
@example Find a URLBase
by its url_base.
url_base.find('http://33.33.33.20/artifactory') #=> #<URLBase url_base: 'http://33.33.33.20/artifactory' ...>
@param [String] url
the base url to find
@param [Hash] options
the list of options
@option options [Artifactory::Client] :client
the client object to make the request with
@return [Resource::MailServer, nil]
an instance of the mail server that matches the given host, or +nil+ if one does not exist
# File lib/artifactory/resources/url_base.rb, line 57 def find(url, options = {}) config = Resource::System.configuration(options) find_from_config("config/urlBase[text()='#{url}']", config, options) rescue Error::HTTPError => e raise unless e.code == 404 nil end
Private Class Methods
simple_text_from_config(xpath, config, options = {})
click to toggle source
List all the text elements in the Artifactory
configuration file matching the given xpath. Ignore any children of elements that match the xpath.
@param [String] xpath
xpath expression for which matches are to be listed
@param [REXML] config
Artifactory config as an REXML file
@param [Hash] options
the list of options
# File lib/artifactory/resources/url_base.rb, line 81 def simple_text_from_config(xpath, config, options = {}) REXML::XPath.match(config, xpath).map do |r| hash = {} hash[r.name] = r.text from_hash(hash, options) end end