plagiarism-checker 3.7.0 → 4.0.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: 5e6c39eff469e6df12ee451517a9d7fc26665972d34df112e3e5af0fc0358c1a
4
- data.tar.gz: 5a58f319e6d4b5b458986f17ec55c5467e61ee8066e0a28371f10b98cd1a82cb
3
+ metadata.gz: 692f431026f826b2ca580843b76fb78e526a4b33bf130e5baa2733445f52e371
4
+ data.tar.gz: d12e8ad811a38051846ed99ab4e2bd04735bc3a06489ac918bc7a16adfce8dc9
5
5
  SHA512:
6
- metadata.gz: 55397ee13aaecc378f384013952297274028d7281e5942177a1e5b2b7c403781ee536679bb87816e3d1ecd3850f7bb27f484152edde70a4f8a1c201e86ff5858
7
- data.tar.gz: bb14ad845218add504b353f7feaf8a0205a2da9d655abd348b9b959c2fbd8b738ef931600fbe769e3ec2bf9ff0a1be0c412ff4b6dd8fe43b991c130ff3601606
6
+ metadata.gz: 51886d89ac8c1cf8976fcb3fdc25cdbfe6aff4b85752e5d2783a14b8d8b08b71f1c7c2861222bbd3374d7b3bbe114274df9bcccb252d2f2176ebc923768306a6
7
+ data.tar.gz: 035e2164be6ed073d7f17eb3e75aa8d6954ffa7028d668a3935ff0fc5540561e6e95df037799eb9554f5b4ee15bddbfd2610bf2294c7fc6d3803d8dc3394c2bd
data/README.md CHANGED
@@ -1,47 +1,206 @@
1
- # Copyleaks Ruby SDK
1
+ # Copyleaks SDK
2
+ The official [Copyleaks](https://copyleaks.com/) Ruby library.
2
3
 
3
- Copyleaks SDK is a simple framework that allows you to scan text for plagiarism and detect content distribution online, using the Copyleaks plagiarism checker cloud.
4
+ ## 🚀 Getting Started
5
+ Before you start, ensure you have the following:
4
6
 
5
- Using Copyleaks SDK you can check for plagiarism in:
6
- * Online content and webpages
7
- * Local and cloud files (see [supported files](https://api.copyleaks.com/documentation/specifications#2-supported-file-types))
8
- * Free text
9
- * OCR (Optical Character Recognition) - scanning pictures with textual content (see [supported files](https://api.copyleaks.com/documentation/specifications#6-supported-image-types-ocr))
7
+ * An active Copyleaks account. If you don’t have one, [sign up for free](https://copyleaks.com/signup).
8
+ * You can find your API key on the [API Dashboard](https://api.copyleaks.com/dashboard).
10
9
 
11
- ## Installation
12
-
13
- Install using [RubyGems](https://rubygems.org/gems/plagiarism-checker)
10
+ Once you have your account and API key:
14
11
 
12
+ **Install the SDK**:
13
+
14
+ Install using [RubyGems](https://rubygems.org/gems/plagiarism-checker)
15
15
  ```bash
16
16
  gem install plagiarism-checker
17
17
  ```
18
18
 
19
- ## Register and Get Your API Key
20
- To use the Copyleaks API you need to first be a registered user. The registration to Copyleaks takes a minute and is free of charge. [Signup](https://api.copyleaks.com/?register=true) and make sure to confirm your account.
19
+ ## 📚 Documentation
20
+ To learn more about how to use Copyleaks API please check out our [Documentation](https://docs.copyleaks.com/resources/sdks/ruby/).
21
21
 
22
- As a signed user you can generate your personal API key. Do so on your [dashboard home](https://api.copyleaks.com/dashboard) under 'API Access Credentials'.
22
+ ## 💡 Usage Examples
23
+ Here are some common usage examples for the Copyleaks SDK. You can also see a comprehensive code example in the `demo.rb` file on our GitHub repository: [demo.rb](https://github.com/Copyleaks/Ruby-Plagiarism-Checker/blob/master/demo/demo.rb).
23
24
 
24
- For more information check out our [API guide](https://api.copyleaks.com/documentation/v3).
25
+ ### Get Authentication Token
26
+ This example demonstrates how to log in to the Copyleaks API and obtain an authentication token.
25
27
 
26
- ## Usage
27
- ```rb
28
+ ```ruby
28
29
  require 'copyleaks'
29
- copyleaks = Copyleaks::API.new
30
- res = copyleaks.login(<your email>,<your api key>)
31
- puts res.to_json
30
+ require 'base64'
31
+
32
+ # --- Your Credentials ---
33
+ USER_EMAIL = 'YOUR_EMAIL_ADDRESS'
34
+ USER_API_KEY = 'YOUR_API_KEY'
35
+ WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'
36
+ # --------------------
37
+
38
+ begin
39
+ # Log in to the Copyleaks API
40
+ puts "Authenticating..."
41
+ copyleaks = Copyleaks::API.new
42
+ auth_token = copyleaks.login(USER_EMAIL, USER_API_KEY)
43
+ puts "✅ Logged in successfully!"
44
+
45
+ end
46
+ ```
47
+ For a detailed understanding of the authentication process, refer to the Copyleaks Login Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/account/login).
48
+ ##
49
+ ### Submit Text for Plagiarism Scan
50
+ This example shows how to prepare and submit raw text content for a plagiarism scan.
51
+
52
+ ```ruby
53
+ require 'copyleaks'
54
+ require 'base64'
55
+
56
+ # --- Your Credentials ---
57
+ USER_EMAIL = 'YOUR_EMAIL_ADDRESS'
58
+ USER_API_KEY = 'YOUR_API_KEY'
59
+ WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'
60
+ # --------------------
61
+
62
+ begin
63
+ scanId = DateTime.now.strftime('%Q').to_s
64
+ submisson = Copyleaks::CopyleaksFileSubmissionModel.new(
65
+ 'aGVsbG8gd29ybGQ=',
66
+ 'ruby.txt',
67
+ Copyleaks::SubmissionProperties.new(
68
+ Copyleaks::SubmissionWebhooks.new("#{WEBHOOK_URL}/url-webhook/scan/#{scanId}/{STATUS}","#{WEBHOOK_URL}/url-webhook/new-result"),
69
+ true,
70
+ 'developer_payloads_test',
71
+ true,
72
+ 60,
73
+ 1,
74
+ true,
75
+ Copyleaks::SubmissionActions::SCAN,
76
+ Copyleaks::SubmissionAuthor.new('Author_name'),
77
+ Copyleaks::SubmissionFilter.new(true, true, true),
78
+ Copyleaks::SubmissionScanning.new(true, nil, nil, Copyleaks::SubmissionScanningCopyleaksDB.new(true, true)),
79
+ Copyleaks::SubmissionIndexing.new([Copyleaks::SubmissionRepository.new('repo-1')]),
80
+ Copyleaks::SubmissionExclude.new(true, true, true, true, true),
81
+ Copyleaks::SubmissionPDF.new(true, 'pdf-title', BASE64_LOGO, false),
82
+ Copyleaks::SubmissionSensitiveData.new(false)
83
+ )
84
+ )
85
+
86
+ @copyleaks.submit_file(_authToken, scanId, submisson)
87
+
88
+ end
89
+ ```
90
+ For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/authenticity/detect-plagiarism-text)
91
+
92
+ For a detailed understanding of the plagiarism detection process, refer to the Copyleaks Submit Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/scans/submit-file)
93
+ ##
94
+ ### AI-Generated Text Detection
95
+ Use the AI detection client to determine if content was generated by artificial intelligence.
96
+
97
+ ```ruby
98
+ require 'copyleaks'
99
+ require 'base64'
100
+
101
+ # --- Your Credentials ---
102
+ USER_EMAIL = 'YOUR_EMAIL_ADDRESS'
103
+ USER_API_KEY = 'YOUR_API_KEY'
104
+ WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'
105
+ # --------------------
106
+
107
+ begin
108
+ scanId = DateTime.now.strftime('%Q').to_s
109
+ text = "Lions are social animals, living in groups called prides, typically consisting of several females, their offspring, and a few males. Female lions are the primary hunters, working together to catch prey. Lions are known for their strength, teamwork, and complex social structures."
110
+ submission = Copyleaks::NaturalLanguageSubmissionModel.new(
111
+ text,
112
+ )
113
+ submission.sandbox = true
114
+
115
+ res = @copyleaks.ai_detection_client.submit_natural_language(_authToken, scanId, submission)
116
+
117
+ end
32
118
  ```
33
- * (Option) To change the Identity server URI (default:"https://id.copyleaks.com"):
34
- ```rb
35
- Copyleaks::Config.identity_server_uri = "<your identity server uri>"
119
+ For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/ai-detector/ai-text-detection/)
120
+
121
+ For a detailed understanding of the Ai detection process, refer to the Copyleaks detect natural language Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writer-detector/check/)
122
+ ##
123
+ ### Writing Assistant
124
+ Get intelligent suggestions for improving grammar, spelling, style, and overall writing quality.
125
+
126
+ ```ruby
127
+ require 'copyleaks'
128
+ require 'base64'
129
+
130
+ # --- Your Credentials ---
131
+ USER_EMAIL = 'YOUR_EMAIL_ADDRESS'
132
+ USER_API_KEY = 'YOUR_API_KEY'
133
+ WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'
134
+ # --------------------
135
+
136
+ begin
137
+ text = "Lions are the only cat that live in groups, called pride. A prides typically consists of a few adult males, several feales, and their offspring. This social structure is essential for hunting and raising young cubs. Female lions, or lionesses are the primary hunters of the prid. They work together in cordinated groups to take down prey usually targeting large herbiores like zbras, wildebeest and buffalo. Their teamwork and strategy during hunts highlight the intelligence and coperation that are key to their survival."
138
+ scanId = DateTime.now.strftime('%Q').to_s
139
+ score_weights = Copyleaks::ScoreWeights.new(0.1, 0.2, 0.3, 0.4)
140
+ submission = Copyleaks::WritingAssistantSubmissionModel.new(
141
+ text,
142
+ )
143
+ submission.sandbox = true
144
+ submission.score = score_weights
145
+ res = @copyleaks.writing_assistant_client.submit_text(_authToken, scanId, submission)
146
+
147
+ end
36
148
  ```
37
- * (Option) To change the API server URI (default:"https://api.copyleaks.com"):
38
- ```rb
39
- Copyleaks::Config.api_server_uri = "<your api server uri>"
149
+ For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/writing/check-grammar/)
150
+
151
+ For a detailed understanding of the Writing assistant process, refer to the Copyleaks writing feedback Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writing-assistant/check/)
152
+ ##
153
+ ### Text Moderation
154
+ Scan and moderate text content for unsafe, inappropriate, or policy-violating material across various categories.
155
+
156
+ ```ruby
157
+ require 'copyleaks'
158
+ require 'base64'
159
+
160
+ # --- Your Credentials ---
161
+ USER_EMAIL = 'YOUR_EMAIL_ADDRESS'
162
+ USER_API_KEY = 'YOUR_API_KEY'
163
+ WEBHOOK_URL = 'https://your-server.com/webhook/{STATUS}'
164
+ # --------------------
165
+
166
+ begin
167
+ scanId = DateTime.now.strftime('%Q').to_s
168
+ text_moderation_request = Copyleaks::CopyleaksTextModerationRequestModel.new(
169
+ text: "This is some text to scan.",
170
+ sandbox: true,
171
+ language: "en",
172
+ labels: [
173
+ { id: "adult-v1" },
174
+ { id: "toxic-v1" },
175
+ { id: "violent-v1" },
176
+ { id: "profanity-v1" },
177
+ { id: "self-harm-v1" },
178
+ { id: "harassment-v1" },
179
+ { id: "hate-speech-v1" },
180
+ { id: "drugs-v1" },
181
+ { id: "firearms-v1" },
182
+ { id: "cybersecurity-v1" }
183
+ ]
184
+ )
185
+ res = @copyleaks.text_moderation_client.submit_text(_authToken, scanId, text_moderation_request)
186
+
187
+ textModerationResponse = Copyleaks::CopyleaksTextModerationResponseModel.new(
188
+ moderations: res['moderations'],
189
+ legend: res['legend'],
190
+ scanned_document: res['scannedDocument'])
191
+
192
+ end
40
193
  ```
194
+ For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/moderation/moderate-text/)
195
+
196
+ For a detailed understanding of the Text moderation process, refer to the Copyleaks text moderation Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/text-moderation/check/)
197
+ ##
198
+ ## Further Resources
199
+
200
+ * **Copyleaks API Dashboard:** Manage your API keys, monitor usage, and view analytics from your personalized dashboard. [Access Dashboard](https://api.copyleaks.com/dashboard)
201
+ * **Copyleaks SDK Documentation:** Explore comprehensive guides, API references, and code examples for seamless integration. [Read Documentation](https://docs.copyleaks.com/resources/sdks/overview/)
202
+
41
203
 
42
- ## Demo
43
- See [demo.rb](./demo/demo.rb) under demo folder for an example.
44
- ## Read More
45
- * [API Homepage](https://api.copyleaks.com/)
46
- * [API Documentation](https://api.copyleaks.com/documentation)
47
- * [Plagiarism Report](https://github.com/Copyleaks/plagiarism-report)
204
+ ## Support
205
+ * If you need assistance, please contact Copyleaks Support via our support portal: Contact Copyleaks [Support](https://help.copyleaks.com/s/contactsupport).
206
+ * To arrange a product demonstration, book a demo here: [Booking Link](https://copyleaks.com/book-a-demo).
@@ -21,7 +21,6 @@
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'
25
24
 
26
25
  module Copyleaks
27
26
  class AIDetectionClient
@@ -29,39 +28,6 @@ module Copyleaks
29
28
  @api_client = api_client
30
29
  end
31
30
 
32
- # Use Copyleaks AI Content Detection to differentiate between human source code and AI written source code.
33
- # * Exceptions:
34
- # * * CommandExceptions: Server reject the request. See response status code,
35
- # headers and content for more info.
36
- # * * UnderMaintenanceException: Copyleaks servers are unavailable for maintenance.
37
- # We recommend to implement exponential backoff algorithm as described here:
38
- # https://api.copyleaks.com/documentation/v3/exponential-backoff
39
- # @param [CopyleaksAuthToken] authToken Copyleaks authentication token
40
- # @param [String] scanId Attach your own scan Id
41
- # @param [SourceCodeSubmissionModel] submission document
42
- def submit_source_code(authToken, scanId, submission)
43
- raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
44
- if submission.nil? || !submission.instance_of?(Copyleaks::SourceCodeSubmissionModel)
45
- raise 'submission is Invalid, must be instance of type Copyleaks::SourceCodeSubmissionModel'
46
- end
47
-
48
- ClientUtils.verify_auth_token(authToken)
49
- Copyleaks::DeprecationService.show_deprecation_message
50
- path = "/v2/writer-detector/source-code/#{scanId}/check"
51
-
52
- headers = {
53
- 'Content-Type' => 'application/json',
54
- 'User-Agent' => Config.user_agent,
55
- 'Authorization' => "Bearer #{authToken.accessToken}"
56
- }
57
-
58
- request = Net::HTTP::Post.new(path, headers)
59
- request.body = submission.to_json
60
-
61
- ClientUtils.handle_response(@api_client.request(request), 'submit_source_code')
62
- end
63
-
64
-
65
31
  # Use Copyleaks AI Content Detection to differentiate between human texts and AI written texts.
66
32
  # * Exceptions:
67
33
  # * * CommandExceptions: Server reject the request. See response status code,
@@ -71,7 +37,7 @@ module Copyleaks
71
37
  # https://api.copyleaks.com/documentation/v3/exponential-backoff
72
38
  # @param [CopyleaksAuthToken] authToken Copyleaks authentication token
73
39
  # @param [String] scanId Attach your own scan Id
74
- # @param [SourceCodeSubmissionModel] submission document
40
+ # @param [NaturalLanguageSubmissionModel] submission document
75
41
  def submit_natural_language(authToken, scanId, submission)
76
42
  raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
77
43
  if submission.nil? || !submission.instance_of?(Copyleaks::NaturalLanguageSubmissionModel)
data/lib/copyleaks/api.rb CHANGED
@@ -27,7 +27,6 @@ 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'
31
30
  require_relative 'utils/copyleaks_client.utils'
32
31
 
33
32
  module Copyleaks
@@ -114,14 +113,6 @@ module Copyleaks
114
113
  end
115
114
 
116
115
  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
125
116
 
126
117
  path = "/v3/scans/submit/file/#{scanId}"
127
118
 
@@ -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 CopyleaksTextModerationConstants
26
+ # Provides a collection of constants representing different text moderation categories supported by the Copyleaks
27
+ # Text Moderation API.
28
+ ADULT_V1 = "adult-v1"
29
+ TOXIC_V1 = "toxic-v1"
30
+ VIOLENT_V1 = "violent-v1"
31
+ PROFANITY_V1 = "profanity-v1"
32
+ SELF_HARM_V1 = "self-harm-v1"
33
+ HARASSMENT_V1 = "harassment-v1"
34
+ HATE_SPEECH_V1 = "hate-speech-v1"
35
+ DRUGS_V1 = "drugs-v1"
36
+ FIREARMS_V1 = "firearms-v1"
37
+ CYBERSECURITY_V1 = "cybersecurity-v1"
38
+ end
39
+ end
@@ -21,35 +21,9 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
-
25
24
  module Copyleaks
26
- class SourceCodeSubmissionModel < AIDetectionSubmissionModel
27
- attr_accessor :filename
28
-
29
- # @param [String] A text string.
30
- # @param [String] The name of the file. Make sure to include the right extension for your file type.
31
- # @param [Boolean] Use sandbox mode to test your integration with the Copyleaks API for free.
32
- def initialize(text, filename, sandbox = false)
33
- unless text.instance_of?(String)
34
- raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
35
- end
36
- unless filename.instance_of?(String)
37
- raise 'Copyleaks::SourceCodeSubmissionModel - filename - filename must be of type String'
38
- end
39
- super(text, sandbox)
40
- @filename = filename
25
+ class CopyleaksTextModerationLanguages
26
+ # Supported languages for text moderation.
27
+ ENGLISH = "en"
41
28
  end
42
-
43
- def as_json(*_args)
44
- {
45
- text: @text,
46
- sandbox: @sandbox,
47
- filename: @filename
48
- }.select { |_k, v| !v.nil? }
49
- end
50
-
51
- def to_json(*options)
52
- as_json(*options).to_json(*options)
53
- end
54
- end
55
29
  end
@@ -22,7 +22,8 @@
22
22
  # SOFTWARE.
23
23
  # =
24
24
 
25
- require_relative 'supportedFilesTypes.rb'
25
+ require_relative 'CopyleaksTextModerationConstants.rb'
26
+ require_relative 'CopyleaksTextModerationLanguages.rb'
26
27
 
27
28
  module Copyleaks
28
29
  end
@@ -32,6 +32,7 @@ require_relative 'delete_request_model.rb'
32
32
  require_relative 'start_request_model.rb'
33
33
 
34
34
  require_relative 'textModeration/requests/CopyleaksTextModerationRequestModel.rb'
35
+ require_relative 'textModeration/requests/CopyleaksTextModerationLabel.rb'
35
36
  require_relative 'textModeration/responses/submodules/ModerationsModel.rb'
36
37
  require_relative 'textModeration/responses/submodules/Text.rb'
37
38
  require_relative 'textModeration/responses/submodules/TextModerationChars.rb'
@@ -30,7 +30,6 @@ require_relative 'url_submission_model.rb'
30
30
 
31
31
  require_relative 'ai_detection/ai_detection_submission_model.rb'
32
32
  require_relative 'ai_detection/natural_language_submission_model.rb'
33
- require_relative 'ai_detection/source_code_submission_model.rb'
34
33
  require_relative 'Webhooks/index.rb'
35
34
 
36
35
  require_relative 'writing_assistant/score_weights.rb'
@@ -32,7 +32,7 @@ module Copyleaks
32
32
  # @param [ScoreWeights] an object containing the score weights for different writing aspects (e.g., grammar, mechanics). Optional.
33
33
  def initialize(text, sandbox = false, language = nil, score = nil)
34
34
  unless text.instance_of?(String)
35
- raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String'
35
+ raise 'Copyleaks::WritingAssistantSubmissionModel - text - text must be of type String'
36
36
  end
37
37
  @text = text
38
38
  @sandbox = sandbox
@@ -21,19 +21,25 @@
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 'json'
24
25
  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"
26
+
27
+ class CopyleaksTextModerationLabel
28
+ attr_reader :id
29
+
30
+ def initialize(id)
31
+ @id = id
32
+ end
33
+
34
+ # Convert to JSON with "id" key
35
+ def to_json(*_args)
36
+ { 'id' => @id }.to_json
37
+ end
38
+
39
+ # Build from a JSON string or a hash
40
+ def self.from_json(json)
41
+ data = json.is_a?(String) ? JSON.parse(json) : json
42
+ new(data['id'] || data[:id])
37
43
  end
38
44
  end
39
45
  end
@@ -1,3 +1,26 @@
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
+ # =
1
24
  require 'json'
2
25
 
3
26
  module Copyleaks
@@ -1,3 +1,3 @@
1
1
  module Copyleaks
2
- VERSION = '3.7.0'
2
+ VERSION = '4.0.0'
3
3
  end
@@ -57,7 +57,7 @@ module Copyleaks
57
57
  # https://api.copyleaks.com/documentation/v3/exponential-backoff
58
58
  # @param [CopyleaksAuthToken] authToken Copyleaks authentication token
59
59
  # @param [String] scanId Attach your own scan Id
60
- # @param [SourceCodeSubmissionModel] submission document
60
+ # @param [WritingAssistantSubmissionModel] submission document
61
61
  def submit_text(authToken, scanId, submission)
62
62
  raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
63
63
  raise 'submission is invalid, must be an instance of WritingAssistantSubmissionModel' if submission.nil? || !submission.instance_of?(Copyleaks::WritingAssistantSubmissionModel)
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.7.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Copyleaks ltd
@@ -32,10 +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
36
35
  - lib/copyleaks/models/auth_token.rb
36
+ - lib/copyleaks/models/constants/CopyleaksTextModerationConstants.rb
37
+ - lib/copyleaks/models/constants/CopyleaksTextModerationLanguages.rb
37
38
  - lib/copyleaks/models/constants/index.rb
38
- - lib/copyleaks/models/constants/supportedFilesTypes.rb
39
39
  - lib/copyleaks/models/delete_request_model.rb
40
40
  - lib/copyleaks/models/exceptions/auth_expired_exception.rb
41
41
  - lib/copyleaks/models/exceptions/command_exception.rb
@@ -52,7 +52,6 @@ files:
52
52
  - lib/copyleaks/models/start_request_model.rb
53
53
  - lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb
54
54
  - lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb
55
- - lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb
56
55
  - lib/copyleaks/models/submissions/file_ocr_submission_model.rb
57
56
  - lib/copyleaks/models/submissions/file_submission_model.rb
58
57
  - lib/copyleaks/models/submissions/index.rb
@@ -114,6 +113,7 @@ files:
114
113
  - lib/copyleaks/models/submissions/webhooks/index.rb
115
114
  - lib/copyleaks/models/submissions/writing_assistant/score_weights.rb
116
115
  - lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb
116
+ - lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationLabel.rb
117
117
  - lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationRequestModel.rb
118
118
  - lib/copyleaks/models/textModeration/responses/CopyleaksTextModerationResponseModel.rb
119
119
  - lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb
@@ -1,31 +0,0 @@
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