Class: Copyleaks::CompletedWebhook

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

Instance Attribute Summary collapse

Attributes inherited from StatusWebhook

#status

Attributes inherited from Webhook

#developerPayload

Instance Method Summary collapse

Constructor Details

#initialize(results: nil, notifications: nil, scannedDocument: nil, **args) ⇒ CompletedWebhook

Returns a new instance of CompletedWebhook.



24
25
26
27
28
29
30
# File 'lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb', line 24

def initialize(results: nil, notifications: nil, scannedDocument: nil, **args)
  super(**args)
  @results = results
  @notifications = notifications
  @scannedDocument = scannedDocument
  @extra_fields = args # Store any additional fields here
end

Instance Attribute Details

#notificationsObject (readonly)

Returns the value of attribute notifications.



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

def notifications
  @notifications
end

#resultsObject (readonly)

Returns the value of attribute results.



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

def results
  @results
end

#scannedDocumentObject (readonly)

Returns the value of attribute scannedDocument.



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

def scannedDocument
  @scannedDocument
end

Instance Method Details

#as_json(*_args) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb', line 32

def as_json(*_args)
  super.merge(
    {
      results: @results.respond_to?(:as_json) ? @results.as_json : @results,
      notifications: @notifications.respond_to?(:as_json) ? @notifications.as_json : @notifications,
      scannedDocument: @scannedDocument.respond_to?(:as_json) ? @scannedDocument.as_json : @scannedDocument
    }
  ).merge(@extra_fields)
end

#to_json(*options) ⇒ Object



42
43
44
# File 'lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb', line 42

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