copyleaks 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +102 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +487 -0
- data/Rakefile +13 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/copyleaks/ai_detection_client.rb +27 -0
- data/lib/copyleaks/ai_image_detection_client.rb +35 -0
- data/lib/copyleaks/ai_video_detection_client.rb +20 -0
- data/lib/copyleaks/api.rb +247 -0
- data/lib/copyleaks/app.config.rb +36 -0
- data/lib/copyleaks/image_plagiarism_client.rb +19 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionExplainModel.rb +26 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionMatchModel.rb +33 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionMatchTextModel.rb +31 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionPatternMatchModel.rb +32 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionPatternStatisticsModel.rb +46 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionPatternsModel.rb +38 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionPositionsModel.rb +39 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionResponseModel.rb +68 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionResultModel.rb +41 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionScannedDocumentModel.rb +21 -0
- data/lib/copyleaks/models/aiDetection/responses/CopyleaksAiTextDetectionSummaryModel.rb +34 -0
- data/lib/copyleaks/models/auth_token.rb +46 -0
- data/lib/copyleaks/models/constants/CopyleaksAiImageDetectionModels.rb +5 -0
- data/lib/copyleaks/models/constants/CopyleaksAiImageMaskTypes.rb +11 -0
- data/lib/copyleaks/models/constants/CopyleaksAiVideoDetectionModels.rb +5 -0
- data/lib/copyleaks/models/constants/CopyleaksAlertCodes.rb +7 -0
- data/lib/copyleaks/models/constants/CopyleaksTextModerationConstants.rb +15 -0
- data/lib/copyleaks/models/constants/CopyleaksTextModerationLanguages.rb +6 -0
- data/lib/copyleaks/models/constants/index.rb +10 -0
- data/lib/copyleaks/models/delete_request_model.rb +50 -0
- data/lib/copyleaks/models/exceptions/auth_expired_exception.rb +7 -0
- data/lib/copyleaks/models/exceptions/command_exception.rb +13 -0
- data/lib/copyleaks/models/exceptions/copyleaks_api_exception.rb +18 -0
- data/lib/copyleaks/models/exceptions/index.rb +8 -0
- data/lib/copyleaks/models/exceptions/rate_limit_exception.rb +8 -0
- data/lib/copyleaks/models/exceptions/under_maintenance_exception.rb +8 -0
- data/lib/copyleaks/models/exports/export_crawled_version.rb +6 -0
- data/lib/copyleaks/models/exports/export_model.rb +87 -0
- data/lib/copyleaks/models/exports/export_pdf_report.rb +6 -0
- data/lib/copyleaks/models/exports/export_results.rb +30 -0
- data/lib/copyleaks/models/exports/export_target.rb +42 -0
- data/lib/copyleaks/models/exports/index.rb +8 -0
- data/lib/copyleaks/models/id_object.rb +22 -0
- data/lib/copyleaks/models/imageDetection/requests/CopyleaksAiImageDetectionAsyncRequestModel.rb +63 -0
- data/lib/copyleaks/models/imageDetection/requests/CopyleaksAiImageDetectionRequestModel.rb +135 -0
- data/lib/copyleaks/models/imageDetection/requests/CopyleaksAsyncWebhooksModel.rb +37 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectedObjectModel.rb +31 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb +31 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb +79 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb +40 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionScannedDocumentModel.rb +46 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb +33 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksImageMetadataModel.rb +45 -0
- data/lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb +31 -0
- data/lib/copyleaks/models/imagePlagiarism/requests/CopyleaksImagePlagiarismRequestModel.rb +51 -0
- data/lib/copyleaks/models/imagePlagiarism/responses/CopyleaksImagePlagiarismResponseModel.rb +187 -0
- data/lib/copyleaks/models/index.rb +51 -0
- data/lib/copyleaks/models/start_request_model.rb +40 -0
- data/lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb +25 -0
- data/lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb +41 -0
- data/lib/copyleaks/models/submissions/file_ocr_submission_model.rb +36 -0
- data/lib/copyleaks/models/submissions/file_submission_model.rb +35 -0
- data/lib/copyleaks/models/submissions/index.rb +16 -0
- data/lib/copyleaks/models/submissions/properties/actions.rb +10 -0
- data/lib/copyleaks/models/submissions/properties/ai_generated_text.rb +40 -0
- data/lib/copyleaks/models/submissions/properties/ai_generated_text_explain.rb +6 -0
- data/lib/copyleaks/models/submissions/properties/ai_source_match.rb +6 -0
- data/lib/copyleaks/models/submissions/properties/assignment.rb +6 -0
- data/lib/copyleaks/models/submissions/properties/author.rb +18 -0
- data/lib/copyleaks/models/submissions/properties/copyleaks_db.rb +22 -0
- data/lib/copyleaks/models/submissions/properties/course.rb +6 -0
- data/lib/copyleaks/models/submissions/properties/cross_languages.rb +21 -0
- data/lib/copyleaks/models/submissions/properties/custom_metadata.rb +19 -0
- data/lib/copyleaks/models/submissions/properties/domains_mode.rb +8 -0
- data/lib/copyleaks/models/submissions/properties/enable_flag.rb +26 -0
- data/lib/copyleaks/models/submissions/properties/exclude.rb +57 -0
- data/lib/copyleaks/models/submissions/properties/exclude_code.rb +19 -0
- data/lib/copyleaks/models/submissions/properties/filter.rb +49 -0
- data/lib/copyleaks/models/submissions/properties/index.rb +43 -0
- data/lib/copyleaks/models/submissions/properties/indexing.rb +25 -0
- data/lib/copyleaks/models/submissions/properties/indexing_repository.rb +26 -0
- data/lib/copyleaks/models/submissions/properties/institution.rb +6 -0
- data/lib/copyleaks/models/submissions/properties/internal_ai_source_match.rb +7 -0
- data/lib/copyleaks/models/submissions/properties/language.rb +18 -0
- data/lib/copyleaks/models/submissions/properties/masking_policy.rb +11 -0
- data/lib/copyleaks/models/submissions/properties/overview.rb +42 -0
- data/lib/copyleaks/models/submissions/properties/pdf_colors.rb +48 -0
- data/lib/copyleaks/models/submissions/properties/pdf_properties.rb +51 -0
- data/lib/copyleaks/models/submissions/properties/pdf_report_version.rb +9 -0
- data/lib/copyleaks/models/submissions/properties/pdf_version.rb +10 -0
- data/lib/copyleaks/models/submissions/properties/references.rb +26 -0
- data/lib/copyleaks/models/submissions/properties/repository.rb +18 -0
- data/lib/copyleaks/models/submissions/properties/scan_method_algorithm.rb +8 -0
- data/lib/copyleaks/models/submissions/properties/scanning.rb +44 -0
- data/lib/copyleaks/models/submissions/properties/scanning_exclude.rb +47 -0
- data/lib/copyleaks/models/submissions/properties/scanning_include.rb +25 -0
- data/lib/copyleaks/models/submissions/properties/scanning_repository.rb +23 -0
- data/lib/copyleaks/models/submissions/properties/sensitive_data_protection.rb +42 -0
- data/lib/copyleaks/models/submissions/properties/submission_properties.rb +179 -0
- data/lib/copyleaks/models/submissions/properties/webhooks.rb +42 -0
- data/lib/copyleaks/models/submissions/properties/writing_feedback.rb +30 -0
- data/lib/copyleaks/models/submissions/submission_model.rb +24 -0
- data/lib/copyleaks/models/submissions/url_submission_model.rb +41 -0
- data/lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb +67 -0
- data/lib/copyleaks/models/submissions/webhooks/CreditsCheckedWebhook.rb +24 -0
- data/lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb +22 -0
- data/lib/copyleaks/models/submissions/webhooks/ExportCompletedWebhook.rb +25 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Metadata.rb +61 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/StatusWebhook.rb +23 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Webhook.rb +25 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb +24 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb +54 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb +36 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ErrorModels/Error.rb +49 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb +29 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb +22 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb +37 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb +28 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb +91 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Batch.rb +26 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb +26 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Internet.rb +23 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb +36 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb +11 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Score.rb +20 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb +22 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Tags.rb +12 -0
- data/lib/copyleaks/models/submissions/webhooks/IndexedWebhook.rb +9 -0
- data/lib/copyleaks/models/submissions/webhooks/NewResultWebhook.rb +32 -0
- data/lib/copyleaks/models/submissions/webhooks/index.rb +34 -0
- data/lib/copyleaks/models/submissions/writing_assistant/score_weights.rb +26 -0
- data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb +32 -0
- data/lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationLabel.rb +21 -0
- data/lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationRequestModel.rb +45 -0
- data/lib/copyleaks/models/textModeration/responses/CopyleaksTextModerationResponseModel.rb +55 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb +27 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/Text.rb +27 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationChars.rb +32 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationScannedDocument.rb +55 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationsLegend.rb +29 -0
- data/lib/copyleaks/models/videoDetection/requests/CopyleaksAiVideoDetectionRequestModel.rb +61 -0
- data/lib/copyleaks/models/videoDetection/responses/CopyleaksAiVideoDetectionResponseModel.rb +177 -0
- data/lib/copyleaks/text_moderation_client.rb +18 -0
- data/lib/copyleaks/utils/copyleaks_client.utils.rb +101 -0
- data/lib/copyleaks/utils/http_client.rb +164 -0
- data/lib/copyleaks/utils/multipart.rb +86 -0
- data/lib/copyleaks/utils/status-code.utils.rb +23 -0
- data/lib/copyleaks/version.rb +3 -0
- data/lib/copyleaks/writing_assistant_client.rb +26 -0
- data/lib/copyleaks.rb +11 -0
- data/lib/index.rb +4 -0
- metadata +248 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionExclude
|
|
3
|
+
# Arguments left nil are not sent, so the server default (false) applies.
|
|
4
|
+
# @param [Boolean] htmlTemplate For HTML documents, exclude text repeated across the site, like headers and footers.
|
|
5
|
+
# @param [String[]] documentTemplateIds Exclude text found in these other documents.
|
|
6
|
+
# @param [SubmissionExcludeCode] code Not part of the current API reference; kept for compatibility.
|
|
7
|
+
def initialize(
|
|
8
|
+
quotes = nil,
|
|
9
|
+
references = nil,
|
|
10
|
+
tableOfContents = nil,
|
|
11
|
+
titles = nil,
|
|
12
|
+
htmlTemplate = nil,
|
|
13
|
+
citations = nil,
|
|
14
|
+
documentTemplateIds = nil,
|
|
15
|
+
code = nil
|
|
16
|
+
)
|
|
17
|
+
if !citations.nil? && ![true, false].include?(citations)
|
|
18
|
+
raise 'Copyleaks::SubmissionExclude - citations - citations must be of type Boolean'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if !documentTemplateIds.nil? && !(documentTemplateIds.is_a?(Array) && documentTemplateIds.all? { |element| element.is_a?(String) })
|
|
22
|
+
raise 'Copyleaks::SubmissionExclude - documentTemplateIds - documentTemplateIds must be of type String[]'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if !code.nil? && !code.instance_of?(SubmissionExcludeCode)
|
|
26
|
+
raise 'Copyleaks::SubmissionExclude - code - code must be of type SubmissionExcludeCode'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@quotes = quotes
|
|
30
|
+
@references = references
|
|
31
|
+
@tableOfContents = tableOfContents
|
|
32
|
+
@titles = titles
|
|
33
|
+
@htmlTemplate = htmlTemplate
|
|
34
|
+
@citations = citations
|
|
35
|
+
@documentTemplateIds = documentTemplateIds
|
|
36
|
+
@code = code
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def as_json(*_args)
|
|
41
|
+
{
|
|
42
|
+
quotes: @quotes,
|
|
43
|
+
references: @references,
|
|
44
|
+
tableOfContents: @tableOfContents,
|
|
45
|
+
titles: @titles,
|
|
46
|
+
htmlTemplate: @htmlTemplate,
|
|
47
|
+
citations: @citations,
|
|
48
|
+
documentTemplateIds: @documentTemplateIds,
|
|
49
|
+
code: @code
|
|
50
|
+
}.select { |_k, v| !v.nil? }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_json(*options)
|
|
54
|
+
as_json(*options).to_json(*options)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionExcludeCode
|
|
3
|
+
def initialize(
|
|
4
|
+
comments = nil
|
|
5
|
+
)
|
|
6
|
+
@comments = comments
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def as_json(*_args)
|
|
10
|
+
{
|
|
11
|
+
comments: @comments
|
|
12
|
+
}.select { |_k, v| !v.nil? }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def to_json(*options)
|
|
16
|
+
as_json(*options).to_json(*options)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionFilter
|
|
3
|
+
# Arguments left nil are not sent, so the server default applies.
|
|
4
|
+
# @param [Boolean] identicalEnabled Match exact words (server default: true).
|
|
5
|
+
# @param [Boolean] minorChangesEnabled Match nearly identical words, like slow and slowly (server default: true).
|
|
6
|
+
# @param [Boolean] relatedMeaningEnabled Match paraphrased content (server default: true).
|
|
7
|
+
# @param [Integer] minCopiedWords Only results with at least this many copied words.
|
|
8
|
+
# @param [Boolean] safeSearch Block explicit adult content from results; not 100% effective (server default: false).
|
|
9
|
+
# @param [String[]] domains Included or excluded, depending on domainsMode.
|
|
10
|
+
# @param [Integer] domainsMode SubmissionFilterDomainsMode INCLUDE or EXCLUDE (server default: EXCLUDE).
|
|
11
|
+
# @param [Boolean] allowSameDomain Allow results from the submitted URL's domain (server default: false).
|
|
12
|
+
def initialize(
|
|
13
|
+
identicalEnabled = nil,
|
|
14
|
+
minorChangesEnabled = nil,
|
|
15
|
+
relatedMeaningEnabled = nil,
|
|
16
|
+
minCopiedWords = nil,
|
|
17
|
+
safeSearch = nil,
|
|
18
|
+
domains = nil,
|
|
19
|
+
domainsMode = nil,
|
|
20
|
+
allowSameDomain = nil
|
|
21
|
+
)
|
|
22
|
+
@identicalEnabled = identicalEnabled
|
|
23
|
+
@minorChangesEnabled = minorChangesEnabled
|
|
24
|
+
@relatedMeaningEnabled = relatedMeaningEnabled
|
|
25
|
+
@minCopiedWords = minCopiedWords
|
|
26
|
+
@safeSearch = safeSearch
|
|
27
|
+
@domains = domains
|
|
28
|
+
@domainsMode = domainsMode
|
|
29
|
+
@allowSameDomain = allowSameDomain
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def as_json(*_args)
|
|
33
|
+
{
|
|
34
|
+
identicalEnabled: @identicalEnabled,
|
|
35
|
+
minorChangesEnabled: @minorChangesEnabled,
|
|
36
|
+
relatedMeaningEnabled: @relatedMeaningEnabled,
|
|
37
|
+
minCopiedWords: @minCopiedWords,
|
|
38
|
+
safeSearch: @safeSearch,
|
|
39
|
+
domains: @domains,
|
|
40
|
+
domainsMode: @domainsMode,
|
|
41
|
+
allowSameDomain: @allowSameDomain
|
|
42
|
+
}.select { |_k, v| !v.nil? }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_json(*options)
|
|
46
|
+
as_json(*options).to_json(*options)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require_relative 'submission_properties.rb'
|
|
2
|
+
require_relative 'actions.rb'
|
|
3
|
+
require_relative 'ai_generated_text.rb'
|
|
4
|
+
require_relative 'ai_generated_text_explain.rb'
|
|
5
|
+
require_relative 'ai_source_match.rb'
|
|
6
|
+
require_relative 'assignment.rb'
|
|
7
|
+
require_relative 'author.rb'
|
|
8
|
+
require_relative 'copyleaks_db.rb'
|
|
9
|
+
require_relative 'course.rb'
|
|
10
|
+
require_relative 'cross_languages.rb'
|
|
11
|
+
require_relative 'custom_metadata.rb'
|
|
12
|
+
require_relative 'domains_mode.rb'
|
|
13
|
+
require_relative 'enable_flag.rb'
|
|
14
|
+
require_relative 'exclude_code.rb'
|
|
15
|
+
require_relative 'exclude.rb'
|
|
16
|
+
require_relative 'filter.rb'
|
|
17
|
+
require_relative 'indexing_repository.rb'
|
|
18
|
+
require_relative 'scan_method_algorithm.rb'
|
|
19
|
+
require_relative 'indexing.rb'
|
|
20
|
+
require_relative 'institution.rb'
|
|
21
|
+
require_relative 'internal_ai_source_match.rb'
|
|
22
|
+
require_relative 'language.rb'
|
|
23
|
+
require_relative 'masking_policy.rb'
|
|
24
|
+
require_relative 'overview.rb'
|
|
25
|
+
require_relative 'pdf_colors.rb'
|
|
26
|
+
require_relative 'pdf_properties.rb'
|
|
27
|
+
require_relative 'pdf_report_version.rb'
|
|
28
|
+
require_relative 'pdf_version.rb'
|
|
29
|
+
require_relative 'references.rb'
|
|
30
|
+
require_relative 'repository.rb'
|
|
31
|
+
require_relative 'scanning.rb'
|
|
32
|
+
require_relative 'scanning_exclude.rb'
|
|
33
|
+
require_relative 'scanning_include.rb'
|
|
34
|
+
require_relative 'scanning_repository.rb'
|
|
35
|
+
require_relative 'sensitive_data_protection.rb'
|
|
36
|
+
require_relative 'submission_properties.rb'
|
|
37
|
+
require_relative 'webhooks.rb'
|
|
38
|
+
require_relative 'writing_feedback.rb'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
module Copyleaks
|
|
43
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionIndexing
|
|
3
|
+
# @param [SubmissionIndexingRepository[]] repositories Repositories to index the scanned document to.
|
|
4
|
+
# @param [Boolean] copyleaksDb Add the document to the Copyleaks Shared Data Hub (server default: false).
|
|
5
|
+
def initialize(repositories = nil, copyleaksDb: nil)
|
|
6
|
+
if !copyleaksDb.nil? && ![true, false].include?(copyleaksDb)
|
|
7
|
+
raise 'Copyleaks::SubmissionIndexing - copyleaksDb - copyleaksDb must be of type Boolean'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
@repositories = repositories
|
|
11
|
+
@copyleaksDb = copyleaksDb
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def as_json(*_args)
|
|
15
|
+
{
|
|
16
|
+
repositories: @repositories,
|
|
17
|
+
copyleaksDb: @copyleaksDb
|
|
18
|
+
}.select { |_k, v| !v.nil? }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_json(*options)
|
|
22
|
+
as_json(*options).to_json(*options)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative './repository.rb'
|
|
2
|
+
|
|
3
|
+
module Copyleaks
|
|
4
|
+
class SubmissionIndexingRepository < SubmissionRepository
|
|
5
|
+
# @param [String] id Repository to add the scanned document to.
|
|
6
|
+
# @param [SubmissionMaskingPolicy] maskingPolicy
|
|
7
|
+
def initialize(id, maskingPolicy = nil)
|
|
8
|
+
super(id)
|
|
9
|
+
if !maskingPolicy.nil? && ![0, 1, 2].include?(maskingPolicy)
|
|
10
|
+
raise 'Copyleaks::SubmissionIndexingRepository - maskingPolicy - maskingPolicy must be of type SubmissionMaskingPolicy'
|
|
11
|
+
end
|
|
12
|
+
@maskingPolicy = maskingPolicy
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def as_json(*_args)
|
|
16
|
+
{
|
|
17
|
+
id: @id,
|
|
18
|
+
maskingPolicy: @maskingPolicy,
|
|
19
|
+
}.select { |_k, v| !v.nil? }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def to_json(*options)
|
|
23
|
+
as_json(*options).to_json(*options)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
require_relative 'enable_flag.rb'
|
|
2
|
+
|
|
3
|
+
module Copyleaks
|
|
4
|
+
# Find sources in the Copyleaks internal AI database that contain AI-generated text, reported in
|
|
5
|
+
# results.internalAIData of the completed webhook.
|
|
6
|
+
class SubmissionInternalAiSourceMatch < SubmissionEnableFlag; end
|
|
7
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionLanguage
|
|
3
|
+
# @param [String] code See API#get_allowed_cross_languages.
|
|
4
|
+
def initialize(code)
|
|
5
|
+
@code = code
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def as_json(*_args)
|
|
9
|
+
{
|
|
10
|
+
code: @code,
|
|
11
|
+
}.select { |_k, v| !v.nil? }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def to_json(*options)
|
|
15
|
+
as_json(*options).to_json(*options)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
# Gen-AI Overview: key insights from the scan data. Fields left nil are not sent (server default: false).
|
|
3
|
+
# The ignore* flags leave AI detection, plagiarism, the Grammar Checker or the author's history out of it.
|
|
4
|
+
class SubmissionOverview
|
|
5
|
+
attr_reader :enable, :ignoreAIDetection, :ignorePlagiarismDetection, :ignoreWritingFeedback, :ignoreAuthorData
|
|
6
|
+
|
|
7
|
+
def initialize(enable = nil, ignoreAIDetection: nil, ignorePlagiarismDetection: nil, ignoreWritingFeedback: nil,
|
|
8
|
+
ignoreAuthorData: nil)
|
|
9
|
+
{
|
|
10
|
+
enable: enable,
|
|
11
|
+
ignoreAIDetection: ignoreAIDetection,
|
|
12
|
+
ignorePlagiarismDetection: ignorePlagiarismDetection,
|
|
13
|
+
ignoreWritingFeedback: ignoreWritingFeedback,
|
|
14
|
+
ignoreAuthorData: ignoreAuthorData
|
|
15
|
+
}.each do |name, value|
|
|
16
|
+
if !value.nil? && ![true, false].include?(value)
|
|
17
|
+
raise "Copyleaks::SubmissionOverview - #{name} - #{name} must be of type Boolean"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@enable = enable
|
|
22
|
+
@ignoreAIDetection = ignoreAIDetection
|
|
23
|
+
@ignorePlagiarismDetection = ignorePlagiarismDetection
|
|
24
|
+
@ignoreWritingFeedback = ignoreWritingFeedback
|
|
25
|
+
@ignoreAuthorData = ignoreAuthorData
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def as_json(*_args)
|
|
29
|
+
{
|
|
30
|
+
enable: @enable,
|
|
31
|
+
ignoreAIDetection: @ignoreAIDetection,
|
|
32
|
+
ignorePlagiarismDetection: @ignorePlagiarismDetection,
|
|
33
|
+
ignoreWritingFeedback: @ignoreWritingFeedback,
|
|
34
|
+
ignoreAuthorData: @ignoreAuthorData
|
|
35
|
+
}.select { |_k, v| !v.nil? }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_json(*options)
|
|
39
|
+
as_json(*options).to_json(*options)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionPdfColors
|
|
3
|
+
attr_reader :mainStrip, :titles, :identical, :minorChanges, :relatedMeaning, :aiDetection, :writingFeedback
|
|
4
|
+
|
|
5
|
+
# Optional HEX colors, e.g. '#040F21'; nil colors are not sent. identical, minorChanges, relatedMeaning,
|
|
6
|
+
# aiDetection and writingFeedback (Grammar Checker) are highlight colors.
|
|
7
|
+
# @param [String] mainStrip The main strip in the header.
|
|
8
|
+
# @param [String] titles Sent as "titles".
|
|
9
|
+
def initialize(
|
|
10
|
+
mainStrip = nil,
|
|
11
|
+
titles = nil,
|
|
12
|
+
identical = nil,
|
|
13
|
+
minorChanges = nil,
|
|
14
|
+
relatedMeaning = nil,
|
|
15
|
+
aiDetection: nil,
|
|
16
|
+
writingFeedback: nil
|
|
17
|
+
)
|
|
18
|
+
@mainStrip = mainStrip
|
|
19
|
+
@titles = titles
|
|
20
|
+
@identical = identical
|
|
21
|
+
@minorChanges = minorChanges
|
|
22
|
+
@relatedMeaning = relatedMeaning
|
|
23
|
+
@aiDetection = aiDetection
|
|
24
|
+
@writingFeedback = writingFeedback
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Earlier versions named the second argument title.
|
|
28
|
+
def title
|
|
29
|
+
@titles
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def as_json(*_args)
|
|
33
|
+
{
|
|
34
|
+
mainStrip: @mainStrip,
|
|
35
|
+
titles: @titles,
|
|
36
|
+
identical: @identical,
|
|
37
|
+
minorChanges: @minorChanges,
|
|
38
|
+
relatedMeaning: @relatedMeaning,
|
|
39
|
+
aiDetection: @aiDetection,
|
|
40
|
+
writingFeedback: @writingFeedback
|
|
41
|
+
}.select { |_k, v| !v.nil? }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_json(*options)
|
|
45
|
+
as_json(*options).to_json(*options)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionPDF
|
|
3
|
+
# Arguments left nil are not sent, so the server default applies.
|
|
4
|
+
# @param [Boolean] create Generate a PDF report for this scan.
|
|
5
|
+
# @param [String] largeLogo The logo image in the PDF report.
|
|
6
|
+
# @param [Boolean] rtl Align the report text right to left.
|
|
7
|
+
# @param [SubmissionPdfVersion] version Deprecated: use reportVersion.
|
|
8
|
+
# @param [String] reportVersion See SubmissionPdfReportVersion. Overrides version; applies only when create is true.
|
|
9
|
+
def initialize(
|
|
10
|
+
create = nil,
|
|
11
|
+
title = nil,
|
|
12
|
+
largeLogo = nil,
|
|
13
|
+
rtl = nil,
|
|
14
|
+
version = nil,
|
|
15
|
+
colors = nil,
|
|
16
|
+
reportVersion = nil
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if !colors.nil? && !colors.instance_of?(SubmissionPdfColors)
|
|
20
|
+
raise 'Copyleaks::SubmissionPDF - colors - colors must be of type SubmissionPdfColors'
|
|
21
|
+
end
|
|
22
|
+
if !reportVersion.nil? && !reportVersion.instance_of?(String)
|
|
23
|
+
raise 'Copyleaks::SubmissionPDF - reportVersion - reportVersion must be of type String'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@create = create
|
|
27
|
+
@title = title
|
|
28
|
+
@largeLogo = largeLogo
|
|
29
|
+
@rtl = rtl
|
|
30
|
+
@version = version
|
|
31
|
+
@colors = colors
|
|
32
|
+
@reportVersion = reportVersion
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def as_json(*_args)
|
|
36
|
+
{
|
|
37
|
+
create: @create,
|
|
38
|
+
title: @title,
|
|
39
|
+
largeLogo: @largeLogo,
|
|
40
|
+
rtl: @rtl,
|
|
41
|
+
version: @version,
|
|
42
|
+
colors: @colors,
|
|
43
|
+
reportVersion: @reportVersion
|
|
44
|
+
}.select { |_k, v| !v.nil? }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_json(*options)
|
|
48
|
+
as_json(*options).to_json(*options)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
# Citation Checker settings.
|
|
3
|
+
class SubmissionReferences
|
|
4
|
+
attr_reader :validate
|
|
5
|
+
|
|
6
|
+
# @param [Boolean] validate Detect, parse and validate every reference in the text; the summary is in
|
|
7
|
+
# referencesValidation of the completed webhook. Server default: false.
|
|
8
|
+
def initialize(validate = nil)
|
|
9
|
+
if !validate.nil? && ![true, false].include?(validate)
|
|
10
|
+
raise 'Copyleaks::SubmissionReferences - validate - validate must be of type Boolean'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
@validate = validate
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def as_json(*_args)
|
|
17
|
+
{
|
|
18
|
+
validate: @validate
|
|
19
|
+
}.select { |_k, v| !v.nil? }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def to_json(*options)
|
|
23
|
+
as_json(*options).to_json(*options)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionRepository
|
|
3
|
+
# @param [String] id Repository id.
|
|
4
|
+
def initialize(id)
|
|
5
|
+
@id = id
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def as_json(*_args)
|
|
9
|
+
{
|
|
10
|
+
id: @id
|
|
11
|
+
}.select { |_k, v| !v.nil? }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def to_json(*options)
|
|
15
|
+
as_json(*options).to_json(*options)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionScanning
|
|
3
|
+
# Arguments left nil are not sent, so the server default applies.
|
|
4
|
+
# @param [Boolean] internet Compare with online sources (server default: true).
|
|
5
|
+
# @param [SubmissionCrossLanguages] crossLanguages Languages for cross-language plagiarism detection.
|
|
6
|
+
def initialize(
|
|
7
|
+
internet = nil,
|
|
8
|
+
exclude = nil,
|
|
9
|
+
repositories = nil,
|
|
10
|
+
copyleaksDb = nil,
|
|
11
|
+
crossLanguages = nil,
|
|
12
|
+
include: nil
|
|
13
|
+
)
|
|
14
|
+
if !internet.nil? && ![true, false].include?(internet)
|
|
15
|
+
raise 'Copyleaks::SubmissionScanning - internet - internet must be of type Boolean'
|
|
16
|
+
end
|
|
17
|
+
if !include.nil? && !include.instance_of?(SubmissionScanningInclude)
|
|
18
|
+
raise 'Copyleaks::SubmissionScanning - include - include must be of type SubmissionScanningInclude'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@internet = internet
|
|
22
|
+
@exclude = exclude
|
|
23
|
+
@repositories = repositories
|
|
24
|
+
@copyleaksDb = copyleaksDb
|
|
25
|
+
@crossLanguages = crossLanguages
|
|
26
|
+
@include = include
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def as_json(*_args)
|
|
30
|
+
{
|
|
31
|
+
internet: @internet,
|
|
32
|
+
exclude: @exclude,
|
|
33
|
+
include: @include,
|
|
34
|
+
repositories: @repositories,
|
|
35
|
+
copyleaksDb: @copyleaksDb,
|
|
36
|
+
crossLanguages: @crossLanguages
|
|
37
|
+
}.select { |_k, v| !v.nil? }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_json(*options)
|
|
41
|
+
as_json(*options).to_json(*options)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionScanningExclude
|
|
3
|
+
MAX_BACKLINKS_DOMAINS = 10
|
|
4
|
+
MAX_TEXT_PHRASES = 5
|
|
5
|
+
|
|
6
|
+
# @param [String] idPattern Exclude your submissions whose id matches from batch, internal database and
|
|
7
|
+
# repository results. Wildcards: '*' any characters, '.' one non-whitespace character.
|
|
8
|
+
# @param [String[]] backlinksDomains Exclude results with backlinks to these domains: at most 10, 1-256 chars each.
|
|
9
|
+
# @param [String[]] text Exclude results containing any of these phrases: at most 5, 1-30 chars each.
|
|
10
|
+
def initialize(idPattern = nil, backlinksDomains: nil, text: nil)
|
|
11
|
+
if !idPattern.nil? && !idPattern.instance_of?(String)
|
|
12
|
+
raise 'Copyleaks::SubmissionScanningExclude - idPattern - idPattern must be of type String'
|
|
13
|
+
end
|
|
14
|
+
unless string_list_valid?(backlinksDomains, MAX_BACKLINKS_DOMAINS, 256)
|
|
15
|
+
raise 'Copyleaks::SubmissionScanningExclude - backlinksDomains - backlinksDomains must be an Array of at most 10 Strings of 1 to 256 characters'
|
|
16
|
+
end
|
|
17
|
+
unless string_list_valid?(text, MAX_TEXT_PHRASES, 30)
|
|
18
|
+
raise 'Copyleaks::SubmissionScanningExclude - text - text must be an Array of at most 5 Strings of 1 to 30 characters'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@idPattern = idPattern
|
|
22
|
+
@backlinksDomains = backlinksDomains
|
|
23
|
+
@text = text
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def as_json(*_args)
|
|
27
|
+
{
|
|
28
|
+
idPattern: @idPattern,
|
|
29
|
+
backlinksDomains: @backlinksDomains,
|
|
30
|
+
text: @text
|
|
31
|
+
}.select { |_k, v| !v.nil? }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_json(*options)
|
|
35
|
+
as_json(*options).to_json(*options)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def string_list_valid?(list, max_items, max_length)
|
|
41
|
+
return true if list.nil?
|
|
42
|
+
|
|
43
|
+
list.is_a?(Array) && list.length <= max_items &&
|
|
44
|
+
list.all? { |item| item.is_a?(String) && item.length.between?(1, max_length) }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionScanningInclude
|
|
3
|
+
attr_reader :idPattern
|
|
4
|
+
|
|
5
|
+
# @param [String] idPattern Only include internal database and repository results whose scan id matches.
|
|
6
|
+
# Wildcards: '*' any characters, '.' one non-whitespace character.
|
|
7
|
+
def initialize(idPattern = nil)
|
|
8
|
+
if !idPattern.nil? && !idPattern.instance_of?(String)
|
|
9
|
+
raise 'Copyleaks::SubmissionScanningInclude - idPattern - idPattern must be of type String'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@idPattern = idPattern
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def as_json(*_args)
|
|
16
|
+
{
|
|
17
|
+
idPattern: @idPattern
|
|
18
|
+
}.select { |_k, v| !v.nil? }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_json(*options)
|
|
22
|
+
as_json(*options).to_json(*options)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionScanningRepository < SubmissionRepository
|
|
3
|
+
# @param [Boolean] includeMySubmissions Compare against MY submissions in the repository.
|
|
4
|
+
# @param [Boolean] includeOthersSubmissions Compare against OTHER users' submissions in the repository.
|
|
5
|
+
def initialize(id, includeMySubmissions, includeOthersSubmissions)
|
|
6
|
+
super(id)
|
|
7
|
+
@includeMySubmissions = includeMySubmissions
|
|
8
|
+
@includeOthersSubmissions = includeOthersSubmissions
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def as_json(*_args)
|
|
12
|
+
{
|
|
13
|
+
id: @id,
|
|
14
|
+
includeMySubmissions: @includeMySubmissions,
|
|
15
|
+
includeOthersSubmissions: @includeOthersSubmissions
|
|
16
|
+
}.select { |_k, v| !v.nil? }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def to_json(*options)
|
|
20
|
+
as_json(*options).to_json(*options)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Copyleaks
|
|
2
|
+
class SubmissionSensitiveData
|
|
3
|
+
# Each flag masks that kind of data in the scanned document with # characters (creditCard also masks track
|
|
4
|
+
# numbers). Needs a plan of 2500 pages or more. Arguments left nil are not sent (server default: false).
|
|
5
|
+
def initialize(
|
|
6
|
+
driversLicense = nil,
|
|
7
|
+
credentials = nil,
|
|
8
|
+
passport = nil,
|
|
9
|
+
network = nil,
|
|
10
|
+
url = nil,
|
|
11
|
+
emailAddress = nil,
|
|
12
|
+
creditCard = nil,
|
|
13
|
+
phoneNumber = nil
|
|
14
|
+
)
|
|
15
|
+
@driversLicense = driversLicense
|
|
16
|
+
@credentials = credentials
|
|
17
|
+
@passport = passport
|
|
18
|
+
@network = network
|
|
19
|
+
@url = url
|
|
20
|
+
@emailAddress = emailAddress
|
|
21
|
+
@creditCard = creditCard
|
|
22
|
+
@phoneNumber = phoneNumber
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def as_json(*_args)
|
|
26
|
+
{
|
|
27
|
+
driversLicense: @driversLicense,
|
|
28
|
+
credentials: @credentials,
|
|
29
|
+
passport: @passport,
|
|
30
|
+
network: @network,
|
|
31
|
+
url: @url,
|
|
32
|
+
emailAddress: @emailAddress,
|
|
33
|
+
creditCard: @creditCard,
|
|
34
|
+
phoneNumber: @phoneNumber
|
|
35
|
+
}.select { |_k, v| !v.nil? }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_json(*options)
|
|
39
|
+
as_json(*options).to_json(*options)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|