Class: Copyleaks::SubmissionProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/properties/submission_properties.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(webhooks, includeHtml = nil, developerPayload = nil, sandbox = nil, expiration = nil, sensitivityLevel = nil, cheatDetection = nil, action = nil, author = nil, filters = nil, scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil, scanMethodAlgorithm = nil, aiGeneratedText = nil, customMetadata = nil) ⇒ SubmissionProperties

Returns a new instance of SubmissionProperties.

Parameters:

  • webhooks (SubmissionWebhooks)
    • Check inner properties for more details.

  • includeHtml (Boolean) (defaults to: nil)
    • By default, Copyleaks will present the report in text format. If set to true, Copyleaks will also include html format.

  • developerPayload (String) (defaults to: nil)
  • sandbox (Boolean) (defaults to: nil)
    • You can test the integration with the Copyleaks API for free using the sandbox mode. You will be able to submit content for a scan and get back mock results, simulating the way Copyleaks will work to make sure that you successfully integrated with the API. Turn off this feature on production environment.

  • expiration (Integer) (defaults to: nil)
    • Specify the maximum life span of a scan in hours on the Copyleaks servers. When expired, the scan will be deleted and will no longer be accessible.

  • sensitivityLevel (Integer) (defaults to: nil)
    • You can control the level of plagiarism sensitivity that will be identified according to the speed of the scan. If you prefer a faster scan with the results that contains the highest amount of plagiarism choose 1, and if a slower, more comprehensive scan, that will also detect the smallest instances choose 5.

  • cheatDetection (Boolean) (defaults to: nil)
    • When set to true the submitted document will be checked for cheating. If a cheating will be detected, a scan alert will be added to the completed webhook.

  • action (SubmissionActions) (defaults to: nil)
    • Types of content submission actions. Possible values: Scan: Start scan immediately. Check Credits: Check how many credits will be used for this scan. Index Only: Only index the file in the Copyleaks internal database. No credits will be used.

  • author (SubmissionAuthor) (defaults to: nil)
    • Check inner properties for more details.

  • filters (SubmissionFilter) (defaults to: nil)
    • Check inner properties for more details.

  • scanning (SubmissionScanning) (defaults to: nil)
    • Check inner properties for more details.

  • indexing (SubmissionIndexing) (defaults to: nil)
    • Check inner properties for more details.

  • exclude (SubmissionExclude) (defaults to: nil)
    • Check inner properties for more details.

  • pdf (SubmissionPDF) (defaults to: nil)
    • Check inner properties for more details.

  • sensitiveDataProtection (SubmissionSensitiveData) (defaults to: nil)
    • Check inner properties for more details.

  • scanMethodAlgorithm (SubmissionScanMethodAlgorithm) (defaults to: nil)
    • Check inner properties for more details.

  • aiGeneratedText (SubmissionAiGeneratedText) (defaults to: nil)
    • Check inner properties for more details.

  • customMetadata (SubmissionCustomMetadata) (defaults to: nil)
    • Add custom properties that will be attached to your document in a Copyleaks repository.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 48

