Class: Spandx::Java::Gateway

Inherits:
Core::Gateway show all
Defined in:
lib/spandx/java/gateway.rb

Constant Summary collapse

DEFAULT_SOURCE =
'https://repo.maven.apache.org/maven2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Registerable

#all, #each, #inherited, #registry

Constructor Details

#initialize(http: Spandx.http) ⇒ Gateway

Returns a new instance of Gateway.



10
11
12
# File 'lib/spandx/java/gateway.rb', line 10

def initialize(http: Spandx.http)
  @http = http
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



8
9
10
# File 'lib/spandx/java/gateway.rb', line 8

def http
  @http
end

Instance Method Details

#licenses_for(dependency) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/spandx/java/gateway.rb', line 18

def licenses_for(dependency)
  group_id, artifact_id = dependency.name.split(':')
  (
    group_id: group_id,
    artifact_id: artifact_id,
    version: dependency.version
  ).licenses
end

#matches?(dependency) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/spandx/java/gateway.rb', line 14

def matches?(dependency)
  dependency.package_manager == :maven
end

#metadata_for(group_id:, artifact_id:, version:) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/spandx/java/gateway.rb', line 27

def (group_id:, artifact_id:, version:)
  ::Spandx::Java::Metadata.new(
    artifact_id: artifact_id,
    group_id: group_id,
    version: version,
    source: DEFAULT_SOURCE
  )
end