class Copyleaks::CopyleaksStartRequestModel

Attributes

errorHandling[R]
trigger[R]

Public Class Methods

new(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE) click to toggle source

@param string[] trigger A list of scans that you submitted for a check-credits scan and that you would like to submit for a full scan. @param CopyleaksStartErrorHandlings errorHandling When set to ignore (ignore = 1) the trigger scans will start running even if some of them are in error mode, when set to cancel (cancel = 0) the request will be cancelled if any error was found.

# File lib/copyleaks/models/start_request_model.rb, line 30
def initialize(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE)
  trigger.each do |item|
    unless item.instance_of?(String)
      raise 'Copyleaks::CopyleaksStartRequestModel - trigger - entity must be of type String'
    end
  end

  unless [0, 1].include? errorHandling
    raise 'Copyleaks::CopyleaksStartRequestModel - errorHandling - errorHandling must be of type Copyleaks::CopyleaksStartErrorHandlings Consts'
  end

  @trigger = trigger
  @errorHandling = errorHandling
end

Public Instance Methods

as_json(*_args) click to toggle source
# File lib/copyleaks/models/start_request_model.rb, line 45
def as_json(*_args)
  {
    trigger: @trigger,
    errorHandling: @errorHandling
  }.select { |_k, v| !v.nil? }
end
to_json(*options) click to toggle source
# File lib/copyleaks/models/start_request_model.rb, line 52
def to_json(*options)
  as_json(*options).to_json(*options)
end