class Copyleaks::CopyleaksDeleteRequestModel

Attributes

completionWebhook[R]
purge[R]
scans[R]

Public Class Methods

new(scans, purge = false, completionWebhook = '') click to toggle source

@param [Array] scans The list of scans to delete @param [Boolean] purge Delete all trace of the scan from Copyleaks server, including from internal database. A purged process will not be available as a result for previous scans. @param [String] completionWebhook Allows you to register to a webhook that will be fired once the removal has been completed. Make sure that your endpoint is listening to a POST method (no body parameters were supplied).

# File lib/copyleaks/models/delete_request_model.rb, line 32
def initialize(scans, purge = false, completionWebhook = '')
  scans.each do |object_id|
    unless object_id.instance_of?(IdObject)
      raise 'Copyleaks::CopyleaksDeleteRequestModel - scans - entity must be of type Copyleaks::IdObject'
    end
  end

  unless [true, false].include? purge
    raise 'Copyleaks::CopyleaksDeleteRequestModel - purge - purge must be of type Boolean'
  end

  unless completionWebhook.instance_of?(String)
    raise 'Copyleaks::CopyleaksDeleteRequestModel - completionWebhook - completionWebhook must be of type String'
  end

  @scans = scans
  @purge = purge
  @completionWebhook = completionWebhook
end

Public Instance Methods

as_json(*_args) click to toggle source
# File lib/copyleaks/models/delete_request_model.rb, line 52
def as_json(*_args)
  {
    scans: @scans.map { |object_id| object_id.as_json },
    purge: @purge,
    completionWebhook: @completionWebhook
  }.select { |_k, v| !v.nil? }
end
to_json(*options) click to toggle source
# File lib/copyleaks/models/delete_request_model.rb, line 60
def to_json(*options)
  as_json(*options).to_json(*options)
end