Sha256: 3fea8fef332c85737e8e6c6cd8685de86ce8d659a31e638b6986d7156f2531a8
Contents?: true
Size: 993 Bytes
Versions: 7
Compression:
Stored size: 993 Bytes
Contents
# frozen_string_literal: true module Spandx module Java class Metadata attr_reader :artifact_id, :group_id, :version def initialize(artifact_id:, group_id:, version:) @artifact_id = artifact_id @group_id = group_id.tr('.', '/') @version = version end def licenses pom.search('//licenses/license').map do |node| { name: node.at_xpath('./name').text, url: node.at_xpath('./url').text } end end private def pom @pom ||= fetch end def spec_url [ 'https://repo.maven.apache.org/maven2', group_id, artifact_id, version, "#{artifact_id}-#{version}.pom" ].join('/') end def fetch response = Spandx.http.get(spec_url) return unless Spandx.http.ok?(response) Nokogiri.XML(response.body).tap(&:remove_namespaces!) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems