Class: Copyleaks::SubmissionIndexingRepository

Inherits:
SubmissionRepository show all
Defined in:
lib/copyleaks/models/submissions/properties/indexing_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(id, maskingPolicy = nil) ⇒ SubmissionIndexingRepository

Returns a new instance of SubmissionIndexingRepository.

Parameters:

  • ID (String)

    of a repository to add the scanned document to.

  • maskingPolicy (SubmissionMaskingPolicy) (defaults to: nil)

    specify the document maskig ploicy.



31
32
33
34
35
36
37
# File 'lib/copyleaks/models/submissions/properties/indexing_repository.rb', line 31

def initialize(id, maskingPolicy = nil)
  super(id)
  if !maskingPolicy.nil? && ![0, 1, 2].include?(maskingPolicy)
      raise 'Copyleaks::SubmissionIndexingRepository - maskingPolicy - maskingPolicy must be of type SubmissionMaskingPolicy'
  end
  @maskingPolicy = maskingPolicy
end

Instance Method Details

#as_json(*_args) ⇒ Object



39
40
41
42
43
44
# File 'lib/copyleaks/models/submissions/properties/indexing_repository.rb', line 39

def as_json(*_args)
  {
      id: @id,
      maskingPolicy: @maskingPolicy,
  }.select { |_k, v| !v.nil? }
end

#to_json(*options) ⇒ Object



46
47
48
# File 'lib/copyleaks/models/submissions/properties/indexing_repository.rb', line 46

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