Class: Copyleaks::Alerts

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category:, code:, title:, message:, helpLink:, severity:, additionalData:) ⇒ Alerts

Returns a new instance of Alerts.

Parameters:

  • $category (int)
    • Scan alert category.

  • $title (string)
    • Scan alert human-readable title.

  • $message (string)
    • Provides human-readable information about the scan alert.

  • $helpLink (string|null)
    • URL to a resource describing the specific scan alert.

  • $severity (int)
    • Specifies the importance of the scan alert.

  • $additionalData (string)
    • Additional data about the scan alert. Supplied as a JSON string.

  • $code (string)
    • Scan alert code. The code is unique for each scan alert.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 31

def initialize(category:, code:, title:, message:, helpLink:, severity:, additionalData:)
  raise 'Copyleaks::Alerts - category must be a String' unless category.is_a?(String)
  raise 'Copyleaks::Alerts - code must be a String' unless code.is_a?(String)
  raise 'Copyleaks::Alerts - title must be a String' unless title.is_a?(String)
  raise 'Copyleaks::Alerts - message must be a String' unless message.is_a?(String)
  raise 'Copyleaks::Alerts - helpLink must be a String' unless helpLink.is_a?(String)
  raise 'Copyleaks::Alerts - severity must be a String' unless severity.is_a?(String)
  raise 'Copyleaks::Alerts - additionalData must be a String' unless additionalData.is_a?(String)

  @category = category
  @code = code
  @title = title
  @message = message
  @helpLink = helpLink
  @severity = severity
  @additionalData = additionalData
end

Instance Attribute Details

#additionalDataObject (readonly)

Returns the value of attribute additionalData.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def additionalData
  @additionalData
end

#categoryObject (readonly)

Returns the value of attribute category.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def category
  @category
end

#codeObject (readonly)

Returns the value of attribute code.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def code
  @code
end

Returns the value of attribute helpLink.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def helpLink
  @helpLink
end

#messageObject (readonly)

Returns the value of attribute message.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def message
  @message
end

#severityObject (readonly)

Returns the value of attribute severity.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def severity
  @severity
end

#titleObject (readonly)

Returns the value of attribute title.



22
23
24
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 22

def title
  @title
end

Instance Method Details

#as_json(*_args) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 49

def as_json(*_args)
  {
    category: @category,
    code: @code,
    title: @title,
    message: @message,
    helpLink: @helpLink,
    severity: @severity,
    additionalData: @additionalData
  }
end

#to_json(*options) ⇒ Object



61
62
63
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb', line 61

def to_json(*options)
  as_json(*options).to_json(*options)
end