Class: Copyleaks::ErrorWebhook

Inherits:
StatusWebhook show all
Defined in:
lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb

Instance Attribute Summary collapse

Attributes inherited from StatusWebhook

#status

Attributes inherited from Webhook

#developerPayload

Instance Method Summary collapse

Constructor Details

#initialize(error: nil, **args) ⇒ ErrorWebhook

Returns a new instance of ErrorWebhook.



24
25
26
27
# File 'lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb', line 24

def initialize(error: nil, **args)
  super(**args)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

Instance Method Details

#as_json(*_args) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb', line 29

def as_json(*_args)
  super.merge(
    {
      error: @error.respond_to?(:as_json) ? @error.as_json : @error
    }
  )
end

#to_json(*options) ⇒ Object



37
38
39
# File 'lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb', line 37

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