Class: KPM::NexusFacade::Actions
- Inherits:
-
Object
- Object
- KPM::NexusFacade::Actions
- Defined in:
- lib/kpm/nexus_helper/actions.rb
Constant Summary collapse
- DEFAULT_RETRIES =
3- DEFAULT_CONNECTION_ERRORS =
{ EOFError => 'The remote server dropped the connection', Errno::ECONNREFUSED => 'The remote server refused the connection', Errno::ECONNRESET => 'The remote server reset the connection', Timeout::Error => 'The connection to the remote server timed out', Errno::ETIMEDOUT => 'The connection to the remote server timed out', SocketError => 'The connection to the remote server could not be established', OpenSSL::X509::CertificateError => 'The remote server did not accept the provided SSL certificate', OpenSSL::SSL::SSLError => 'The SSL connection to the remote server could not be established', Zlib::BufError => 'The remote server replied with an invalid response', KPM::NexusFacade::UnexpectedStatusCodeException => nil }.freeze
Instance Attribute Summary collapse
-
#nexus_api_call ⇒ Object
readonly
Returns the value of attribute nexus_api_call.
Instance Method Summary collapse
- #get_artifact_info(coordinates) ⇒ Object
-
#initialize(overrides, ssl_verify, logger) ⇒ Actions
constructor
A new instance of Actions.
- #pull_artifact(coordinates, destination = nil) ⇒ Object
- #search_for_artifacts(coordinates) ⇒ Object
Constructor Details
#initialize(overrides, ssl_verify, logger) ⇒ Actions
Returns a new instance of Actions.
25 26 27 28 29 30 31 32 33 |
# File 'lib/kpm/nexus_helper/actions.rb', line 25 def initialize(overrides, ssl_verify, logger) overrides ||= {} overrides[:url] ||= 'https://oss.sonatype.org' overrides[:repository] ||= 'releases' @logger = logger @nexus_api_call = overrides[:url].start_with?('https://maven.pkg.github.com') ? GithubApiCalls.new(overrides, ssl_verify, logger) : NexusApiCallsV2.new(overrides, ssl_verify, logger) end |
Instance Attribute Details
#nexus_api_call ⇒ Object (readonly)
Returns the value of attribute nexus_api_call.
23 24 25 |
# File 'lib/kpm/nexus_helper/actions.rb', line 23 def nexus_api_call @nexus_api_call end |
Instance Method Details
#get_artifact_info(coordinates) ⇒ Object
39 40 41 |
# File 'lib/kpm/nexus_helper/actions.rb', line 39 def get_artifact_info(coordinates) retry_exceptions("get_artifact_info #{coordinates}") { nexus_api_call.get_artifact_info(coordinates) } end |
#pull_artifact(coordinates, destination = nil) ⇒ Object
35 36 37 |
# File 'lib/kpm/nexus_helper/actions.rb', line 35 def pull_artifact(coordinates, destination = nil) retry_exceptions("pull_artifact #{coordinates}") { nexus_api_call.pull_artifact(coordinates, destination) } end |
#search_for_artifacts(coordinates) ⇒ Object
43 44 45 |
# File 'lib/kpm/nexus_helper/actions.rb', line 43 def search_for_artifacts(coordinates) retry_exceptions("search_for_artifacts #{coordinates}") { nexus_api_call.search_for_artifacts(coordinates) } end |