plagiarism-checker 3.4.0 → 3.5.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/lib/copyleaks/ai_detection_client.rb +98 -98
- data/lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb +50 -50
- data/lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb +52 -52
- data/lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb +55 -55
- data/lib/copyleaks/models/submissions/index.rb +1 -0
- data/lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/CreditsCheckedWebhook.rb +43 -0
- data/lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb +41 -0
- data/lib/copyleaks/models/submissions/webhooks/ExportCompletedWebhook.rb +44 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Metadata.rb +89 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/StatusWebhook.rb +41 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Webhook.rb +43 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb +43 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb +68 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb +61 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ErrorModels/Error.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb +49 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb +42 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb +60 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb +49 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb +65 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Batch.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Internet.rb +42 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb +57 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb +30 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Score.rb +40 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Tags.rb +33 -0
- data/lib/copyleaks/models/submissions/webhooks/IndexedWebhook.rb +29 -0
- data/lib/copyleaks/models/submissions/webhooks/NewResultWebhook.rb +46 -0
- data/lib/copyleaks/models/submissions/webhooks/index.rb +34 -0
- data/lib/copyleaks/models/submissions/writing_assistant/score_weights.rb +54 -54
- data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb +56 -56
- data/lib/copyleaks/version.rb +1 -1
- data/lib/copyleaks/writing_assistant_client.rb +81 -81
- metadata +31 -4
- data/.vscode/launch.json +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8861ba4abf0d4978576fee7a8667865cf75ead57b6fe97aadcd5a8dcbd938ca4
|
4
|
+
data.tar.gz: 0646e0627f98928111112bb0e3e2fa4964342621754159c63e62086f91f0ca1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ae513036ed69b983eced3db5ef330c946d83009a03faca018297f53b554936057e6df9ee23a5f7b7505f72d199649e464d173fe5acad897dc58c8fc4a86cae
|
7
|
+
data.tar.gz: f98ab2a48d28947e540e85164b2e331ba7ef7d8671d901b6f12ba3c9146bb4ffae80427aefd0ce22819c53e41dcdf90841d7c52ac867d3fd64471b066bda252f
|
@@ -1,98 +1,98 @@
|
|
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 AIDetectionClient
|
27
|
-
def initialize(api_client)
|
28
|
-
@api_client = api_client
|
29
|
-
end
|
30
|
-
|
31
|
-
# Use Copyleaks AI Content Detection to differentiate between human source code and AI written source code.
|
32
|
-
# * Exceptions:
|
33
|
-
# * * CommandExceptions: Server reject the request. See response status code,
|
34
|
-
# headers and content for more info.
|
35
|
-
# * * UnderMaintenanceException: Copyleaks servers are unavailable for maintenance.
|
36
|
-
# We recommend to implement exponential backoff algorithm as described here:
|
37
|
-
# https://api.copyleaks.com/documentation/v3/exponential-backoff
|
38
|
-
# @param [CopyleaksAuthToken] authToken Copyleaks authentication token
|
39
|
-
# @param [String] scanId Attach your own scan Id
|
40
|
-
# @param [SourceCodeSubmissionModel] submission document
|
41
|
-
def submit_source_code(authToken, scanId, submission)
|
42
|
-
raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
|
43
|
-
if submission.nil? || !submission.instance_of?(Copyleaks::SourceCodeSubmissionModel)
|
44
|
-
raise 'submission is Invalid, must be instance of type Copyleaks::SourceCodeSubmissionModel'
|
45
|
-
end
|
46
|
-
|
47
|
-
ClientUtils.verify_auth_token(authToken)
|
48
|
-
|
49
|
-
path = "/v2/writer-detector/source-code/#{scanId}/check"
|
50
|
-
|
51
|
-
headers = {
|
52
|
-
'Content-Type' => 'application/json',
|
53
|
-
'User-Agent' => Config.user_agent,
|
54
|
-
'Authorization' => "Bearer #{authToken.accessToken}"
|
55
|
-
}
|
56
|
-
|
57
|
-
request = Net::HTTP::Post.new(path, headers)
|
58
|
-
request.body = submission.to_json
|
59
|
-
|
60
|
-
ClientUtils.handle_response(@api_client.request(request), 'submit_source_code')
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
# Use Copyleaks AI Content Detection to differentiate between human texts and AI written texts.
|
65
|
-
# * Exceptions:
|
66
|
-
# * * CommandExceptions: Server reject the request. See response status code,
|
67
|
-
# headers and content for more info.
|
68
|
-
# * * UnderMaintenanceException: Copyleaks servers are unavailable for maintenance.
|
69
|
-
# We recommend to implement exponential backoff algorithm as described here:
|
70
|
-
# https://api.copyleaks.com/documentation/v3/exponential-backoff
|
71
|
-
# @param [CopyleaksAuthToken] authToken Copyleaks authentication token
|
72
|
-
# @param [String] scanId Attach your own scan Id
|
73
|
-
# @param [SourceCodeSubmissionModel] submission document
|
74
|
-
def submit_natural_language(authToken, scanId, submission)
|
75
|
-
raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
|
76
|
-
if submission.nil? || !submission.instance_of?(Copyleaks::NaturalLanguageSubmissionModel)
|
77
|
-
raise 'submission is Invalid, must be instance of type Copyleaks::NaturalLanguageSubmissionModel'
|
78
|
-
end
|
79
|
-
|
80
|
-
ClientUtils.verify_auth_token(authToken)
|
81
|
-
|
82
|
-
path = "/v2/writer-detector/#{scanId}/check"
|
83
|
-
|
84
|
-
headers = {
|
85
|
-
'Content-Type' => 'application/json',
|
86
|
-
'User-Agent' => Config.user_agent,
|
87
|
-
'Authorization' => "Bearer #{authToken.accessToken}"
|
88
|
-
}
|
89
|
-
|
90
|
-
request = Net::HTTP::Post.new(path, headers)
|
91
|
-
request.body = submission.to_json
|
92
|
-
|
93
|
-
res = ClientUtils.handle_response(@api_client.request(request), 'submit_natural_language')
|
94
|
-
puts "RES: #{res}"
|
95
|
-
res
|
96
|
-
end
|
97
|
-
end
|
98
|
-
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 AIDetectionClient
|
27
|
+
def initialize(api_client)
|
28
|
+
@api_client = api_client
|
29
|
+
end
|
30
|
+
|
31
|
+
# Use Copyleaks AI Content Detection to differentiate between human source code and AI written source code.
|
32
|
+
# * Exceptions:
|
33
|
+
# * * CommandExceptions: Server reject the request. See response status code,
|
34
|
+
# headers and content for more info.
|
35
|
+
# * * UnderMaintenanceException: Copyleaks servers are unavailable for maintenance.
|
36
|
+
# We recommend to implement exponential backoff algorithm as described here:
|
37
|
+
# https://api.copyleaks.com/documentation/v3/exponential-backoff
|
38
|
+
# @param [CopyleaksAuthToken] authToken Copyleaks authentication token
|
39
|
+
# @param [String] scanId Attach your own scan Id
|
40
|
+
# @param [SourceCodeSubmissionModel] submission document
|
41
|
+
def submit_source_code(authToken, scanId, submission)
|
42
|
+
raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
|
43
|
+
if submission.nil? || !submission.instance_of?(Copyleaks::SourceCodeSubmissionModel)
|
44
|
+
raise 'submission is Invalid, must be instance of type Copyleaks::SourceCodeSubmissionModel'
|
45
|
+
end
|
46
|
+
|
47
|
+
ClientUtils.verify_auth_token(authToken)
|
48
|
+
|
49
|
+
path = "/v2/writer-detector/source-code/#{scanId}/check"
|
50
|
+
|
51
|
+
headers = {
|
52
|
+
'Content-Type' => 'application/json',
|
53
|
+
'User-Agent' => Config.user_agent,
|
54
|
+
'Authorization' => "Bearer #{authToken.accessToken}"
|
55
|
+
}
|
56
|
+
|
57
|
+
request = Net::HTTP::Post.new(path, headers)
|
58
|
+
request.body = submission.to_json
|
59
|
+
|
60
|
+
ClientUtils.handle_response(@api_client.request(request), 'submit_source_code')
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
# Use Copyleaks AI Content Detection to differentiate between human texts and AI written texts.
|
65
|
+
# * Exceptions:
|
66
|
+
# * * CommandExceptions: Server reject the request. See response status code,
|
67
|
+
# headers and content for more info.
|
68
|
+
# * * UnderMaintenanceException: Copyleaks servers are unavailable for maintenance.
|
69
|
+
# We recommend to implement exponential backoff algorithm as described here:
|
70
|
+
# https://api.copyleaks.com/documentation/v3/exponential-backoff
|
71
|
+
# @param [CopyleaksAuthToken] authToken Copyleaks authentication token
|
72
|
+
# @param [String] scanId Attach your own scan Id
|
73
|
+
# @param [SourceCodeSubmissionModel] submission document
|
74
|
+
def submit_natural_language(authToken, scanId, submission)
|
75
|
+
raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
|
76
|
+
if submission.nil? || !submission.instance_of?(Copyleaks::NaturalLanguageSubmissionModel)
|
77
|
+
raise 'submission is Invalid, must be instance of type Copyleaks::NaturalLanguageSubmissionModel'
|
78
|
+
end
|
79
|
+
|
80
|
+
ClientUtils.verify_auth_token(authToken)
|
81
|
+
|
82
|
+
path = "/v2/writer-detector/#{scanId}/check"
|
83
|
+
|
84
|
+
headers = {
|
85
|
+
'Content-Type' => 'application/json',
|
86
|
+
'User-Agent' => Config.user_agent,
|
87
|
+
'Authorization' => "Bearer #{authToken.accessToken}"
|
88
|
+
}
|
89
|
+
|
90
|
+
request = Net::HTTP::Post.new(path, headers)
|
91
|
+
request.body = submission.to_json
|
92
|
+
|
93
|
+
res = ClientUtils.handle_response(@api_client.request(request), 'submit_natural_language')
|
94
|
+
puts "RES: #{res}"
|
95
|
+
res
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -1,50 +1,50 @@
|
|
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 AIDetectionSubmissionModel
|
27
|
-
attr_accessor :text, :sandbox
|
28
|
-
|
29
|
-
# @param [String] A text string.
|
30
|
-
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
31
|
-
def initialize(text, sandbox = false)
|
32
|
-
unless text.instance_of?(String)
|
33
|
-
raise 'Copyleaks::AIDetectionSubmissionModel - text - text must be of type String'
|
34
|
-
end
|
35
|
-
@text = text
|
36
|
-
@sandbox = sandbox
|
37
|
-
end
|
38
|
-
|
39
|
-
def as_json(*_args)
|
40
|
-
{
|
41
|
-
'text' => @text,
|
42
|
-
'sandbox' => @sandbox
|
43
|
-
}.reject { |_, v| v.nil? }
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_json(*options)
|
47
|
-
as_json(*options).to_json(*options)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
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 AIDetectionSubmissionModel
|
27
|
+
attr_accessor :text, :sandbox
|
28
|
+
|
29
|
+
# @param [String] A text string.
|
30
|
+
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
31
|
+
def initialize(text, sandbox = false)
|
32
|
+
unless text.instance_of?(String)
|
33
|
+
raise 'Copyleaks::AIDetectionSubmissionModel - text - text must be of type String'
|
34
|
+
end
|
35
|
+
@text = text
|
36
|
+
@sandbox = sandbox
|
37
|
+
end
|
38
|
+
|
39
|
+
def as_json(*_args)
|
40
|
+
{
|
41
|
+
'text' => @text,
|
42
|
+
'sandbox' => @sandbox
|
43
|
+
}.reject { |_, v| v.nil? }
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_json(*options)
|
47
|
+
as_json(*options).to_json(*options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,52 +1,52 @@
|
|
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 NaturalLanguageSubmissionModel < AIDetectionSubmissionModel
|
27
|
-
attr_accessor :language
|
28
|
-
|
29
|
-
# @param [String] A text string.
|
30
|
-
# @param [String] The language code of your content. The selected language should be on the Supported Languages list above. If the 'language' field is not supplied , our system will automatically detect the language of the content.
|
31
|
-
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
32
|
-
def initialize(text, language = nil, sandbox = false)
|
33
|
-
unless text.instance_of?(String)
|
34
|
-
raise 'Copyleaks::NaturalLanguageSubmissionModel - text - text must be of type String'
|
35
|
-
end
|
36
|
-
super(text, sandbox)
|
37
|
-
@language = language
|
38
|
-
end
|
39
|
-
|
40
|
-
def as_json(*_args)
|
41
|
-
{
|
42
|
-
text: @text,
|
43
|
-
sandbox: @sandbox,
|
44
|
-
language: @language
|
45
|
-
}.select { |_k, v| !v.nil? }
|
46
|
-
end
|
47
|
-
|
48
|
-
def to_json(*options)
|
49
|
-
as_json(*options).to_json(*options)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
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 NaturalLanguageSubmissionModel < AIDetectionSubmissionModel
|
27
|
+
attr_accessor :language
|
28
|
+
|
29
|
+
# @param [String] A text string.
|
30
|
+
# @param [String] The language code of your content. The selected language should be on the Supported Languages list above. If the 'language' field is not supplied , our system will automatically detect the language of the content.
|
31
|
+
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
32
|
+
def initialize(text, language = nil, sandbox = false)
|
33
|
+
unless text.instance_of?(String)
|
34
|
+
raise 'Copyleaks::NaturalLanguageSubmissionModel - text - text must be of type String'
|
35
|
+
end
|
36
|
+
super(text, sandbox)
|
37
|
+
@language = language
|
38
|
+
end
|
39
|
+
|
40
|
+
def as_json(*_args)
|
41
|
+
{
|
42
|
+
text: @text,
|
43
|
+
sandbox: @sandbox,
|
44
|
+
language: @language
|
45
|
+
}.select { |_k, v| !v.nil? }
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_json(*options)
|
49
|
+
as_json(*options).to_json(*options)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,55 +1,55 @@
|
|
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 SourceCodeSubmissionModel < AIDetectionSubmissionModel
|
27
|
-
attr_accessor :filename
|
28
|
-
|
29
|
-
# @param [String] A text string.
|
30
|
-
# @param [String] The name of the file. Make sure to include the right extension for your file type.
|
31
|
-
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
32
|
-
def initialize(text, filename, sandbox = false)
|
33
|
-
unless text.instance_of?(String)
|
34
|
-
raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
|
35
|
-
end
|
36
|
-
unless filename.instance_of?(String)
|
37
|
-
raise 'Copyleaks::SourceCodeSubmissionModel - filename - filename must be of type String'
|
38
|
-
end
|
39
|
-
super(text, sandbox)
|
40
|
-
@filename = filename
|
41
|
-
end
|
42
|
-
|
43
|
-
def as_json(*_args)
|
44
|
-
{
|
45
|
-
text: @text,
|
46
|
-
sandbox: @sandbox,
|
47
|
-
filename: @filename
|
48
|
-
}.select { |_k, v| !v.nil? }
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_json(*options)
|
52
|
-
as_json(*options).to_json(*options)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
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 SourceCodeSubmissionModel < AIDetectionSubmissionModel
|
27
|
+
attr_accessor :filename
|
28
|
+
|
29
|
+
# @param [String] A text string.
|
30
|
+
# @param [String] The name of the file. Make sure to include the right extension for your file type.
|
31
|
+
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
|
32
|
+
def initialize(text, filename, sandbox = false)
|
33
|
+
unless text.instance_of?(String)
|
34
|
+
raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
|
35
|
+
end
|
36
|
+
unless filename.instance_of?(String)
|
37
|
+
raise 'Copyleaks::SourceCodeSubmissionModel - filename - filename must be of type String'
|
38
|
+
end
|
39
|
+
super(text, sandbox)
|
40
|
+
@filename = filename
|
41
|
+
end
|
42
|
+
|
43
|
+
def as_json(*_args)
|
44
|
+
{
|
45
|
+
text: @text,
|
46
|
+
sandbox: @sandbox,
|
47
|
+
filename: @filename
|
48
|
+
}.select { |_k, v| !v.nil? }
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_json(*options)
|
52
|
+
as_json(*options).to_json(*options)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -31,6 +31,7 @@ require_relative 'url_submission_model.rb'
|
|
31
31
|
require_relative 'ai_detection/ai_detection_submission_model.rb'
|
32
32
|
require_relative 'ai_detection/natural_language_submission_model.rb'
|
33
33
|
require_relative 'ai_detection/source_code_submission_model.rb'
|
34
|
+
require_relative 'Webhooks/index.rb'
|
34
35
|
|
35
36
|
require_relative 'writing_assistant/score_weights.rb'
|
36
37
|
require_relative 'writing_assistant/writing_assistant_submission_model.rb'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#The MIT License(MIT)
|
2
|
+
#Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com)
|
3
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
#of this software and associated documentation files (the "Software"), to deal
|
5
|
+
#in the Software without restriction, including without limitation the rights
|
6
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
#copies of the Software, and to permit persons to whom the Software is
|
8
|
+
#furnished to do so, subject to the following conditions:
|
9
|
+
#The above copyright notice and this permission notice shall be included in all
|
10
|
+
#copies or substantial portions of the Software.
|
11
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
|
14
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
15
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
16
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
17
|
+
#SOFTWARE.
|
18
|
+
#=
|
19
|
+
|
20
|
+
module Copyleaks
|
21
|
+
class CompletedWebhook < StatusWebhook
|
22
|
+
attr_reader :results, :notifications, :scannedDocument
|
23
|
+
|
24
|
+
def initialize(results: nil, notifications: nil, scannedDocument: nil, **args)
|
25
|
+
super(**args)
|
26
|
+
@results = results
|
27
|
+
@notifications = notifications
|
28
|
+
@scannedDocument = scannedDocument
|
29
|
+
@extra_fields = args # Store any additional fields here
|
30
|
+
end
|
31
|
+
|
32
|
+
def as_json(*_args)
|
33
|
+
super.merge(
|
34
|
+
{
|
35
|
+
results: @results.respond_to?(:as_json) ? @results.as_json : @results,
|
36
|
+
notifications: @notifications.respond_to?(:as_json) ? @notifications.as_json : @notifications,
|
37
|
+
scannedDocument: @scannedDocument.respond_to?(:as_json) ? @scannedDocument.as_json : @scannedDocument
|
38
|
+
}
|
39
|
+
).merge(@extra_fields)
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json(*options)
|
43
|
+
as_json.to_json(*options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#The MIT License(MIT)
|
2
|
+
#Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com)
|
3
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
#of this software and associated documentation files (the "Software"), to deal
|
5
|
+
#in the Software without restriction, including without limitation the rights
|
6
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
#copies of the Software, and to permit persons to whom the Software is
|
8
|
+
#furnished to do so, subject to the following conditions:
|
9
|
+
#The above copyright notice and this permission notice shall be included in all
|
10
|
+
#copies or substantial portions of the Software.
|
11
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
|
14
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
15
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
16
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
17
|
+
#SOFTWARE.
|
18
|
+
#=
|
19
|
+
|
20
|
+
module Copyleaks
|
21
|
+
class CreditsCheckedWebhook < StatusWebhook
|
22
|
+
attr_reader :credits, :scannedDocument
|
23
|
+
|
24
|
+
def initialize(credits: nil, scannedDocument: nil, **args)
|
25
|
+
super(**args)
|
26
|
+
@credits = credits
|
27
|
+
@scannedDocument = scannedDocument
|
28
|
+
end
|
29
|
+
|
30
|
+
def as_json(*_args)
|
31
|
+
super.merge(
|
32
|
+
{
|
33
|
+
credits: @credits,
|
34
|
+
scannedDocument: @scannedDocument.respond_to?(:as_json) ? @scannedDocument.as_json : @scannedDocument
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_json(*options)
|
40
|
+
as_json.to_json(*options)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|