plagiarism-checker 3.3.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/.gitignore +0 -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 +98 -98
- 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 +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/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 +1 -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/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/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 +81 -81
- data/lib/copyleaks.rb +0 -0
- data/lib/index.rb +0 -0
- metadata +36 -7
@@ -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 Notifications
|
22
|
+
attr_reader :alerts
|
23
|
+
|
24
|
+
# @param [Array<Alerts>] alerts - A list of scan alerts that were detected in the scan.
|
25
|
+
def initialize(alerts: nil)
|
26
|
+
if !alerts.nil? && !(alerts.is_a?(Array) && alerts.all? { |a| a.is_a?(Alerts) })
|
27
|
+
raise 'Copyleaks::Notifications - alerts must be an array of Alerts objects'
|
28
|
+
end
|
29
|
+
|
30
|
+
@alerts = alerts
|
31
|
+
end
|
32
|
+
|
33
|
+
def as_json(*_args)
|
34
|
+
{
|
35
|
+
alerts: @alerts
|
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
|
@@ -0,0 +1,68 @@
|
|
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
|
+
|
21
|
+
module Copyleaks
|
22
|
+
class Results
|
23
|
+
attr_reader :database, :batch, :repositories, :score, :internet
|
24
|
+
|
25
|
+
# @param [Array<Database>] database
|
26
|
+
# @param [Array<Batch>] batch
|
27
|
+
# @param [Array<Repositories>] repositories
|
28
|
+
# @param [Score] score
|
29
|
+
# @param [Array<Internet>] internet
|
30
|
+
def initialize(database: nil, batch: nil, repositories: nil, score: nil, internet: nil)
|
31
|
+
if !database.nil? && !(database.is_a?(Array) && database.all? { |d| d.is_a?(Database) })
|
32
|
+
raise 'Copyleaks::Results - database must be an array of Database objects'
|
33
|
+
end
|
34
|
+
if !batch.nil? && !(batch.is_a?(Array) && batch.all? { |b| b.is_a?(Batch) })
|
35
|
+
raise 'Copyleaks::Results - batch must be an array of Batch objects'
|
36
|
+
end
|
37
|
+
if !repositories.nil? && !(repositories.is_a?(Array) && repositories.all? { |r| r.is_a?(Repositories) })
|
38
|
+
raise 'Copyleaks::Results - repositories must be an array of Repositories objects'
|
39
|
+
end
|
40
|
+
if !score.nil? && !score.is_a?(Score)
|
41
|
+
raise 'Copyleaks::Results - score must be a Score object'
|
42
|
+
end
|
43
|
+
if !internet.nil? && !(internet.is_a?(Array) && internet.all? { |i| i.is_a?(Internet) })
|
44
|
+
raise 'Copyleaks::Results - internet must be an array of Internet objects'
|
45
|
+
end
|
46
|
+
|
47
|
+
@database = database
|
48
|
+
@batch = batch
|
49
|
+
@repositories = repositories
|
50
|
+
@score = score
|
51
|
+
@internet = internet
|
52
|
+
end
|
53
|
+
|
54
|
+
def as_json(*_args)
|
55
|
+
{
|
56
|
+
database: @database,
|
57
|
+
batch: @batch,
|
58
|
+
repositories: @repositories,
|
59
|
+
score: @score,
|
60
|
+
internet: @internet
|
61
|
+
}.select { |_k, v| !v.nil? }
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_json(*options)
|
65
|
+
as_json(*options).to_json(*options)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb
ADDED
@@ -0,0 +1,61 @@
|
|
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 ScannedDocument
|
22
|
+
attr_reader :scanId, :totalWords, :totalExcluded, :credits, :creationTime, :metadata
|
23
|
+
|
24
|
+
# @param [String] scanId - The unique scan id provided by you.
|
25
|
+
# @param [Integer] totalWords - Total number of words found in the scanned text.
|
26
|
+
# @param [Integer] totalExcluded - Number of excluded words in the submitted content.
|
27
|
+
# @param [Integer] credits - Overall credits used for the scan.
|
28
|
+
# @param [String] creationTime - The creation time of the scan.
|
29
|
+
# @param [Metadata] metadata - Metadata object
|
30
|
+
def initialize(scanId:, totalWords:, totalExcluded:, credits:, creationTime:, metadata:)
|
31
|
+
raise 'scanId must be a String' unless scanId.is_a?(String)
|
32
|
+
raise 'totalWords must be an Integer' unless totalWords.is_a?(Integer)
|
33
|
+
raise 'totalExcluded must be an Integer' unless totalExcluded.is_a?(Integer)
|
34
|
+
raise 'credits must be an Integer' unless credits.is_a?(Integer)
|
35
|
+
raise 'creationTime must be a String' unless creationTime.is_a?(String)
|
36
|
+
raise 'metadata must be a Metadata object' unless metadata.is_a?(Metadata)
|
37
|
+
|
38
|
+
@scanId = scanId
|
39
|
+
@totalWords = totalWords
|
40
|
+
@totalExcluded = totalExcluded
|
41
|
+
@credits = credits
|
42
|
+
@creationTime = creationTime
|
43
|
+
@metadata = metadata
|
44
|
+
end
|
45
|
+
|
46
|
+
def as_json(*_args)
|
47
|
+
{
|
48
|
+
scanId: @scanId,
|
49
|
+
totalWords: @totalWords,
|
50
|
+
totalExcluded: @totalExcluded,
|
51
|
+
credits: @credits,
|
52
|
+
creationTime: @creationTime,
|
53
|
+
metadata: @metadata
|
54
|
+
}.select { |_k, v| !v.nil? }
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_json(*options)
|
58
|
+
as_json(*options).to_json(*options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -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
|
+
|
21
|
+
module Copyleaks
|
22
|
+
class Error
|
23
|
+
attr_reader :code, :message
|
24
|
+
|
25
|
+
# @param [Integer] code - Error code that represents the reason for failure.
|
26
|
+
# @param [String] message - Error message that represents the reason for failure.
|
27
|
+
def initialize(code:, message:)
|
28
|
+
raise 'Copyleaks::Error - code must be an Integer' unless code.is_a?(Integer)
|
29
|
+
raise 'Copyleaks::Error - message must be a String' unless message.is_a?(String)
|
30
|
+
|
31
|
+
@code = code
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
|
35
|
+
def as_json(*_args)
|
36
|
+
{
|
37
|
+
code: @code,
|
38
|
+
message: @message
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json(*options)
|
43
|
+
as_json(*options).to_json(*options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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 Task
|
22
|
+
attr_reader :endpoint, :isHealthy, :httpStatusCode
|
23
|
+
|
24
|
+
# @param [String] endpoint - The endpoint address of the export task.
|
25
|
+
# @param [Boolean] isHealthy - This flag gives an indication whether the scan was completed without internal errors on the Copyleaks side.
|
26
|
+
# @param [Integer] httpStatusCode - The status code reported by the customer servers. If the tasks.isHealthy is equal to false - this field will be null.
|
27
|
+
def initialize(endpoint:, isHealthy:, httpStatusCode:)
|
28
|
+
raise 'Copyleaks::Task - endpoint must be a String' unless endpoint.is_a?(String)
|
29
|
+
raise 'Copyleaks::Task - isHealthy must be a Boolean' unless [true, false].include?(isHealthy)
|
30
|
+
raise 'Copyleaks::Task - httpStatusCode must be an Integer' unless httpStatusCode.is_a?(Integer)
|
31
|
+
|
32
|
+
@endpoint = endpoint
|
33
|
+
@isHealthy = isHealthy
|
34
|
+
@httpStatusCode = httpStatusCode
|
35
|
+
end
|
36
|
+
|
37
|
+
def as_json(*_args)
|
38
|
+
{
|
39
|
+
endpoint: @endpoint,
|
40
|
+
isHealthy: @isHealthy,
|
41
|
+
httpStatusCode: @httpStatusCode
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_json(*options)
|
46
|
+
as_json(*options).to_json(*options)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb
ADDED
@@ -0,0 +1,42 @@
|
|
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
|
+
|
21
|
+
module Copyleaks
|
22
|
+
class NewResultScore
|
23
|
+
attr_reader :aggregatedScore
|
24
|
+
|
25
|
+
# @param [Float] aggregatedScore - The percentage of similar words from all results. The calculation does not include excluded references, quotations, etc...
|
26
|
+
def initialize(aggregatedScore:)
|
27
|
+
raise 'Copyleaks::NewResultScore - aggregatedScore must be a Float' unless aggregatedScore.is_a?(Float) || aggregatedScore.is_a?(Integer)
|
28
|
+
|
29
|
+
@aggregatedScore = aggregatedScore.to_f
|
30
|
+
end
|
31
|
+
|
32
|
+
def as_json(*_args)
|
33
|
+
{
|
34
|
+
aggregatedScore: @aggregatedScore
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_json(*options)
|
39
|
+
as_json(*options).to_json(*options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb
ADDED
@@ -0,0 +1,60 @@
|
|
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
|
+
module Copyleaks
|
20
|
+
class NewResultsInternet
|
21
|
+
attr_reader :id, :title, :introduction, :matchedWords, :metadata, :url
|
22
|
+
|
23
|
+
# @param [String] id - Unique result ID to identify the result.
|
24
|
+
# @param [String] title - Document title. Mostly extracted from the document content.
|
25
|
+
# @param [String] introduction - Document brief introduction. Mostly extracted from the document content.
|
26
|
+
# @param [Integer] matchedWords - Total matched words between this result and the scanned document.
|
27
|
+
# @param [Metadata] metadata - Metadata object
|
28
|
+
# @param [String] url - Public URL of the resource.
|
29
|
+
def initialize(id:, title:, introduction:, matchedWords:, scanId:, metadata:, url:)
|
30
|
+
raise 'Copyleaks::NewResultsInternet - id must be a String' unless id.is_a?(String)
|
31
|
+
raise 'Copyleaks::NewResultsInternet - title must be a String' unless title.is_a?(String)
|
32
|
+
raise 'Copyleaks::NewResultsInternet - introduction must be a String' unless introduction.is_a?(String)
|
33
|
+
raise 'Copyleaks::NewResultsInternet - matchedWords must be an Integer' unless matchedWords.is_a?(Integer)
|
34
|
+
raise 'Copyleaks::NewResultsInternet - metadata must be a Metadata' unless metadata.is_a?(Metadata)
|
35
|
+
raise 'Copyleaks::NewResultsInternet - url must be a String' unless url.is_a?(String)
|
36
|
+
|
37
|
+
@id = id
|
38
|
+
@title = title
|
39
|
+
@introduction = introduction
|
40
|
+
@matchedWords = matchedWords
|
41
|
+
@metadata = metadata
|
42
|
+
@url = url
|
43
|
+
end
|
44
|
+
|
45
|
+
def as_json(*_args)
|
46
|
+
{
|
47
|
+
id: @id,
|
48
|
+
title: @title,
|
49
|
+
introduction: @introduction,
|
50
|
+
matchedWords: @matchedWords,
|
51
|
+
metadata: @metadata,
|
52
|
+
url: @url
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_json(*options)
|
57
|
+
as_json(*options).to_json(*options)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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 NewResultsRepositories < SharedResultsModel
|
22
|
+
attr_reader :repositoryId
|
23
|
+
|
24
|
+
# @param [String] repositoryId - The repository Id that has the result.
|
25
|
+
# @param [RepositoryMetadata] metadata - Metadata object
|
26
|
+
def initialize(repositoryId:, metadata:)
|
27
|
+
raise 'Copyleaks::NewResultsRepositories - repositoryId must be a String' unless repositoryId.is_a?(String)
|
28
|
+
super(metadata: metadata)
|
29
|
+
|
30
|
+
@repositoryId = repositoryId
|
31
|
+
end
|
32
|
+
|
33
|
+
# Override metadata getter to return a RepositoryMetadata type explicitly
|
34
|
+
def metadata
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def as_json(*_args)
|
39
|
+
{
|
40
|
+
repositoryId: @repositoryId,
|
41
|
+
metadata: metadata
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_json(*options)
|
46
|
+
as_json(*options).to_json(*options)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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 Alerts
|
22
|
+
attr_reader :category, :code, :title, :message, :helpLink, :severity, :additionalData
|
23
|
+
|
24
|
+
# @param [int] $category - Scan alert category.
|
25
|
+
# @param [string] $title - Scan alert human-readable title.
|
26
|
+
# @param [string] $message - Provides human-readable information about the scan alert.
|
27
|
+
# @param [string|null] $helpLink - URL to a resource describing the specific scan alert.
|
28
|
+
# @param [int] $severity - Specifies the importance of the scan alert.
|
29
|
+
# @param [string] $additionalData - Additional data about the scan alert. Supplied as a JSON string.
|
30
|
+
# @param [string] $code - Scan alert code. The code is unique for each scan alert.
|
31
|
+
def initialize(category:, code:, title:, message:, helpLink:, severity:, additionalData:)
|
32
|
+
raise 'Copyleaks::Alerts - category must be a String' unless category.is_a?(String)
|
33
|
+
raise 'Copyleaks::Alerts - code must be a String' unless code.is_a?(String)
|
34
|
+
raise 'Copyleaks::Alerts - title must be a String' unless title.is_a?(String)
|
35
|
+
raise 'Copyleaks::Alerts - message must be a String' unless message.is_a?(String)
|
36
|
+
raise 'Copyleaks::Alerts - helpLink must be a String' unless helpLink.is_a?(String)
|
37
|
+
raise 'Copyleaks::Alerts - severity must be a String' unless severity.is_a?(String)
|
38
|
+
raise 'Copyleaks::Alerts - additionalData must be a String' unless additionalData.is_a?(String)
|
39
|
+
|
40
|
+
@category = category
|
41
|
+
@code = code
|
42
|
+
@title = title
|
43
|
+
@message = message
|
44
|
+
@helpLink = helpLink
|
45
|
+
@severity = severity
|
46
|
+
@additionalData = additionalData
|
47
|
+
end
|
48
|
+
|
49
|
+
def as_json(*_args)
|
50
|
+
{
|
51
|
+
category: @category,
|
52
|
+
code: @code,
|
53
|
+
title: @title,
|
54
|
+
message: @message,
|
55
|
+
helpLink: @helpLink,
|
56
|
+
severity: @severity,
|
57
|
+
additionalData: @additionalData
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_json(*options)
|
62
|
+
as_json(*options).to_json(*options)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -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
|
+
|
21
|
+
module Copyleaks
|
22
|
+
class Batch < SharedResultsModel
|
23
|
+
attr_reader :tags
|
24
|
+
|
25
|
+
# @param [Array<Tags>] tags - Tags object array
|
26
|
+
def initialize(tags:, **options)
|
27
|
+
unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
|
28
|
+
raise 'Copyleaks::Batch - tags must be an Array of Tags'
|
29
|
+
end
|
30
|
+
|
31
|
+
super(**options) # Pass any other options to SharedResultsModel
|
32
|
+
|
33
|
+
@tags = tags
|
34
|
+
end
|
35
|
+
|
36
|
+
def as_json(*_args)
|
37
|
+
{
|
38
|
+
tags: @tags
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json(*options)
|
43
|
+
as_json(*options).to_json(*options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -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
|
+
|
21
|
+
module Copyleaks
|
22
|
+
class Database < SharedResultsModel
|
23
|
+
attr_reader :tags
|
24
|
+
|
25
|
+
# @param [Array<Tags>] tags - Tags object array
|
26
|
+
def initialize(tags:, **options)
|
27
|
+
unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
|
28
|
+
raise 'Copyleaks::Database - tags must be an Array of Tags'
|
29
|
+
end
|
30
|
+
|
31
|
+
super(**options) # Pass any other options to SharedResultsModel
|
32
|
+
|
33
|
+
@tags = tags
|
34
|
+
end
|
35
|
+
|
36
|
+
def as_json(*_args)
|
37
|
+
{
|
38
|
+
tags: @tags
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json(*options)
|
43
|
+
as_json(*options).to_json(*options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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 Internet < NewResultsInternet
|
22
|
+
attr_reader :tags
|
23
|
+
|
24
|
+
# @param [Array<Tags>] tags - Tags object array
|
25
|
+
def initialize(tags:, **options)
|
26
|
+
unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
|
27
|
+
raise 'Copyleaks::Internet - tags must be an Array of Tags'
|
28
|
+
end
|
29
|
+
|
30
|
+
super(**options) # Initialize parent class with other params
|
31
|
+
@tags = tags
|
32
|
+
end
|
33
|
+
|
34
|
+
def as_json(*_args)
|
35
|
+
super.merge(tags: @tags)
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_json(*options)
|
39
|
+
as_json(*options).to_json(*options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|