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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/copyleaks/ai_detection_client.rb +98 -98
  3. data/lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb +50 -50
  4. data/lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb +52 -52
  5. data/lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb +55 -55
  6. data/lib/copyleaks/models/submissions/index.rb +1 -0
  7. data/lib/copyleaks/models/submissions/webhooks/CompletedWebhook.rb +46 -0
  8. data/lib/copyleaks/models/submissions/webhooks/CreditsCheckedWebhook.rb +43 -0
  9. data/lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb +41 -0
  10. data/lib/copyleaks/models/submissions/webhooks/ExportCompletedWebhook.rb +44 -0
  11. data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Metadata.rb +89 -0
  12. data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/StatusWebhook.rb +41 -0
  13. data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Webhook.rb +43 -0
  14. data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb +43 -0
  15. data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb +68 -0
  16. data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb +61 -0
  17. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ErrorModels/Error.rb +46 -0
  18. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb +49 -0
  19. data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb +42 -0
  20. data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb +60 -0
  21. data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb +49 -0
  22. data/lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb +65 -0
  23. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Batch.rb +46 -0
  24. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb +46 -0
  25. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Internet.rb +42 -0
  26. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb +57 -0
  27. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb +30 -0
  28. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Score.rb +40 -0
  29. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb +46 -0
  30. data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Tags.rb +33 -0
  31. data/lib/copyleaks/models/submissions/webhooks/IndexedWebhook.rb +29 -0
  32. data/lib/copyleaks/models/submissions/webhooks/NewResultWebhook.rb +46 -0
  33. data/lib/copyleaks/models/submissions/webhooks/index.rb +34 -0
  34. data/lib/copyleaks/models/submissions/writing_assistant/score_weights.rb +54 -54
  35. data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb +56 -56
  36. data/lib/copyleaks/version.rb +1 -1
  37. data/lib/copyleaks/writing_assistant_client.rb +81 -81
  38. metadata +31 -4
  39. data/.vscode/launch.json +0 -35
@@ -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
@@ -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
@@ -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
@@ -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