def initialize(
  webhooks, includeHtml = nil, developerPayload = nil, sandbox = nil, expiration = nil,
  sensitivityLevel = nil, cheatDetection = nil, action = nil, author = nil, filters = nil,
  scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil,
  scanMethodAlgorithm = nil, aiGeneratedText = nil,  = nil
)
  unless webhooks.instance_of?(SubmissionWebhooks)
    raise 'Copyleaks::SubmissionProperties - webhooks - webhooks must be of type SubmissionWebhooks'
  end
  if !includeHtml.nil? && ![true, false].include?(includeHtml)
    raise 'Copyleaks::SubmissionProperties - includeHtml - includeHtml must be of type Boolean'
  end
  unless developerPayload.instance_of?(String)
    raise 'Copyleaks::SubmissionProperties - developerPayload - developerPayload must be of type String'
  end
  if !sandbox.nil? && ![true, false].include?(sandbox)
    raise 'Copyleaks::SubmissionProperties - sandbox - includeHtml must be of type Boolean'
  end
  unless expiration.instance_of?(Integer)
    raise 'Copyleaks::SubmissionProperties - expiration - expiration must be of type Integer'
  end
  unless sensitivityLevel.instance_of?(Integer)
    raise 'Copyleaks::SubmissionProperties - sensitivityLevel - sensitivityLevel must be of type Integer'
  end
  if !cheatDetection.nil? && ![true, false].include?(cheatDetection)
    raise 'Copyleaks::SubmissionProperties - cheatDetection - cheatDetection must be of type Boolean'
  end
  if !action.nil? && ![0, 1, 2].include?(action)
    raise 'Copyleaks::SubmissionProperties - action - action must be of type SubmissionActions consts'
  end
  if !author.nil? && !author.instance_of?(SubmissionAuthor)
    raise 'Copyleaks::SubmissionProperties - author - author must be of type SubmissionAuthor'
  end
  if !filters.nil? && !filters.instance_of?(SubmissionFilter)
    raise 'Copyleaks::SubmissionProperties - filters - filters must be of type SubmissionFilter'
  end
  if !scanning.nil? && !scanning.instance_of?(SubmissionScanning)
    raise 'Copyleaks::SubmissionProperties - scanning - scanning must be of type SubmissionScanning'
  end
  if !indexing.nil? && !indexing.instance_of?(SubmissionIndexing)
    raise 'Copyleaks::SubmissionProperties - indexing - indexing must be of type SubmissionIndexing'
  end
  if !exclude.nil? && !exclude.instance_of?(SubmissionExclude)
    raise 'Copyleaks::SubmissionProperties - exclude - exclude must be of type SubmissionExclude'
  end
  if !pdf.nil? && !pdf.instance_of?(SubmissionPDF)
    raise 'Copyleaks::SubmissionProperties - pdf - pdf must be of type SubmissionPDF'
  end
  if !sensitiveDataProtection.nil? && !sensitiveDataProtection.instance_of?(SubmissionSensitiveData)
    raise 'Copyleaks::SubmissionProperties - sensitiveDataProtection - sensitiveDataProtection must be of type SubmissionSensitiveData'
  end
  if !scanMethodAlgorithm.nil? && ![0, 1].include?(scanMethodAlgorithm)
    raise 'Copyleaks::SubmissionProperties - scanMethodAlgorithm - scanMethodAlgorithm must be of type SubmissionScanMethodAlgorithm'
  end
  if !aiGeneratedText.nil? && !aiGeneratedText.instance_of?(SubmissionAiGeneratedText)
    raise 'Copyleaks::SubmissionProperties - aiGeneratedText - aiGeneratedText must be of type SubmissionAiGeneratedText'
  end
  if !.nil? && !(.is_a?(Array) && .all? { |element| element.is_a?(SubmissionCustomMetadata) })
    raise 'Copyleaks::SubmissionProperties - customMetadata - customMetadata must be of type SubmissionCustomMetadata[]'
  end

  @webhooks = webhooks
  @includeHtml = includeHtml
  @developerPayload = developerPayload
  @sandbox = sandbox
  @expiration = expiration
  @sensitivityLevel = sensitivityLevel
  @cheatDetection = cheatDetection
  @aiGeneratedText = aiGeneratedText
  @action = action
  @author = author
  @filters = filters
  @scanning = scanning
  @indexing = indexing
  @exclude = exclude
  @pdf = pdf
  @sensitiveDataProtection = sensitiveDataProtection
  @scanMethodAlgorithm = scanMethodAlgorithm
  @customMetadata = 
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def action
  @action
end

#aiGeneratedTextObject (readonly)

Returns the value of attribute aiGeneratedText.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def aiGeneratedText
  @aiGeneratedText
end

#authorObject (readonly)

Returns the value of attribute author.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def author
  @author
end

#cheatDetectionObject (readonly)

Returns the value of attribute cheatDetection.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def cheatDetection
  @cheatDetection
end

#customMetadataObject (readonly)

Returns the value of attribute customMetadata.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def 
  @customMetadata
end

#developerPayloadObject (readonly)

Returns the value of attribute developerPayload.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def developerPayload
  @developerPayload
end

#excludeObject (readonly)

Returns the value of attribute exclude.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def exclude
  @exclude
end

#expirationObject (readonly)

Returns the value of attribute expiration.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def expiration
  @expiration
end

#filtersObject (readonly)

Returns the value of attribute filters.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def filters
  @filters
end

#includeHtmlObject (readonly)

Returns the value of attribute includeHtml.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def includeHtml
  @includeHtml
end

#indexingObject (readonly)

Returns the value of attribute indexing.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def indexing
  @indexing
end

#pdfObject (readonly)

Returns the value of attribute pdf.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def pdf
  @pdf
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def sandbox
  @sandbox
end

#scanMethodAlgorithmObject (readonly)

Returns the value of attribute scanMethodAlgorithm.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def scanMethodAlgorithm
  @scanMethodAlgorithm
end

#scanningObject (readonly)

Returns the value of attribute scanning.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def scanning
  @scanning
end

#sensitiveDataProtectionObject (readonly)

Returns the value of attribute sensitiveDataProtection.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def sensitiveDataProtection
  @sensitiveDataProtection
end

#sensitivityLevelObject (readonly)

Returns the value of attribute sensitivityLevel.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def sensitivityLevel
  @sensitivityLevel
end

#webhooksObject (readonly)

Returns the value of attribute webhooks.



26
27
28
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 26

def webhooks
  @webhooks
end

Instance Method Details

#as_json(*_args) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 129

def as_json(*_args)
  {
    webhooks: @webhooks,
    includeHtml: @includeHtml,
    developerPayload: @developerPayload,
    sandbox: @sandbox,
    expiration: @expiration,
    sensitivityLevel: @sensitivityLevel,
    cheatDetection: @cheatDetection,
    aiGeneratedText: @aiGeneratedText,
    action: @action,
    author: @author,
    filters: @filters,
    scanning: @scanning,
    indexing: @indexing,
    exclude: @exclude,
    pdf: @pdf,
    sensitiveDataProtection: @sensitiveDataProtection,
    scanMethodAlgorithm: @scanMethodAlgorithm,
    customMetadata: @customMetadata
  }.select { |_k, v| !v.nil? }
end

#to_json(*options) ⇒ Object



152
153
154
# File 'lib/copyleaks/models/submissions/properties/submission_properties.rb', line 152

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