plagiarism-checker 3.1.1 → 3.1.3
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 +4 -4
- data/lib/copyleaks/models/exports/export_model.rb +21 -3
- data/lib/copyleaks/models/submissions/properties/ai_generated_text.rb +43 -0
- data/lib/copyleaks/models/submissions/properties/index.rb +1 -0
- data/lib/copyleaks/models/submissions/properties/submission_properties.rb +8 -2
- data/lib/copyleaks/models/submissions/properties/webhooks.rb +32 -2
- data/lib/copyleaks/version.rb +1 -1
- metadata +7 -6
- data/plagiarism-checker-3.1.0.gem +0 -0
- data/plagiarism-checker.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524a7020e06e02585a7cb3ce7b045283b71c99420e9af6503c98448c26cfc87a
|
4
|
+
data.tar.gz: 9afacdb5523ba19853121372f6033106ba9c64ba92d270192797266a7d254f61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58de7422fa492f654a1e3af71869f530c189eb891d3f31cd302bb30d40d3d443f130a4248058031ab5e33b3d79841468023e6f83fb8d38ba2c5324a91c2278be
|
7
|
+
data.tar.gz: d665f8acc700ee5ca81dd036e6756a0af8fe4a90db5a013a94c865af8b2b97c68b2241ba9b5b26007e8df66e8b7690e73b5a7678ef974b6c9cedb47572af16ed
|
@@ -23,19 +23,24 @@
|
|
23
23
|
# =
|
24
24
|
module Copyleaks
|
25
25
|
class CopyleaksExportModel
|
26
|
-
attr_reader :completionWebhook, :results, :crawledVersion, :pdfReport, :maxRetries, :developerPayload
|
26
|
+
attr_reader :completionWebhook, :completionWebhookHeaders, :results, :crawledVersion, :pdfReport, :maxRetries, :developerPayload
|
27
27
|
|
28
28
|
# @param [String] completionWebhook This webhook event is triggered once the export is completed.
|
29
29
|
# @param [ExportResults[]] results An array of results to be exported. The equivalent of downloading results manually.
|
30
30
|
# @param [ExportCrawledVersion crawledVersion Download the crawled version of the submitted text. The equivalent of downloading crawled version manually.
|
31
|
-
# @param [ExportPdfReport] pdfReport Download the PDF report. Allowed only when `properties.pdf.create` was set to true on the scan
|
31
|
+
# @param [ExportPdfReport] pdfReport Download the PDF report. Allowed only when `properties.pdf.create` was set to true on the scan submission.
|
32
32
|
# @param [Integer] maxRetries How many retries to send before giving up. Using high value (12) may lead to a longer time until the completionWebhook being executed. A low value (1) may lead to errors while your service is temporary having problems.
|
33
33
|
# @param [String] developerPayload Add a custom developer payload that will then be provided on the Export-Completed webhook. https://api.copyleaks.com/documentation/v3/webhooks/export-completed
|
34
|
-
|
34
|
+
# @param [Array] completionWebhookHeaders Adds headers to the completion webhook.
|
35
|
+
def initialize(completionWebhook, results, crawledVersion, pdfReport = nil, maxRetries = nil, developerPayload = nil, completionWebhookHeaders = nil)
|
35
36
|
unless completionWebhook.instance_of?(String)
|
36
37
|
raise 'Copyleaks::CopyleaksExportModel - completionWebhook - completionWebhook must be of type String'
|
37
38
|
end
|
38
39
|
|
40
|
+
unless header_format_valid?(completionWebhookHeaders)
|
41
|
+
raise 'Copyleaks::CopyleaksExportModel - completionWebhookHeaders - completionWebhookHeaders must be an Array of String Array pairs'
|
42
|
+
end
|
43
|
+
|
39
44
|
results.each do |item|
|
40
45
|
unless item.instance_of?(ExportResults)
|
41
46
|
raise 'Copyleaks::CopyleaksExportModel - results - entity must be of type Copyleaks::ExportResults'
|
@@ -59,6 +64,7 @@ module Copyleaks
|
|
59
64
|
end
|
60
65
|
|
61
66
|
@completionWebhook = completionWebhook
|
67
|
+
@completionWebhookHeaders = completionWebhookHeaders
|
62
68
|
@results = results
|
63
69
|
@crawledVersion = crawledVersion
|
64
70
|
@pdfReport = pdfReport
|
@@ -69,6 +75,7 @@ module Copyleaks
|
|
69
75
|
def as_json(*_args)
|
70
76
|
{
|
71
77
|
completionWebhook: @completionWebhook,
|
78
|
+
completionWebhookHeaders: @completionWebhookHeaders,
|
72
79
|
results: @results,
|
73
80
|
crawledVersion: @crawledVersion,
|
74
81
|
pdfReport: @pdfReport,
|
@@ -80,5 +87,16 @@ module Copyleaks
|
|
80
87
|
def to_json(*options)
|
81
88
|
as_json(*options).to_json(*options)
|
82
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def header_format_valid?(header)
|
94
|
+
return true if header.nil?
|
95
|
+
return false unless header.instance_of?(Array)
|
96
|
+
|
97
|
+
header.all? do |pair|
|
98
|
+
pair.instance_of?(Array) && pair.length == 2 && pair[0].instance_of?(String) && pair[1].instance_of?(String)
|
99
|
+
end
|
100
|
+
end
|
83
101
|
end
|
84
102
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# The MIT License(MIT)
|
3
|
+
#
|
4
|
+
# Copyright(c) 2023 Copyleaks LTD (https://copyleaks.com)
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
# =
|
24
|
+
module Copyleaks
|
25
|
+
class SubmissionAiGeneratedText
|
26
|
+
# @param [Boolean] detect Detects whether the text was written by an AI.
|
27
|
+
def initialize(
|
28
|
+
detect = false
|
29
|
+
)
|
30
|
+
@detect = detect
|
31
|
+
end
|
32
|
+
|
33
|
+
def as_json(*_args)
|
34
|
+
{
|
35
|
+
detect: @detect
|
36
|
+
}.select { |_k, v| !v.nil? }
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_json(*options)
|
40
|
+
as_json(*options).to_json(*options)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -45,7 +45,8 @@ module Copyleaks
|
|
45
45
|
def initialize(
|
46
46
|
webhooks, includeHtml = nil, developerPayload = nil, sandbox = nil, expiration = nil,
|
47
47
|
sensitivityLevel = nil, cheatDetection = nil, action = nil, author = nil, filters = nil,
|
48
|
-
scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil,
|
48
|
+
scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil,
|
49
|
+
scanMethodAlgorithm = nil, aiGeneratedText = nil
|
49
50
|
)
|
50
51
|
unless webhooks.instance_of?(SubmissionWebhooks)
|
51
52
|
raise 'Copyleaks::SubmissionProperties - webhooks - webhooks must be of type SubmissionWebhooks'
|
@@ -93,7 +94,10 @@ module Copyleaks
|
|
93
94
|
raise 'Copyleaks::SubmissionProperties - sensitiveDataProtection - sensitiveDataProtection must be of type SubmissionSensitiveData'
|
94
95
|
end
|
95
96
|
if !scanMethodAlgorithm.nil? && ![0, 1].include?(scanMethodAlgorithm)
|
96
|
-
raise 'Copyleaks::SubmissionProperties - scanMethodAlgorithm -
|
97
|
+
raise 'Copyleaks::SubmissionProperties - scanMethodAlgorithm - scanMethodAlgorithm must be of type SubmissionScanMethodAlgorithm'
|
98
|
+
end
|
99
|
+
if !aiGeneratedText.nil? && !aiGeneratedText.instance_of?(SubmissionAiGeneratedText)
|
100
|
+
raise 'Copyleaks::SubmissionProperties - aiGeneratedText - aiGeneratedText must be of type SubmissionAiGeneratedText'
|
97
101
|
end
|
98
102
|
|
99
103
|
@webhooks = webhooks
|
@@ -103,6 +107,7 @@ module Copyleaks
|
|
103
107
|
@expiration = expiration
|
104
108
|
@sensitivityLevel = sensitivityLevel
|
105
109
|
@cheatDetection = cheatDetection
|
110
|
+
@aiGeneratedText = aiGeneratedText
|
106
111
|
@action = action
|
107
112
|
@author = author
|
108
113
|
@filters = filters
|
@@ -123,6 +128,7 @@ module Copyleaks
|
|
123
128
|
expiration: @expiration,
|
124
129
|
sensitivityLevel: @sensitivityLevel,
|
125
130
|
cheatDetection: @cheatDetection,
|
131
|
+
aiGeneratedText: @aiGeneratedText,
|
126
132
|
action: @action,
|
127
133
|
author: @author,
|
128
134
|
filters: @filters,
|
@@ -25,20 +25,50 @@ module Copyleaks
|
|
25
25
|
class SubmissionWebhooks
|
26
26
|
# @param [String] status This webhook event is triggered once the scan status changes. Use the special token {STATUS} to track the current scan status. This special token will automatically be replaced by the Copyleaks servers with the optional values: completed, error, creditsChecked and indexed. Read more about webhooks: https://api.copyleaks.com/documentation/v3/webhooks
|
27
27
|
# @param [String] newResult Http endpoint to be triggered while the scan is still running and a new result is found. This is useful when the report is being viewed by the user in real time so the results will load gradually as they are found.
|
28
|
-
|
28
|
+
# @param [Array] statusHeaders Adds headers to the webhook.
|
29
|
+
# @param [Array] newResultHeaders Adds headers to the webhook.
|
30
|
+
def initialize(status, newResult = nil, statusHeaders = nil, newResultHeaders = nil)
|
31
|
+
unless status.instance_of? String
|
32
|
+
raise 'Copyleaks::SubmissionWebhooks - status - status must be of type String'
|
33
|
+
end
|
34
|
+
unless newResult.nil? || newResult.instance_of?(String)
|
35
|
+
raise 'Copyleaks::SubmissionWebhooks - newResult - newResult must be of type String'
|
36
|
+
end
|
37
|
+
unless header_format_valid?(statusHeaders)
|
38
|
+
raise 'Copyleaks::SubmissionWebhooks - statusHeaders - statusHeaders must be an Array of String Array pairs'
|
39
|
+
end
|
40
|
+
unless header_format_valid?(newResultHeaders)
|
41
|
+
raise 'Copyleaks::SubmissionWebhooks - newResultHeaders - newResultHeaders must be an Array of String Array pairs'
|
42
|
+
end
|
43
|
+
|
29
44
|
@newResult = newResult
|
30
45
|
@status = status
|
46
|
+
@statusHeaders = statusHeaders
|
47
|
+
@newResultHeaders = newResultHeaders
|
31
48
|
end
|
32
49
|
|
33
50
|
def as_json(*_args)
|
34
51
|
{
|
35
52
|
newResult: @newResult,
|
36
|
-
status: @status
|
53
|
+
status: @status,
|
54
|
+
statusHeaders: @statusHeaders,
|
55
|
+
newResultHeaders: @newResultHeaders
|
37
56
|
}.select { |_k, v| !v.nil? }
|
38
57
|
end
|
39
58
|
|
40
59
|
def to_json(*options)
|
41
60
|
as_json(*options).to_json(*options)
|
42
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def header_format_valid?(header)
|
66
|
+
return true if header.nil?
|
67
|
+
return false unless header.instance_of?(Array)
|
68
|
+
|
69
|
+
header.all? do |pair|
|
70
|
+
pair.instance_of?(Array) && pair.length == 2 && pair[0].instance_of?(String) && pair[1].instance_of?(String)
|
71
|
+
end
|
72
|
+
end
|
43
73
|
end
|
44
74
|
end
|
data/lib/copyleaks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plagiarism-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Copyleaks ltd
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Copyleaks detects plagiarism and checks content distribution online.
|
14
14
|
Use Copyleaks to find out if textual content is original and if it has been used
|
@@ -16,7 +16,9 @@ description: Copyleaks detects plagiarism and checks content distribution online
|
|
16
16
|
doc, docx, ocr...), URLs and free text for plagiarism check.
|
17
17
|
email:
|
18
18
|
- sales@copyleaks.com
|
19
|
-
executables:
|
19
|
+
executables:
|
20
|
+
- console
|
21
|
+
- setup
|
20
22
|
extensions: []
|
21
23
|
extra_rdoc_files: []
|
22
24
|
files:
|
@@ -49,6 +51,7 @@ files:
|
|
49
51
|
- lib/copyleaks/models/submissions/file_submission_model.rb
|
50
52
|
- lib/copyleaks/models/submissions/index.rb
|
51
53
|
- lib/copyleaks/models/submissions/properties/actions.rb
|
54
|
+
- lib/copyleaks/models/submissions/properties/ai_generated_text.rb
|
52
55
|
- lib/copyleaks/models/submissions/properties/author.rb
|
53
56
|
- lib/copyleaks/models/submissions/properties/copyleaks_db.rb
|
54
57
|
- lib/copyleaks/models/submissions/properties/domains_mode.rb
|
@@ -70,8 +73,6 @@ files:
|
|
70
73
|
- lib/copyleaks/utils/status-code.utils.rb
|
71
74
|
- lib/copyleaks/version.rb
|
72
75
|
- lib/index.rb
|
73
|
-
- plagiarism-checker-3.1.0.gem
|
74
|
-
- plagiarism-checker.gemspec
|
75
76
|
homepage: https://api.copyleaks.com
|
76
77
|
licenses:
|
77
78
|
- MIT
|
Binary file
|
data/plagiarism-checker.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
require 'copyleaks/version'
|
7
|
-
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = 'plagiarism-checker'
|
10
|
-
spec.version = Copyleaks::VERSION
|
11
|
-
spec.authors = ['Copyleaks ltd']
|
12
|
-
spec.email = ['sales@copyleaks.com']
|
13
|
-
|
14
|
-
spec.summary = 'Detects plagiarism and checks content distribution online.'
|
15
|
-
spec.description = 'Copyleaks detects plagiarism and checks content distribution online. Use Copyleaks to find out if textual content is original and if it has been used before. With Copyleaks cloud publishers, academics, and more can scan files (pdf, doc, docx, ocr...), URLs and free text for plagiarism check.'
|
16
|
-
spec.homepage = 'https://api.copyleaks.com'
|
17
|
-
spec.license = 'MIT'
|
18
|
-
|
19
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
-
spec.metadata['source_code_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker'
|
21
|
-
spec.metadata['changelog_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases'
|
22
|
-
|
23
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:demo|test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = 'exe'
|
27
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ['lib']
|
29
|
-
end
|