plagiarism-checker 3.5.0 → 3.6.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 +0 -0
- data/lib/copyleaks/api.rb +5 -0
- 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_expired_exception.rb +0 -0
- data/lib/copyleaks/models/exceptions/command_exception.rb +0 -0
- data/lib/copyleaks/models/exceptions/index.rb +0 -0
- data/lib/copyleaks/models/exceptions/rate_limit_exception.rb +0 -0
- data/lib/copyleaks/models/exceptions/under_maintenance_exception.rb +0 -0
- 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 +8 -0
- data/lib/copyleaks/models/start_request_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/ai_detection_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/natural_language_submission_model.rb +0 -0
- data/lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb +0 -0
- 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 +0 -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 +0 -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 +0 -0
- data/lib/copyleaks/models/submissions/properties/webhooks.rb +0 -0
- data/lib/copyleaks/models/submissions/properties/writing_feedback.rb +0 -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 +0 -0
- data/lib/copyleaks/models/submissions/webhooks/CreditsCheckedWebhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/ErrorWebhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/ExportCompletedWebhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Metadata.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/StatusWebhook.rb +1 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/BaseModels/Webhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ErrorModels/Error.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ExportModels/Task.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsRepositories.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/NotificationsModels/Alerts.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Batch.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Internet.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Repositories.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Score.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Tags.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/IndexedWebhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/NewResultWebhook.rb +0 -0
- data/lib/copyleaks/models/submissions/webhooks/index.rb +0 -0
- data/lib/copyleaks/models/submissions/writing_assistant/score_weights.rb +0 -0
- data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb +0 -0
- data/lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationRequestModel.rb +43 -0
- data/lib/copyleaks/models/textModeration/responses/CopyleaksTextModerationResponseModel.rb +36 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb +26 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/Text.rb +26 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationChars.rb +35 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationScannedDocument.rb +47 -0
- data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationsLegend.rb +29 -0
- data/lib/copyleaks/text_moderation_client.rb +51 -0
- data/lib/copyleaks/utils/copyleaks_client.utils.rb +0 -0
- data/lib/copyleaks/utils/status-code.utils.rb +0 -0
- data/lib/copyleaks/version.rb +1 -1
- data/lib/copyleaks/writing_assistant_client.rb +0 -0
- data/lib/copyleaks.rb +0 -0
- data/lib/index.rb +0 -0
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9cd9aec0f8d28efc51f64f0ad3f5ac700d6216b757f2f128589b8fffee7e04
|
4
|
+
data.tar.gz: f3cb8a6819a44a77f58d6db5a0b7e0ee846bb9f9c5f092db5641cd81b5b1edd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 469bb11f779b9191ec6bbfb41143f87edcf2782ed41de3cb2d697a3696e6da911395b2acb1b24004eae2ea70f5a4dd4c7252d47750e110af6f71e449b6244fa8
|
7
|
+
data.tar.gz: 3d9cb0523ac8aac51248046ba8b2a0f642173b8965c1dfe7afb7c2105a452fda03a36c245b6ebf9e48e6eba1e8b0b44d39fa17ae5c36ac0acd436f397395c0d6
|
data/.gitignore
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
File without changes
|
data/lib/copyleaks/api.rb
CHANGED
@@ -26,6 +26,7 @@ require 'json'
|
|
26
26
|
require 'date'
|
27
27
|
require_relative 'ai_detection_client.rb'
|
28
28
|
require_relative 'writing_assistant_client.rb'
|
29
|
+
require_relative 'text_moderation_client.rb'
|
29
30
|
require_relative 'utils/copyleaks_client.utils'
|
30
31
|
|
31
32
|
module Copyleaks
|
@@ -43,6 +44,7 @@ module Copyleaks
|
|
43
44
|
# Initialize clients
|
44
45
|
@ai_detection_client = AIDetectionClient.new(@api_client)
|
45
46
|
@writing_assistant_client = WritingAssistantClient.new(@api_client)
|
47
|
+
@text_moderation_client = TextModerationClient.new(@api_client)
|
46
48
|
end
|
47
49
|
|
48
50
|
# Login to Copyleaks authentication server.
|
@@ -456,5 +458,8 @@ module Copyleaks
|
|
456
458
|
def writing_assistant_client
|
457
459
|
@writing_assistant_client
|
458
460
|
end
|
461
|
+
def text_moderation_client
|
462
|
+
@text_moderation_client
|
463
|
+
end
|
459
464
|
end
|
460
465
|
end
|
data/lib/copyleaks/app.config.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -31,5 +31,13 @@ require_relative 'id_object.rb'
|
|
31
31
|
require_relative 'delete_request_model.rb'
|
32
32
|
require_relative 'start_request_model.rb'
|
33
33
|
|
34
|
+
require_relative 'textModeration/requests/CopyleaksTextModerationRequestModel.rb'
|
35
|
+
require_relative 'textModeration/responses/submodules/ModerationsModel.rb'
|
36
|
+
require_relative 'textModeration/responses/submodules/Text.rb'
|
37
|
+
require_relative 'textModeration/responses/submodules/TextModerationChars.rb'
|
38
|
+
require_relative 'textModeration/responses/submodules/TextModerationScannedDocument.rb'
|
39
|
+
require_relative 'textModeration/responses/submodules/TextModerationsLegend.rb'
|
40
|
+
require_relative 'textModeration/responses/CopyleaksTextModerationResponseModel.rb'
|
41
|
+
|
34
42
|
module Copyleaks
|
35
43
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Notifications.rb
CHANGED
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/ScannedDocument.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb
CHANGED
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultsInternet.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/RepositoryMetadata.rb
CHANGED
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/SharedResultsModel.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb
CHANGED
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Copyleaks
|
4
|
+
class CopyleaksTextModerationRequestModel
|
5
|
+
attr_accessor :text, :sandbox, :language, :labels
|
6
|
+
|
7
|
+
# @param text [String] Text to produce Text Moderation report for.
|
8
|
+
# @param sandbox [Boolean] Use sandbox mode to test your integration. Default: false.
|
9
|
+
# @param language [String, nil] The language code. Optional; set to nil for auto-detect.
|
10
|
+
# @param labels [Array<Object>] A list of label configurations (min 1, max 32 elements).
|
11
|
+
def initialize(text: '', sandbox: false, language: nil, labels: [])
|
12
|
+
|
13
|
+
@text = text
|
14
|
+
@sandbox = sandbox
|
15
|
+
@language = language
|
16
|
+
@labels = labels
|
17
|
+
|
18
|
+
raise ArgumentError, "String cannot be blank" if @text.nil?
|
19
|
+
raise ArgumentError, "Labels must be a non-empty array." unless labels.is_a?(Array) && !labels.empty?
|
20
|
+
raise ArgumentError, "Labels cannot have more than 32 elements." if labels.length > 32
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_json(options = {})
|
25
|
+
{
|
26
|
+
text: @text,
|
27
|
+
sandbox: @sandbox,
|
28
|
+
language: @language,
|
29
|
+
labels: @labels
|
30
|
+
}.to_json(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.from_json(json_string)
|
34
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
35
|
+
new(
|
36
|
+
text: data[:text],
|
37
|
+
sandbox: data[:sandbox],
|
38
|
+
language: data[:language],
|
39
|
+
labels: data[:labels]
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Copyleaks
|
3
|
+
|
4
|
+
class CopyleaksTextModerationResponseModel
|
5
|
+
attr_accessor :moderations, :legend, :scanned_document
|
6
|
+
|
7
|
+
# @param moderations [ModerationsModel] Moderated text segments detected in the input text.
|
8
|
+
# @param legend [Array<TextModerationsLegend>] An array that provides a lookup for the labels referenced by their numerical indices in the `text.chars.labels` array. Each object within this legend array defines a specific label that was used in the scan.
|
9
|
+
# @param scanned_document [TextModerationScannedDocument] General information about the scanned document.
|
10
|
+
def initialize(moderations: ModerationsModel.new, legend: [], scanned_document: TextModerationScannedDocument.new, **_ignored)
|
11
|
+
@moderations = moderations
|
12
|
+
@legend = legend
|
13
|
+
@scanned_document = scanned_document
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def to_json(options = {})
|
18
|
+
{
|
19
|
+
moderations: @moderations ? JSON.parse(@moderations.to_json) : nil,
|
20
|
+
legend: @legend.map(&:to_json).map { |l| JSON.parse(l) },
|
21
|
+
scannedDocument: @scanned_document ? JSON.parse(@scanned_document.to_json) : nil
|
22
|
+
}.to_json(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def self.from_json(json_string)
|
27
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
28
|
+
new(
|
29
|
+
moderations: data[:moderations] ? ModerationsModel.from_json(data[:moderations].to_json) : nil,
|
30
|
+
legend: data[:legend].map { |l| TextModerationsLegend.from_json(l.to_json) },
|
31
|
+
scanned_document: data[:scannedDocument] ? TextModerationScannedDocument.from_json(data[:scannedDocument].to_json) : nil
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Copyleaks
|
3
|
+
|
4
|
+
class ModerationsModel
|
5
|
+
attr_accessor :text
|
6
|
+
|
7
|
+
# @param text [Text] Moderated text segments corresponding to the submitted text. Each position in the inner arrays corresponds to a single segment in the textual version.
|
8
|
+
def initialize(text: Text.new)
|
9
|
+
@text = text
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_json(options = {})
|
13
|
+
{
|
14
|
+
text: @text ? JSON.parse(@text.to_json) : nil
|
15
|
+
}.to_json(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def self.from_json(json_string)
|
20
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
21
|
+
new(
|
22
|
+
text: data[:text] ? Text.from_json(data[:text].to_json) : nil
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Copyleaks
|
4
|
+
class Text
|
5
|
+
attr_accessor :chars
|
6
|
+
|
7
|
+
# @param chars [TextModerationChars] An object that groups together several arrays detailing the properties of labelled segments.
|
8
|
+
def initialize(chars: TextModerationChars.new)
|
9
|
+
@chars = chars
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_json(options = {})
|
13
|
+
{
|
14
|
+
chars: @chars ? JSON.parse(@chars.to_json) : nil
|
15
|
+
}.to_json(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def self.from_json(json_string)
|
20
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
21
|
+
new(
|
22
|
+
chars: data[:chars] ? TextModerationChars.from_json(data[:chars].to_json) : nil
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Copyleaks
|
3
|
+
|
4
|
+
class TextModerationChars
|
5
|
+
attr_accessor :labels, :starts, :lengths
|
6
|
+
|
7
|
+
# @param starts [Array<Integer>] Start character position of the labelled segment.
|
8
|
+
# @param labels [Array<Integer>] Predicted label index for the corresponding segment. The index can be resolved to its ID using the supplied legend.
|
9
|
+
# @param lengths [Array<Integer>] Labelled segment character length.
|
10
|
+
def initialize( starts: [],labels: [], lengths: [])
|
11
|
+
@starts = starts
|
12
|
+
@labels = labels
|
13
|
+
@lengths = lengths
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def to_json(options = {})
|
18
|
+
{
|
19
|
+
labels: @labels,
|
20
|
+
starts: @starts,
|
21
|
+
lengths: @lengths
|
22
|
+
}.to_json(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.from_json(json_string)
|
26
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
27
|
+
new(
|
28
|
+
labels: data[:labels],
|
29
|
+
starts: data[:starts],
|
30
|
+
lengths: data[:lengths]
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/copyleaks/models/textModeration/responses/submodules/TextModerationScannedDocument.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'date'
|
3
|
+
module Copyleaks
|
4
|
+
|
5
|
+
class TextModerationScannedDocument
|
6
|
+
attr_accessor :scan_id, :total_words, :total_excluded, :actual_credits, :expected_credits, :creation_time
|
7
|
+
|
8
|
+
# @param scan_id [String] The scan id given by the user.
|
9
|
+
# @param total_words [Integer] Total number of words found in the scanned text.
|
10
|
+
# @param total_excluded [Integer] Total excluded words from the text.
|
11
|
+
# @param actual_credits [Integer] The cost of credits for this scan.
|
12
|
+
# @param expected_credits [Integer] The amount of credits that was expected to be spent on the scan.
|
13
|
+
# @param creation_time [Time] Creation time of the scan.
|
14
|
+
def initialize(scan_id: '', total_words: 0, total_excluded: 0, actual_credits: 0, expected_credits: 0, creation_time: Time.utc.now)
|
15
|
+
@scan_id = scan_id
|
16
|
+
@total_words = total_words
|
17
|
+
@total_excluded = total_excluded
|
18
|
+
@actual_credits = actual_credits
|
19
|
+
@expected_credits = expected_credits
|
20
|
+
@creation_time = creation_time
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def to_json(options = {})
|
25
|
+
{
|
26
|
+
scanId: @scan_id,
|
27
|
+
totalWords: @total_words,
|
28
|
+
totalExcluded: @total_excluded,
|
29
|
+
actualCredits: @actual_credits,
|
30
|
+
expectedCredits: @expected_credits,
|
31
|
+
creationTime: @creation_time.iso8601
|
32
|
+
}.to_json(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from_json(json_string)
|
36
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
37
|
+
new(
|
38
|
+
scan_id: data[:scanId],
|
39
|
+
total_words: data[:totalWords],
|
40
|
+
total_excluded: data[:totalExcluded],
|
41
|
+
actual_credits: data[:actualCredits],
|
42
|
+
expected_credits: data[:expectedCredits],
|
43
|
+
creation_time: Time.parse(data[:creationTime])
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Copyleaks
|
3
|
+
|
4
|
+
class TextModerationsLegend
|
5
|
+
attr_accessor :index, :id
|
6
|
+
|
7
|
+
# @param index [integer] The numerical index of the label.
|
8
|
+
# @param id [string] A unique string identifier for the label. This ID serves as a machine-readable way to identify the label type.
|
9
|
+
def initialize(index: 0, id: '')
|
10
|
+
@index = index
|
11
|
+
@id = id
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_json(options = {})
|
15
|
+
{
|
16
|
+
index: @index,
|
17
|
+
id: @id
|
18
|
+
}.to_json(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.from_json(json_string)
|
22
|
+
data = JSON.parse(json_string, symbolize_names: true)
|
23
|
+
new(
|
24
|
+
index: data[:index],
|
25
|
+
id: data[:id]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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 TextModerationClient
|
27
|
+
def initialize(api_client)
|
28
|
+
@api_client = api_client
|
29
|
+
end
|
30
|
+
|
31
|
+
def submit_text(authToken, scanId, submission)
|
32
|
+
raise 'scanId is Invalid, must be instance of String' if scanId.nil? || !scanId.instance_of?(String)
|
33
|
+
raise 'submission is invalid, must be an instance of CopyleaksTextModerationRequestModel' if submission.nil? || !submission.instance_of?(Copyleaks::CopyleaksTextModerationRequestModel)
|
34
|
+
|
35
|
+
ClientUtils.verify_auth_token(authToken)
|
36
|
+
|
37
|
+
path = "/v1/text-moderation/#{scanId}/check"
|
38
|
+
|
39
|
+
headers = {
|
40
|
+
'Content-Type' => 'application/json',
|
41
|
+
'User-Agent' => Config.user_agent,
|
42
|
+
'Authorization' => "Bearer #{authToken.accessToken}"
|
43
|
+
}
|
44
|
+
|
45
|
+
request = Net::HTTP::Post.new(path, headers)
|
46
|
+
request.body = submission.to_json
|
47
|
+
|
48
|
+
ClientUtils.handle_response(@api_client.request(request), 'submit_text_moderation')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
File without changes
|
File without changes
|
data/lib/copyleaks/version.rb
CHANGED
File without changes
|
data/lib/copyleaks.rb
CHANGED
File without changes
|
data/lib/index.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plagiarism-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Copyleaks ltd
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: Copyleaks detects plagiarism and checks content distribution online.
|
14
13
|
Use Copyleaks to find out if textual content is original and if it has been used
|
@@ -112,6 +111,14 @@ files:
|
|
112
111
|
- lib/copyleaks/models/submissions/webhooks/index.rb
|
113
112
|
- lib/copyleaks/models/submissions/writing_assistant/score_weights.rb
|
114
113
|
- lib/copyleaks/models/submissions/writing_assistant/writing_assistant_submission_model.rb
|
114
|
+
- lib/copyleaks/models/textModeration/requests/CopyleaksTextModerationRequestModel.rb
|
115
|
+
- lib/copyleaks/models/textModeration/responses/CopyleaksTextModerationResponseModel.rb
|
116
|
+
- lib/copyleaks/models/textModeration/responses/submodules/ModerationsModel.rb
|
117
|
+
- lib/copyleaks/models/textModeration/responses/submodules/Text.rb
|
118
|
+
- lib/copyleaks/models/textModeration/responses/submodules/TextModerationChars.rb
|
119
|
+
- lib/copyleaks/models/textModeration/responses/submodules/TextModerationScannedDocument.rb
|
120
|
+
- lib/copyleaks/models/textModeration/responses/submodules/TextModerationsLegend.rb
|
121
|
+
- lib/copyleaks/text_moderation_client.rb
|
115
122
|
- lib/copyleaks/utils/copyleaks_client.utils.rb
|
116
123
|
- lib/copyleaks/utils/status-code.utils.rb
|
117
124
|
- lib/copyleaks/version.rb
|
@@ -124,7 +131,6 @@ metadata:
|
|
124
131
|
homepage_uri: https://api.copyleaks.com
|
125
132
|
source_code_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker
|
126
133
|
changelog_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases
|
127
|
-
post_install_message:
|
128
134
|
rdoc_options: []
|
129
135
|
require_paths:
|
130
136
|
- lib
|
@@ -139,9 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
145
|
- !ruby/object:Gem::Version
|
140
146
|
version: '0'
|
141
147
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.7.6
|
144
|
-
signing_key:
|
148
|
+
rubygems_version: 3.6.7
|
145
149
|
specification_version: 4
|
146
150
|
summary: Detects plagiarism and checks content distribution online.
|
147
151
|
test_files: []
|