plagiarism-checker 3.3.0 → 3.4.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 +4 -4
- data/.gitignore +0 -0
- data/.vscode/launch.json +35 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/copyleaks/ai_detection_client.rb +0 -0
- data/lib/copyleaks/api.rb +4 -21
- data/lib/copyleaks/app.config.rb +0 -0
- data/lib/copyleaks/models/auth_token.rb +0 -0
- data/lib/copyleaks/models/delete_request_model.rb +0 -0
- data/lib/copyleaks/models/exceptions/{auth_exipred_exception.rb → auth_expired_exception.rb} +2 -4
- data/lib/copyleaks/models/exceptions/command_exception.rb +11 -4
- data/lib/copyleaks/models/exceptions/index.rb +1 -1
- data/lib/copyleaks/models/exceptions/rate_limit_exception.rb +2 -4
- data/lib/copyleaks/models/exceptions/under_maintenance_exception.rb +2 -4
- data/lib/copyleaks/models/exports/export_crawled_version.rb +0 -0
- data/lib/copyleaks/models/exports/export_model.rb +0 -0
- data/lib/copyleaks/models/exports/export_pdf_report.rb +0 -0
- data/lib/copyleaks/models/exports/export_results.rb +0 -0
- data/lib/copyleaks/models/exports/index.rb +0 -0
- data/lib/copyleaks/models/id_object.rb +0 -0
- data/lib/copyleaks/models/index.rb +0 -0
- data/lib/copyleaks/models/start_request_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/file_ocr_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/file_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/index.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/actions.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/ai_generated_text.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/author.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/copyleaks_db.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/cross_languages.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/custom_metadata.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/domains_mode.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/exclude.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/exclude_code.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/filter.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/index.rb +1 -0
- data/lib/copyleaks/models/submissions/properties/indexing.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/indexing_repository.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/language.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/masking_policy.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/pdf_colors.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/pdf_properties.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/pdf_version.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/repository.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/scan_method_algorithm.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/scanning.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/scanning_exclude.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/scanning_repository.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/sensitive_data_protection.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/submission_properties.rb +9 -3
- data/lib/copyleaks/models/submissions/properties/webhooks.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/writing_feedback.rb +53 -0
- data/lib/copyleaks/models/submissions/submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/url_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/writing_assistant/score_weights.rb +0 -0
- data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb +0 -0
- data/lib/copyleaks/utils/copyleaks_client.utils.rb +56 -64
- data/lib/copyleaks/utils/status-code.utils.rb +0 -0
- data/lib/copyleaks/version.rb +1 -1
- data/lib/copyleaks/writing_assistant_client.rb +0 -0
- data/lib/copyleaks.rb +0 -0
- data/lib/index.rb +0 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78d078009e0a00e806a132c00e4413146152407dac42d7bcc2c639606e11321e
|
4
|
+
data.tar.gz: aed6b1cbe5c60e2731a3e45545cd933ec1a3cad715c2c81bc9340e046107c9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309584bf74ff895cc0c8cb6cddc99418ab1a751707921cbb4eb5c7d91d56dab50738838f4d910bb7d1f04ef14bd4f4baf3fb04b0bf6544ca40c7ae047e01c0a9
|
7
|
+
data.tar.gz: 9c49e09e073bd7b23e99a55ec781691424d103b6aae7f1e3ab7dc2ba9ef80859a61bdaf0f31b605fcc8f5b7b457434786cd55a24e7f8e598eeacfe3ad832a0ed
|
data/.gitignore
CHANGED
File without changes
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"name": "Debug Local File",
|
9
|
+
"type": "Ruby",
|
10
|
+
"request": "launch",
|
11
|
+
"program": "${workspaceRoot}/main.rb"
|
12
|
+
},
|
13
|
+
// Launch the debugger for any given program. In this case, it will run the current file using Ruby
|
14
|
+
{
|
15
|
+
"type": "ruby_lsp",
|
16
|
+
"name": "Debug",
|
17
|
+
"request": "launch",
|
18
|
+
"program": "ruby ${file}"
|
19
|
+
},
|
20
|
+
// Launch the debugger for the current test file
|
21
|
+
{
|
22
|
+
"type": "ruby_lsp",
|
23
|
+
"request": "launch",
|
24
|
+
"name": "Debug test file",
|
25
|
+
"program": "ruby -Itest ${relativeFile}"
|
26
|
+
},
|
27
|
+
// Attach the debugger client to an existing Ruby process that has already been launched with the debugger
|
28
|
+
// server
|
29
|
+
{
|
30
|
+
"type": "ruby_lsp",
|
31
|
+
"request": "attach",
|
32
|
+
"name": "Attach to existing server"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
File without changes
|
data/lib/copyleaks/api.rb
CHANGED
@@ -26,6 +26,7 @@ require 'json'
|
|
26
26
|
require 'date'
|
27
27
|
require_relative 'ai_detection_client.rb'
|
28
28
|
require_relative 'writing_assistant_client.rb'
|
29
|
+
require_relative 'utils/copyleaks_client.utils'
|
29
30
|
|
30
31
|
module Copyleaks
|
31
32
|
class API
|
@@ -75,7 +76,7 @@ module Copyleaks
|
|
75
76
|
|
76
77
|
# Verify that Copyleaks authentication token is exists and not exipired.
|
77
78
|
# * Exceptions:
|
78
|
-
# * *
|
79
|
+
# * * AuthExpiredException: authentication expired. Need to login again.
|
79
80
|
# @param [CopyleaksAuthToken] authToken Copyleaks authentication token
|
80
81
|
def verify_auth_token(authToken)
|
81
82
|
if authToken.nil? || !authToken.instance_of?(CopyleaksAuthToken)
|
@@ -86,7 +87,7 @@ module Copyleaks
|
|
86
87
|
_expiresTime = DateTime.parse(authToken.expires)
|
87
88
|
|
88
89
|
if _expiresTime <= _time
|
89
|
-
raise
|
90
|
+
raise AuthExpiredException # expired
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
@@ -445,25 +446,7 @@ module Copyleaks
|
|
445
446
|
|
446
447
|
# this methods is a helper for hanlding reponse data and exceptions.
|
447
448
|
def handle_response(response, used_by)
|
448
|
-
|
449
|
-
if response.body.nil? || response.body == ''
|
450
|
-
nil
|
451
|
-
else
|
452
|
-
JSON.parse(response.body)
|
453
|
-
end
|
454
|
-
elsif Utils.is_under_maintenance_response(response.code)
|
455
|
-
raise UnderMaintenanceException.new.reason
|
456
|
-
elsif Utils.is_rate_limit_response(response.code)
|
457
|
-
raise RateLimitException.new.reason
|
458
|
-
else
|
459
|
-
_err_message = '---------Copyleaks SDK Error (' + used_by + ')---------' + "\n\n"
|
460
|
-
_err_message += 'status code: ' + response.code + "\n\n"
|
461
|
-
|
462
|
-
_err_message += 'response body:' + "\n" + response.body.to_json + "\n\n" unless response.body.nil?
|
463
|
-
|
464
|
-
_err_message += '-------------------------------------'
|
465
|
-
raise CommandException.new(_err_message).reason + "\n"
|
466
|
-
end
|
449
|
+
Copyleaks::ClientUtils.handle_response(response, used_by)
|
467
450
|
end
|
468
451
|
|
469
452
|
def ai_detection_client
|
data/lib/copyleaks/app.config.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/exceptions/{auth_exipred_exception.rb → auth_expired_exception.rb}
RENAMED
@@ -22,11 +22,9 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
# =
|
24
24
|
module Copyleaks
|
25
|
-
class
|
26
|
-
attr_reader :reason
|
27
|
-
|
25
|
+
class AuthExpiredException < RuntimeError
|
28
26
|
def initialize
|
29
|
-
|
27
|
+
super 'Authentication Expired. Need to login again'
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -22,11 +22,18 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
# =
|
24
24
|
module Copyleaks
|
25
|
-
class CommandException <
|
26
|
-
attr_reader :
|
25
|
+
class CommandException < RuntimeError
|
26
|
+
attr_reader :response
|
27
27
|
|
28
|
-
def initialize(
|
29
|
-
@
|
28
|
+
def initialize(response:, used_by:)
|
29
|
+
@response = response
|
30
|
+
@used_by = used_by
|
31
|
+
|
32
|
+
message = "---------Copyleaks SDK Error (#{used_by})---------\n\n"
|
33
|
+
message += "status code: #{response.code}\n\n"
|
34
|
+
message += "response body:\n#{response.body.to_json}\n\n" unless response.body.nil?
|
35
|
+
message += "-------------------------------------\n"
|
36
|
+
super message
|
30
37
|
end
|
31
38
|
end
|
32
39
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
# =
|
24
24
|
|
25
|
-
require_relative '
|
25
|
+
require_relative 'auth_expired_exception.rb'
|
26
26
|
require_relative 'command_exception.rb'
|
27
27
|
require_relative 'rate_limit_exception.rb'
|
28
28
|
require_relative 'under_maintenance_exception.rb'
|
@@ -22,11 +22,9 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
# =
|
24
24
|
module Copyleaks
|
25
|
-
class RateLimitException <
|
26
|
-
attr_reader :reason
|
27
|
-
|
25
|
+
class RateLimitException < RuntimeError
|
28
26
|
def initialize
|
29
|
-
|
27
|
+
super 'Too many requests. Please wait before calling again.'
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -22,11 +22,9 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
# =
|
24
24
|
module Copyleaks
|
25
|
-
class UnderMaintenanceException <
|
26
|
-
attr_reader :reason
|
27
|
-
|
25
|
+
class UnderMaintenanceException < RuntimeError
|
28
26
|
def initialize
|
29
|
-
|
27
|
+
super 'Copyleaks is Under Maintenance, please visit https://status.copyleaks.com'
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -25,7 +25,7 @@ module Copyleaks
|
|
25
25
|
class SubmissionProperties
|
26
26
|
attr_reader :webhooks, :includeHtml, :developerPayload, :sandbox, :expiration, :sensitivityLevel, :cheatDetection,
|
27
27
|
:action, :author, :filters, :scanning, :indexing, :exclude, :pdf, :sensitiveDataProtection, :scanMethodAlgorithm,
|
28
|
-
:aiGeneratedText, :customMetadata
|
28
|
+
:aiGeneratedText, :customMetadata, :writingFeedback
|
29
29
|
|
30
30
|
# @param [SubmissionWebhooks] webhooks - Check inner properties for more details.
|
31
31
|
# @param [Boolean] includeHtml - By default, Copyleaks will present the report in text format. If set to true, Copyleaks will also include html format.
|
@@ -45,11 +45,12 @@ module Copyleaks
|
|
45
45
|
# @param [SubmissionScanMethodAlgorithm] scanMethodAlgorithm - Check inner properties for more details.
|
46
46
|
# @param [SubmissionAiGeneratedText] aiGeneratedText - Check inner properties for more details.
|
47
47
|
# @param [SubmissionCustomMetadata] customMetadata - Add custom properties that will be attached to your document in a Copyleaks repository.
|
48
|
+
# @param [SubmissionWritingFeedback] writingFeedback - Check inner properties for more details.
|
48
49
|
def initialize(
|
49
50
|
webhooks, includeHtml = nil, developerPayload = nil, sandbox = nil, expiration = nil,
|
50
51
|
sensitivityLevel = nil, cheatDetection = nil, action = nil, author = nil, filters = nil,
|
51
52
|
scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil,
|
52
|
-
scanMethodAlgorithm = nil, aiGeneratedText = nil, customMetadata = nil
|
53
|
+
scanMethodAlgorithm = nil, aiGeneratedText = nil, customMetadata = nil, writingFeedback = nil
|
53
54
|
)
|
54
55
|
unless webhooks.instance_of?(SubmissionWebhooks)
|
55
56
|
raise 'Copyleaks::SubmissionProperties - webhooks - webhooks must be of type SubmissionWebhooks'
|
@@ -105,6 +106,9 @@ module Copyleaks
|
|
105
106
|
if !customMetadata.nil? && !(customMetadata.is_a?(Array) && customMetadata.all? { |element| element.is_a?(SubmissionCustomMetadata) })
|
106
107
|
raise 'Copyleaks::SubmissionProperties - customMetadata - customMetadata must be of type SubmissionCustomMetadata[]'
|
107
108
|
end
|
109
|
+
if !writingFeedback.nil? && !writingFeedback.instance_of?(SubmissionWritingFeedback)
|
110
|
+
raise 'Copyleaks::SubmissionProperties - writingFeedback - writingFeedback must be of type SubmissionWritingFeedback'
|
111
|
+
end
|
108
112
|
|
109
113
|
@webhooks = webhooks
|
110
114
|
@includeHtml = includeHtml
|
@@ -124,6 +128,7 @@ module Copyleaks
|
|
124
128
|
@sensitiveDataProtection = sensitiveDataProtection
|
125
129
|
@scanMethodAlgorithm = scanMethodAlgorithm
|
126
130
|
@customMetadata = customMetadata
|
131
|
+
@writingFeedback = writingFeedback
|
127
132
|
end
|
128
133
|
|
129
134
|
def as_json(*_args)
|
@@ -145,7 +150,8 @@ module Copyleaks
|
|
145
150
|
pdf: @pdf,
|
146
151
|
sensitiveDataProtection: @sensitiveDataProtection,
|
147
152
|
scanMethodAlgorithm: @scanMethodAlgorithm,
|
148
|
-
customMetadata: @customMetadata
|
153
|
+
customMetadata: @customMetadata,
|
154
|
+
writingFeedback: @writingFeedback
|
149
155
|
}.select { |_k, v| !v.nil? }
|
150
156
|
end
|
151
157
|
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#
|
2
|
+
# The MIT License(MIT)
|
3
|
+
#
|
4
|
+
# Copyright(c) 2016 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
|
+
|
25
|
+
module Copyleaks
|
26
|
+
class SubmissionWritingFeedback
|
27
|
+
attr_accessor :enable, :score
|
28
|
+
# @param [Boolean] Enable automated Writing Assistant . This feature includes grammar checking, spell checking and sentence structure corrections.
|
29
|
+
# @param [ScoreWeights] an object containing the score weights for different writing aspects (e.g., grammar, mechanics). Optional.
|
30
|
+
def initialize(enable = false, score = nil)
|
31
|
+
unless [true, false].include?(enable)
|
32
|
+
raise 'Copyleaks::SubmissionWritingFeedback - enable - enable must be of type Boolean'
|
33
|
+
end
|
34
|
+
unless score.nil? || score.is_a?(ScoreWeights)
|
35
|
+
raise 'Copyleaks::SubmissionWritingFeedback - score - score must be of type ScoreWeights'
|
36
|
+
end
|
37
|
+
|
38
|
+
@enable = enable
|
39
|
+
@score = score
|
40
|
+
end
|
41
|
+
|
42
|
+
def as_json(*_args)
|
43
|
+
{
|
44
|
+
enable: @enable,
|
45
|
+
score: @score
|
46
|
+
}.reject { |_k, v| v.nil? }
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_json(*options)
|
50
|
+
as_json(*options).to_json(*options)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb
CHANGED
File without changes
|
@@ -1,64 +1,56 @@
|
|
1
|
-
#
|
2
|
-
# The MIT License(MIT)
|
3
|
-
#
|
4
|
-
# Copyright(c) 2016 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
|
-
|
25
|
-
module Copyleaks
|
26
|
-
class ClientUtils
|
27
|
-
def self.handle_response(response, used_by)
|
28
|
-
if Utils.is_success_status_code(response.code)
|
29
|
-
if response.body.nil? || response.body == ''
|
30
|
-
nil
|
31
|
-
else
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
elsif Utils.
|
37
|
-
raise
|
38
|
-
|
39
|
-
raise
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
_expiresTime = DateTime.parse(authToken.expires)
|
58
|
-
|
59
|
-
if _expiresTime <= _time
|
60
|
-
raise AuthExipredException.new.reason # expired
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
1
|
+
#
|
2
|
+
# The MIT License(MIT)
|
3
|
+
#
|
4
|
+
# Copyright(c) 2016 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
|
+
|
25
|
+
module Copyleaks
|
26
|
+
class ClientUtils
|
27
|
+
def self.handle_response(response, used_by)
|
28
|
+
if Utils.is_success_status_code(response.code)
|
29
|
+
if response.body.nil? || response.body == ''
|
30
|
+
nil
|
31
|
+
else
|
32
|
+
JSON.parse(response.body)
|
33
|
+
end
|
34
|
+
elsif Utils.is_under_maintenance_response(response.code)
|
35
|
+
raise UnderMaintenanceException
|
36
|
+
elsif Utils.is_rate_limit_response(response.code)
|
37
|
+
raise RateLimitException
|
38
|
+
else
|
39
|
+
raise CommandException.new(response: response, used_by: used_by)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.verify_auth_token(authToken)
|
44
|
+
if authToken.nil? || !authToken.instance_of?(CopyleaksAuthToken)
|
45
|
+
raise 'authToken is Invalid, must be instance of CopyleaksAuthToken'
|
46
|
+
end
|
47
|
+
|
48
|
+
_time = DateTime.now
|
49
|
+
_expiresTime = DateTime.parse(authToken.expires)
|
50
|
+
|
51
|
+
if _expiresTime <= _time
|
52
|
+
raise AuthExpiredException # expired
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
File without changes
|
data/lib/copyleaks/version.rb
CHANGED
File without changes
|
data/lib/copyleaks.rb
CHANGED
File without changes
|
data/lib/index.rb
CHANGED
File without changes
|
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.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Copyleaks ltd
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-07 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
|
@@ -23,6 +23,7 @@ extensions: []
|
|
23
23
|
extra_rdoc_files: []
|
24
24
|
files:
|
25
25
|
- ".gitignore"
|
26
|
+
- ".vscode/launch.json"
|
26
27
|
- Gemfile
|
27
28
|
- LICENSE.txt
|
28
29
|
- README.md
|
@@ -35,7 +36,7 @@ files:
|
|
35
36
|
- lib/copyleaks/app.config.rb
|
36
37
|
- lib/copyleaks/models/auth_token.rb
|
37
38
|
- lib/copyleaks/models/delete_request_model.rb
|
38
|
-
- lib/copyleaks/models/exceptions/
|
39
|
+
- lib/copyleaks/models/exceptions/auth_expired_exception.rb
|
39
40
|
- lib/copyleaks/models/exceptions/command_exception.rb
|
40
41
|
- lib/copyleaks/models/exceptions/index.rb
|
41
42
|
- lib/copyleaks/models/exceptions/rate_limit_exception.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/copyleaks/models/submissions/properties/sensitive_data_protection.rb
|
81
82
|
- lib/copyleaks/models/submissions/properties/submission_properties.rb
|
82
83
|
- lib/copyleaks/models/submissions/properties/webhooks.rb
|
84
|
+
- lib/copyleaks/models/submissions/properties/writing_feedback.rb
|
83
85
|
- lib/copyleaks/models/submissions/submission_model.rb
|
84
86
|
- lib/copyleaks/models/submissions/url_submission_model.rb
|
85
87
|
- lib/copyleaks/models/submissions/writing_assistant/score_weights.rb
|
@@ -96,7 +98,7 @@ metadata:
|
|
96
98
|
homepage_uri: https://api.copyleaks.com
|
97
99
|
source_code_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker
|
98
100
|
changelog_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases
|
99
|
-
post_install_message:
|
101
|
+
post_install_message:
|
100
102
|
rdoc_options: []
|
101
103
|
require_paths:
|
102
104
|
- lib
|
@@ -111,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
113
|
- !ruby/object:Gem::Version
|
112
114
|
version: '0'
|
113
115
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
116
|
+
rubygems_version: 3.3.5
|
117
|
+
signing_key:
|
116
118
|
specification_version: 4
|
117
119
|
summary: Detects plagiarism and checks content distribution online.
|
118
120
|
test_files: []
|