plagiarism-checker 3.6.1 → 3.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc699083bd0fcef1b60538e6bd870ebb19010482fc228e9ebb0fa58fb4e486c3
4
- data.tar.gz: b6b25e2d9cb46c3249fb53db20c155736506cdafb8d951d8cf1d6f6d568ce297
3
+ metadata.gz: 5e6c39eff469e6df12ee451517a9d7fc26665972d34df112e3e5af0fc0358c1a
4
+ data.tar.gz: 5a58f319e6d4b5b458986f17ec55c5467e61ee8066e0a28371f10b98cd1a82cb
5
5
  SHA512:
6
- metadata.gz: 4ef3cd5e51dfbbc1a2619c36a32cded1528036930987832e37863eea10843652fe3a8f5a0831a8b5a20c17682e7a2c9af89ad7c1f36cd32151dbf04abbf0d4b8
7
- data.tar.gz: 6c7af41c69fec0e4575a362687d8a36a17b48d67c6f22b2eee317a6f35f58f6754cd066a24e1fd939ad43e23674987ad4eaf283d15f0e3bbb4ff81aa9031c2f6
6
+ metadata.gz: 55397ee13aaecc378f384013952297274028d7281e5942177a1e5b2b7c403781ee536679bb87816e3d1ecd3850f7bb27f484152edde70a4f8a1c201e86ff5858
7
+ data.tar.gz: bb14ad845218add504b353f7feaf8a0205a2da9d655abd348b9b959c2fbd8b738ef931600fbe769e3ec2bf9ff0a1be0c412ff4b6dd8fe43b991c130ff3601606
@@ -21,6 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
+ require_relative 'deprecationService.rb'
24
25
 
25
26
  module Copyleaks
26
27
  class AIDetectionClient
@@ -45,7 +46,7 @@ module Copyleaks
45
46
  end
46
47
 
47
48
  ClientUtils.verify_auth_token(authToken)
48
-
49
+ Copyleaks::DeprecationService.show_deprecation_message
49
50
  path = "/v2/writer-detector/source-code/#{scanId}/check"
50
51
 
51
52
  headers = {
data/lib/copyleaks/api.rb CHANGED
@@ -27,6 +27,7 @@ require 'date'
27
27
  require_relative 'ai_detection_client.rb'
28
28
  require_relative 'writing_assistant_client.rb'
29
29
  require_relative 'text_moderation_client.rb'
30
+ require_relative 'deprecationService.rb'
30
31
  require_relative 'utils/copyleaks_client.utils'
31
32
 
32
33
  module Copyleaks
@@ -113,6 +114,14 @@ module Copyleaks
113
114
  end
114
115
 
115
116
  verify_auth_token(authToken)
117
+ file_extension = File.extname(submission.filename).delete_prefix('.')
118
+
119
+ if file_extension.empty?
120
+ raise ArgumentError, "File extension could not be determined for filename: #{submission.filename}"
121
+ end
122
+ if Copyleaks::SupportedFilesTypes::SUPPORTED_CODE_EXTENSIONS.include?(file_extension)
123
+ Copyleaks::DeprecationService.show_deprecation_message
124
+ end
116
125
 
117
126
  path = "/v3/scans/submit/file/#{scanId}"
118
127
 
@@ -0,0 +1,39 @@
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
+ module Copyleaks
25
+ class DeprecationService
26
+ def self.show_deprecation_message
27
+
28
+ warn "DEPRECATION NOTICE: AI Code Detection will be discontinued on August 29, 2025. Please remove AI code detection integrations before the sunset date."
29
+
30
+ print "\033[31m"
31
+ puts "════════════════════════════════════════════════════════════════════"
32
+ puts "DEPRECATION NOTICE !!!"
33
+ puts "AI Code Detection will be discontinued on August 29, 2025."
34
+ puts "Please remove AI code detection integrations before the sunset date."
35
+ puts "════════════════════════════════════════════════════════════════════"
36
+ print "\033[0m"
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,28 @@
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
+ require_relative 'supportedFilesTypes.rb'
26
+
27
+ module Copyleaks
28
+ end
@@ -0,0 +1,31 @@
1
+ module Copyleaks
2
+ class SupportedFilesTypes
3
+ SUPPORTED_CODE_EXTENSIONS = [
4
+ "ts",
5
+ "py",
6
+ "go",
7
+ "cs",
8
+ "c",
9
+ "h",
10
+ "idc",
11
+ "cpp",
12
+ "hpp",
13
+ "c++",
14
+ "h++",
15
+ "cc",
16
+ "hh",
17
+ "java",
18
+ "js",
19
+ "swift",
20
+ "rb",
21
+ "pl",
22
+ "php",
23
+ "sh",
24
+ "m",
25
+ "scala",
26
+ "rs",
27
+ "vbs",
28
+ "css"
29
+ ].freeze
30
+ end
31
+ end
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
-
24
+ require_relative 'constants/index.rb'
25
25
  require_relative 'exceptions/index.rb'
26
26
  require_relative 'exports/index.rb'
27
27
  require_relative 'submissions/index.rb'
@@ -26,6 +26,8 @@ module Copyleaks
26
26
  # @param [String] base64 A base64 data string of a file. If you would like to scan plain text, encode it as base64 and submit it.
27
27
  # @param [String] filename The name of the file as it will appear in the Copyleaks scan report Make sure to include the right extension for your filetype.
28
28
  # @param [SubmissionProperties] properties Check inner properties for more details.
29
+ attr_reader :base64, :filename, :properties
30
+
29
31
  def initialize(base64, filename, properties)
30
32
  unless base64.instance_of?(String)
31
33
  raise 'Copyleaks::CopyleaksFileSubmissionModel - base64 - base64 must be of type String'
@@ -1,3 +1,3 @@
1
1
  module Copyleaks
2
- VERSION = '3.6.1'
2
+ VERSION = '3.7.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plagiarism-checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Copyleaks ltd
@@ -32,7 +32,10 @@ files:
32
32
  - lib/copyleaks/ai_detection_client.rb
33
33
  - lib/copyleaks/api.rb
34
34
  - lib/copyleaks/app.config.rb
35
+ - lib/copyleaks/deprecationService.rb
35
36
  - lib/copyleaks/models/auth_token.rb
37
+ - lib/copyleaks/models/constants/index.rb
38
+ - lib/copyleaks/models/constants/supportedFilesTypes.rb
36
39
  - lib/copyleaks/models/delete_request_model.rb
37
40
  - lib/copyleaks/models/exceptions/auth_expired_exception.rb
38
41
  - lib/copyleaks/models/exceptions/command_exception.rb
@@ -131,10 +134,6 @@ metadata:
131
134
  homepage_uri: https://api.copyleaks.com
132
135
  source_code_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker
133
136
  changelog_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases
134
- post_install_message: " \e[33m===============================================================\n
135
- \ DEPRECATION NOTICE: plagiarism-checker v3.6.1\n ===============================================================\n
136
- \ AI Code Detection will be discontinued on August 29, 2025.\n Please remove AI
137
- code detection integrations before the sunset date.\n ===============================================================\e[0m\n"
138
137
  rdoc_options: []
139
138
  require_paths:
140
139
  - lib