-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathRubyGemsComponent.cs
More file actions
37 lines (28 loc) · 1.14 KB
/
RubyGemsComponent.cs
File metadata and controls
37 lines (28 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#nullable disable
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using System.Text.Json.Serialization;
using PackageUrl;
public class RubyGemsComponent : TypedComponent
{
public RubyGemsComponent()
{
/* Reserved for deserialization */
}
public RubyGemsComponent(string name, string version, string source = "")
{
this.Name = this.ValidateRequiredInput(name, nameof(this.Name), nameof(ComponentType.RubyGems));
this.Version = this.ValidateRequiredInput(version, nameof(this.Version), nameof(ComponentType.RubyGems));
this.Source = source;
}
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; }
[JsonPropertyName("source")]
public string Source { get; set; }
[JsonIgnore]
public override ComponentType Type => ComponentType.RubyGems;
[JsonPropertyName("packageUrl")]
public override PackageURL PackageUrl => new PackageURL("gem", null, this.Name, this.Version, null, null);
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}