Class: KPM::NexusFacade::CloudsmithApiCalls

Inherits:
NexusApiCallsV2 show all
Defined in:
lib/kpm/nexus_helper/cloudsmith_api_calls.rb

Constant Summary

Constants inherited from NexusApiCallsV2

NexusApiCallsV2::ERROR_MESSAGE_404, NexusApiCallsV2::OPEN_TIMEOUT_DEFAULT, NexusApiCallsV2::READ_TIMEOUT_DEFAULT

Instance Attribute Summary

Attributes inherited from NexusApiCallsV2

#configuration, #logger, #ssl_verify, #version

Instance Method Summary collapse

Methods inherited from NexusApiCallsV2

#initialize, #pull_artifact, #search_for_artifacts

Constructor Details

This class inherits a constructor from KPM::NexusFacade::NexusApiCallsV2

Instance Method Details

#build_query_params(_coordinates, _what_parameters = nil) ⇒ Object



58
59
60
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 58

def build_query_params(_coordinates, _what_parameters = nil)
  ''
end

#get_artifact_info(coordinates) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 29

def get_artifact_info(coordinates)
  super

  _, versioned_artifact, coords = build_base_path_and_coords(coordinates)
  sha1 = get_sha1(coordinates)
  "<artifact-resolution>
  <data>
    <presentLocally>true</presentLocally>
    <groupId>#{coords[:group_id]}</groupId>
    <artifactId>#{coords[:artifact_id]}</artifactId>
    <version>#{coords[:version]}</version>
    <extension>#{coords[:packaging]}</extension>
    <snapshot>#{!(coords[:version] =~ /-SNAPSHOT$/).nil?}</snapshot>
    <sha1>#{sha1}</sha1>
    <repositoryPath>/#{coords[:group_id].gsub('.', '/')}/#{versioned_artifact}</repositoryPath>
  </data>
</artifact-resolution>"
end

#get_artifact_info_endpoint(coordinates) ⇒ Object



48
49
50
51
52
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 48

def get_artifact_info_endpoint(coordinates)
  base_path, _, coords = build_base_path_and_coords(coordinates)
  # Note: we must retrieve the XML for the version, to support SNAPSHOTs
  "#{base_path}/#{coords[:version]}/maven-metadata.xml"
end

#parent_get_artifact_infoObject



28
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 28

alias parent_get_artifact_info get_artifact_info

#pull_artifact_endpoint(coordinates) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 11

def pull_artifact_endpoint(coordinates)
  version_artifact_details = parent_get_artifact_info(coordinates)

  # For SNAPSHOTs, we need to figure out the version used as part of the filename
  filename_version = begin
                       REXML::Document.new(version_artifact_details).elements['//versioning/snapshotVersions/snapshotVersion[1]/value'].text
                     rescue StandardError
                       nil
                     end
  coords = parse_coordinates(coordinates)
  coords[:version] = filename_version unless filename_version.nil?
  new_coordinates = coords.values.compact.join(':')

  base_path, versioned_artifact, = build_base_path_and_coords(new_coordinates)
  "#{base_path}/#{versioned_artifact}"
end

#search_for_artifact_endpoint(_coordinates) ⇒ Object

Raises:

  • (NoMethodError)


54
55
56
# File 'lib/kpm/nexus_helper/cloudsmith_api_calls.rb', line 54

def search_for_artifact_endpoint(_coordinates)
  raise NoMethodError, 'Cloudsmith has no search support'
end