Class: ArtRest::System
- Defined in:
- lib/artrest/system.rb,
lib/artrest/system_general_configuration.rb
Overview
Represents the Artifactory System resource. Its content is a formatted multiline string listing
-
Java version used
-
Memory consumption
-
…
Example
sysInfo = ArtRest::System.new('http://localhost:8081/artifactory/api/system', { ... })
Defined Under Namespace
Classes: GeneralConfiguration
Class Method Summary collapse
-
.get(base_url, options) ⇒ Object
Shortcut method to retrieve the ArtRest::System resource.
-
.matches_path(path, options) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#configuration ⇒ Object
Get this system resource’s general configuration subresource, i.e.
-
#ping ⇒ Object
Get this system resource’s ping subresource, i.e.
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::System resource.
-
Args :
-
base_url
-> Our Artifactory server’s base URL -
options
-> A Hash containing username and password
-
-
Returns :
-
The ArtRest::System resource
-
28 29 30 |
# File 'lib/artrest/system.rb', line 28 def get(base_url, ) System.new("#{base_url}/api/system", ) end |
.matches_path(path, options) ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/artrest/system.rb', line 32 def matches_path(path, ) # :nodoc: path =~ %r|^/api/system/?$| end |
Instance Method Details
#configuration ⇒ Object
Get this system resource’s general configuration subresource, i.e. the resource representing Artifactory’s artifactory.config.xml
file.
-
Returns :
-
Artifactory’s general configuration, represented as an instance of ArtRest::System::GeneralConfiguration
-
70 71 72 |
# File 'lib/artrest/system.rb', line 70 def configuration ArtRest::System::GeneralConfiguration.new("#{base_url}/api/system/configuration", , block) end |
#ping ⇒ Object
Get this system resource’s ping subresource, i.e. issue a ping request to test whether the Artifactory server this resource represents is still in a healthy state.
Returns the plain RestClient::Response object returned by the server. In case the server is functioning properly this response will carry an HTTP 200 return code, and its body will contain the string “OK”. Otherwise, the response returned will carry a return code from the 5xx family, and its body will be a text describing the problem.
-
Returns :
-
The plain RestClient::Response object as returned by the server
-
53 54 55 56 57 58 59 60 |
# File 'lib/artrest/system.rb', line 53 def ping # Directly accessing the ping resource from this resource contravenes # our design. For consistency reasons, we ought to explicitly model # this ping resource as e.g. an instance of ArtRest::SystemPing. # However, here we try to strike a balance between perfectionism # and pragmatism and lean towards the latter. RestClient::Resource.new("#{base_url}/api/system/ping", user, password).get end |