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,57 @@
|
|
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 Repositories < SharedResultsModel
|
23
|
+
attr_reader :repositoryId, :tags
|
24
|
+
|
25
|
+
# @param [String] repositoryId - The repository Id that has the result.
|
26
|
+
# @param [Array<Tags>] tags - Tags object array
|
27
|
+
def initialize(repositoryId:, tags:, **options)
|
28
|
+
unless repositoryId.is_a?(String)
|
29
|
+
raise 'Copyleaks::Repositories - repositoryId must be a String'
|
30
|
+
end
|
31
|
+
|
32
|
+
unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
|
33
|
+
raise 'Copyleaks::Repositories - tags must be an Array of Tags'
|
34
|
+
end
|
35
|
+
|
36
|
+
super(**options)
|
37
|
+
|
38
|
+
@repositoryId = repositoryId
|
39
|
+
@tags = tags
|
40
|
+
end
|
41
|
+
|
42
|
+
def metadata
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def as_json(*_args)
|
47
|
+
{
|
48
|
+
repositoryId: @repositoryId,
|
49
|
+
tags: @tags
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_json(*options)
|
54
|
+
as_json(*options).to_json(*options)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb
ADDED
@@ -0,0 +1,30 @@
|
|
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 RepositoryMetadata < Metadata
|
22
|
+
# @param [String] submittedBy - Email of the user which added this document to the repository.
|
23
|
+
attr_reader :submittedBy
|
24
|
+
|
25
|
+
def initialize(submittedBy: nil, **args)
|
26
|
+
super(**args)
|
27
|
+
@submittedBy = submittedBy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 Score
|
22
|
+
attr_reader :identicalWords, :minorChangedWords, :relatedMeaningWords, :aggregatedScore
|
23
|
+
|
24
|
+
# @param [int] $identicalWords - Number of words which matched exactly.
|
25
|
+
# @param [int] $relatedMeaningWords - Number of paraphrased words showing similar ideas with different words.
|
26
|
+
# @param [float] $aggregatedScore - The percentage of similar words from all results. The calculation does not include excluded references, quotations, etc.
|
27
|
+
# @param [int] $minorChangedWords - Number of nearly identical words with small differences like 'slow' and 'slowly'.
|
28
|
+
def initialize(
|
29
|
+
identicalWords: nil,
|
30
|
+
minorChangedWords: nil,
|
31
|
+
relatedMeaningWords: nil,
|
32
|
+
aggregatedScore: nil
|
33
|
+
)
|
34
|
+
@identicalWords = identicalWords
|
35
|
+
@minorChangedWords = minorChangedWords
|
36
|
+
@relatedMeaningWords = relatedMeaningWords
|
37
|
+
@aggregatedScore = aggregatedScore
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb
ADDED
@@ -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 SharedResultsModel
|
22
|
+
attr_reader :id, :title, :introduction, :matchedWords, :scanId, :metadata
|
23
|
+
|
24
|
+
# @param [string] $id - Unique result ID to identify this result.
|
25
|
+
# @param [string] $introduction - Document brief introduction. Mostly extracted from the document content.
|
26
|
+
# @param [int] $matchedWords - Total matched words between this result and the scanned document.
|
27
|
+
# @param [string|null] $scanId - In case a result was found in the Copyleaks internal database and was submitted by you, this will show the scan id of the specific result. Otherwise, this field will remain empty.
|
28
|
+
# @param [Metadata] $metadata - Metadata object.
|
29
|
+
# @param [string] $title - Document title. Mostly extracted from the document content.
|
30
|
+
def initialize(
|
31
|
+
id: nil,
|
32
|
+
title: nil,
|
33
|
+
introduction: nil,
|
34
|
+
matchedWords: nil,
|
35
|
+
scanId: nil,
|
36
|
+
metadata: nil
|
37
|
+
)
|
38
|
+
@id = id
|
39
|
+
@title = title
|
40
|
+
@introduction = introduction
|
41
|
+
@matchedWords = matchedWords
|
42
|
+
@scanId = scanId
|
43
|
+
@metadata = metadata
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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 Tags
|
22
|
+
attr_reader :code, :title, :description
|
23
|
+
|
24
|
+
# @param [string] $code - Unique ID that signifies the type of result tag.
|
25
|
+
# @param [string] $description - Short text describing this tag.
|
26
|
+
# @param [string] $title - A simple name for this tag.
|
27
|
+
def initialize(code: nil, title: nil, description: nil)
|
28
|
+
@code = code
|
29
|
+
@title = title
|
30
|
+
@description = description
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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 IndexedWebhook < StatusWebhook
|
21
|
+
# No new attr_reader needed — inherited developerPayload
|
22
|
+
|
23
|
+
def initialize(status:, developerPayload: nil, **args)
|
24
|
+
super(status: status, developerPayload: developerPayload, **args)
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
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
|
+
module Copyleaks
|
20
|
+
class NewResultWebhook < Webhook
|
21
|
+
attr_reader :score, :internet, :database, :batch, :repositories
|
22
|
+
|
23
|
+
def initialize(score: nil, internet: nil, database: nil, batch: nil, repositories: nil, **args)
|
24
|
+
super(**args)
|
25
|
+
@score = score
|
26
|
+
@internet = internet
|
27
|
+
@database = database
|
28
|
+
@batch = batch
|
29
|
+
@repositories = repositories
|
30
|
+
end
|
31
|
+
|
32
|
+
def as_json(*_args)
|
33
|
+
{
|
34
|
+
score: @score,
|
35
|
+
internet: @internet,
|
36
|
+
database: @database,
|
37
|
+
batch: @batch,
|
38
|
+
repositories: @repositories
|
39
|
+
}.merge(super)
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json(*options)
|
43
|
+
as_json.to_json(*options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Copyleaks
|
2
|
+
require_relative 'HelperModels/baseModels/Metadata.rb'
|
3
|
+
require_relative 'HelperModels/baseModels/Webhook.rb'
|
4
|
+
require_relative 'HelperModels/baseModels/StatusWebhook.rb'
|
5
|
+
|
6
|
+
require_relative 'HelperModels/ResultsModels/SharedResultsModel.rb'
|
7
|
+
require_relative 'HelperModels/NewResultsModels/NewResultScore.rb'
|
8
|
+
require_relative 'HelperModels/NewResultsModels/NewResultsInternet.rb'
|
9
|
+
require_relative 'HelperModels/NewResultsModels/NewResultsRepositories.rb'
|
10
|
+
|
11
|
+
require_relative 'HelperModels/ResultsModels/Batch.rb'
|
12
|
+
require_relative 'HelperModels/ResultsModels/Internet.rb'
|
13
|
+
require_relative 'HelperModels/ResultsModels/Database.rb'
|
14
|
+
require_relative 'HelperModels/ResultsModels/Repositories.rb'
|
15
|
+
require_relative 'HelperModels/ResultsModels/RepositoryMetadata.rb'
|
16
|
+
require_relative 'HelperModels/ResultsModels/Score.rb'
|
17
|
+
require_relative 'HelperModels/ResultsModels/Tags.rb'
|
18
|
+
|
19
|
+
require_relative 'HelperModels/CompletedModels/Notifications.rb'
|
20
|
+
require_relative 'HelperModels/CompletedModels/Results.rb'
|
21
|
+
require_relative 'HelperModels/CompletedModels/ScannedDocument.rb'
|
22
|
+
|
23
|
+
require_relative 'HelperModels/ErrorModels/Error.rb'
|
24
|
+
require_relative 'HelperModels/NotificationsModels/Alerts.rb'
|
25
|
+
require_relative 'HelperModels/ExportModels/Task.rb'
|
26
|
+
|
27
|
+
require_relative 'CompletedWebhook.rb'
|
28
|
+
require_relative 'CreditsCheckedWebhook.rb'
|
29
|
+
require_relative 'ErrorWebhook.rb'
|
30
|
+
require_relative 'IndexedWebhook.rb'
|
31
|
+
require_relative 'ExportCompletedWebhook.rb'
|
32
|
+
|
33
|
+
require_relative 'NewResultWebhook.rb'
|
34
|
+
end
|
@@ -1,54 +1,54 @@
|
|
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 ScoreWeights
|
27
|
-
# @param [Float] Grammar correction category weight in the overall score. 0.0 >= weight <= 1.0
|
28
|
-
# @param [Float] Mechanics correction category weight in the overall score. 0.0 >= weight <= 1.0
|
29
|
-
# @param [Float] Sentence structure correction category weight in the overall score. 0.0 >= weight <= 1.0
|
30
|
-
# @param [Float] Word choice correction category weight in the overall score. 0.0 >= weight <= 1.0
|
31
|
-
|
32
|
-
attr_accessor :grammar_score_weight, :mechanics_score_weight, :sentence_structure_score_weight, :word_choice_score_weight
|
33
|
-
|
34
|
-
def initialize(grammar_score_weight, mechanics_score_weight, sentence_structure_score_weight, word_choice_score_weight)
|
35
|
-
@grammar_score_weight = grammar_score_weight
|
36
|
-
@mechanics_score_weight = mechanics_score_weight
|
37
|
-
@sentence_structure_score_weight = sentence_structure_score_weight
|
38
|
-
@word_choice_score_weight = word_choice_score_weight
|
39
|
-
end
|
40
|
-
|
41
|
-
def as_json(*_args)
|
42
|
-
{
|
43
|
-
grammarScoreWeight: @grammar_score_weight,
|
44
|
-
mechanicsScoreWeight: @mechanics_score_weight,
|
45
|
-
sentenceStructureScoreWeight: @sentence_structure_score_weight,
|
46
|
-
wordChoiceScoreWeight: @word_choice_score_weight
|
47
|
-
}.reject { |_k, v| v.nil? }
|
48
|
-
end
|
49
|
-
|
50
|
-
def to_json(*options)
|
51
|
-
as_json(*options).to_json(*options)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
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 ScoreWeights
|
27
|
+
# @param [Float] Grammar correction category weight in the overall score. 0.0 >= weight <= 1.0
|
28
|
+
# @param [Float] Mechanics correction category weight in the overall score. 0.0 >= weight <= 1.0
|
29
|
+
# @param [Float] Sentence structure correction category weight in the overall score. 0.0 >= weight <= 1.0
|
30
|
+
# @param [Float] Word choice correction category weight in the overall score. 0.0 >= weight <= 1.0
|
31
|
+
|
32
|
+
attr_accessor :grammar_score_weight, :mechanics_score_weight, :sentence_structure_score_weight, :word_choice_score_weight
|
33
|
+
|
34
|
+
def initialize(grammar_score_weight, mechanics_score_weight, sentence_structure_score_weight, word_choice_score_weight)
|
35
|
+
@grammar_score_weight = grammar_score_weight
|
36
|
+
@mechanics_score_weight = mechanics_score_weight
|
37
|
+
@sentence_structure_score_weight = sentence_structure_score_weight
|
38
|
+
@word_choice_score_weight = word_choice_score_weight
|
39
|
+
end
|
40
|
+
|
41
|
+
def as_json(*_args)
|
42
|
+
{
|
43
|
+
grammarScoreWeight: @grammar_score_weight,
|
44
|
+
mechanicsScoreWeight: @mechanics_score_weight,
|
45
|
+
sentenceStructureScoreWeight: @sentence_structure_score_weight,
|
46
|
+
wordChoiceScoreWeight: @word_choice_score_weight
|
47
|
+
}.reject { |_k, v| v.nil? }
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_json(*options)
|
51
|
+
as_json(*options).to_json(*options)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb
CHANGED
@@ -1,56 +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 WritingAssistantSubmissionModel
|
27
|
-
attr_accessor :text, :sandbox, :language, :score
|
28
|
-
|
29
|
-
# @param [String] Text to produce Writing Assistant report for. 1 >= characters <= 25000
|
30
|
-
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API without consuming any credits.
|
31
|
-
# @param [String] language The language code of your content. Optional; if not provided, the system will attempt to auto-detect the language.
|
32
|
-
# @param [ScoreWeights] an object containing the score weights for different writing aspects (e.g., grammar, mechanics). Optional.
|
33
|
-
def initialize(text, sandbox = false, language = nil, score = nil)
|
34
|
-
unless text.instance_of?(String)
|
35
|
-
raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
|
36
|
-
end
|
37
|
-
@text = text
|
38
|
-
@sandbox = sandbox
|
39
|
-
@language = language
|
40
|
-
@score = score
|
41
|
-
end
|
42
|
-
|
43
|
-
def as_json(*_args)
|
44
|
-
{
|
45
|
-
text: @text,
|
46
|
-
sandbox: @sandbox,
|
47
|
-
language: @language,
|
48
|
-
score: @score
|
49
|
-
}.reject { |_k, v| v.nil? }
|
50
|
-
end
|
51
|
-
|
52
|
-
def to_json(*options)
|
53
|
-
as_json(*options).to_json(*options)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
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 WritingAssistantSubmissionModel
|
27
|
+
attr_accessor :text, :sandbox, :language, :score
|
28
|
+
|
29
|
+
# @param [String] Text to produce Writing Assistant report for. 1 >= characters <= 25000
|
30
|
+
# @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API without consuming any credits.
|
31
|
+
# @param [String] language The language code of your content. Optional; if not provided, the system will attempt to auto-detect the language.
|
32
|
+
# @param [ScoreWeights] an object containing the score weights for different writing aspects (e.g., grammar, mechanics). Optional.
|
33
|
+
def initialize(text, sandbox = false, language = nil, score = nil)
|
34
|
+
unless text.instance_of?(String)
|
35
|
+
raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
|
36
|
+
end
|
37
|
+
@text = text
|
38
|
+
@sandbox = sandbox
|
39
|
+
@language = language
|
40
|
+
@score = score
|
41
|
+
end
|
42
|
+
|
43
|
+
def as_json(*_args)
|
44
|
+
{
|
45
|
+
text: @text,
|
46
|
+
sandbox: @sandbox,
|
47
|
+
language: @language,
|
48
|
+
score: @score
|
49
|
+
}.reject { |_k, v| v.nil? }
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_json(*options)
|
53
|
+
as_json(*options).to_json(*options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|