Class: Copyleaks::Notifications
- Inherits:
-
Object
- Object
- Copyleaks::Notifications
- Defined in:
- lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb
Instance Attribute Summary collapse
-
#alerts ⇒ Object
readonly
Returns the value of attribute alerts.
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(alerts: nil) ⇒ Notifications
constructor
A new instance of Notifications.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(alerts: nil) ⇒ Notifications
Returns a new instance of Notifications.
25 26 27 28 29 30 31 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb', line 25 def initialize(alerts: nil) if !alerts.nil? && !(alerts.is_a?(Array) && alerts.all? { |a| a.is_a?(Alerts) }) raise 'Copyleaks::Notifications - alerts must be an array of Alerts objects' end @alerts = alerts end |
Instance Attribute Details
#alerts ⇒ Object (readonly)
Returns the value of attribute alerts.
22 23 24 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb', line 22 def alerts @alerts end |
Instance Method Details
#as_json(*_args) ⇒ Object
33 34 35 36 37 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb', line 33 def as_json(*_args) { alerts: @alerts }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
39 40 41 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb', line 39 def to_json(*) as_json(*).to_json(*) end |