plagiarism-checker 3.1.0 → 3.1.2

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: e35843d2ef1d9d926ebcb7a799689e567dc91662cbbbe7a996345f342f9f4694
4
- data.tar.gz: b65e0d03a2c7c930a3fd26d11f50e834d6856b42062013e0a2882cc04162fb0f
3
+ metadata.gz: e947c529be01e971d5887175ba1dcf763a48de09c9ab732759d555c2311b07d5
4
+ data.tar.gz: ec0ef3fe06953dc9e2e213fd9c26434833c006b6facd49fa94edeec63d88962f
5
5
  SHA512:
6
- metadata.gz: e977e23ca5fc86194031ce6dcaf4bcf5007a6421f234615875c552fd71556fb2889f11543802a050f2566fdcfe6ce29a6229150adc4ac1d135b2fdf499a320c1
7
- data.tar.gz: b0886f96f27a487cccf67886e7bbcb4761134eb700c2811f245b461073b026fdd065a5e45a8ba8265a8a73ccf6d33af8ce23da20f2e2a2376b547db1aae01648
6
+ metadata.gz: de8559653ead6ea1ea1160f29dd5ba10426a7d4fb16729c170bd32157e78ec8168f1711b93e94a910c52a41b5bf9eba1f95d905a3b762efcb9806f0db7bce3bb
7
+ data.tar.gz: 20fefac0dd0751da77c1e9568f4ee6458f1caabc3a8b974b3e8918c9940e698107347669a20a518e2f1ee31944f3b6499e5043b3897caf1c2889e679c9817b1c
@@ -21,12 +21,11 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
25
24
 
26
- require 'auth_exipred_exception'
27
- require 'command_exception'
28
- require 'rate_limit_exception'
29
- require 'under_maintenance_exception'
25
+ require_relative 'auth_exipred_exception.rb'
26
+ require_relative 'command_exception.rb'
27
+ require_relative 'rate_limit_exception.rb'
28
+ require_relative 'under_maintenance_exception.rb'
30
29
 
31
30
  module Copyleaks
32
31
  end
@@ -23,19 +23,24 @@
23
23
  # =
24
24
  module Copyleaks
25
25
  class CopyleaksExportModel
26
- attr_reader :completionWebhook, :results, :crawledVersion, :pdfReport, :maxRetries, :developerPayload
26
+ attr_reader :completionWebhook, :completionWebhookHeaders, :results, :crawledVersion, :pdfReport, :maxRetries, :developerPayload
27
27
 
28
28
  # @param [String] completionWebhook This webhook event is triggered once the export is completed.
29
29
  # @param [ExportResults[]] results An array of results to be exported. The equivalent of downloading results manually.
30
30
  # @param [ExportCrawledVersion crawledVersion Download the crawled version of the submitted text. The equivalent of downloading crawled version manually.
31
- # @param [ExportPdfReport] pdfReport Download the PDF report. Allowed only when `properties.pdf.create` was set to true on the scan submittion.
31
+ # @param [ExportPdfReport] pdfReport Download the PDF report. Allowed only when `properties.pdf.create` was set to true on the scan submission.
32
32
  # @param [Integer] maxRetries How many retries to send before giving up. Using high value (12) may lead to a longer time until the completionWebhook being executed. A low value (1) may lead to errors while your service is temporary having problems.
33
33
  # @param [String] developerPayload Add a custom developer payload that will then be provided on the Export-Completed webhook. https://api.copyleaks.com/documentation/v3/webhooks/export-completed
34
- def initialize(completionWebhook, results, crawledVersion, pdfReport = nil, maxRetries = nil, developerPayload = nil)
34
+ # @param [Array] completionWebhookHeaders Adds headers to the completion webhook.
35
+ def initialize(completionWebhook, results, crawledVersion, pdfReport = nil, maxRetries = nil, developerPayload = nil, completionWebhookHeaders = nil)
35
36
  unless completionWebhook.instance_of?(String)
36
37
  raise 'Copyleaks::CopyleaksExportModel - completionWebhook - completionWebhook must be of type String'
37
38
  end
38
39
 
40
+ unless header_format_valid?(completionWebhookHeaders)
41
+ raise 'Copyleaks::CopyleaksExportModel - completionWebhookHeaders - completionWebhookHeaders must be an Array of String Array pairs'
42
+ end
43
+
39
44
  results.each do |item|
40
45
  unless item.instance_of?(ExportResults)
41
46
  raise 'Copyleaks::CopyleaksExportModel - results - entity must be of type Copyleaks::ExportResults'
@@ -59,6 +64,7 @@ module Copyleaks
59
64
  end
60
65
 
61
66
  @completionWebhook = completionWebhook
67
+ @completionWebhookHeaders = completionWebhookHeaders
62
68
  @results = results
63
69
  @crawledVersion = crawledVersion
64
70
  @pdfReport = pdfReport
@@ -69,6 +75,7 @@ module Copyleaks
69
75
  def as_json(*_args)
70
76
  {
71
77
  completionWebhook: @completionWebhook,
78
+ completionWebhookHeaders: @completionWebhookHeaders,
72
79
  results: @results,
73
80
  crawledVersion: @crawledVersion,
74
81
  pdfReport: @pdfReport,
@@ -80,5 +87,16 @@ module Copyleaks
80
87
  def to_json(*options)
81
88
  as_json(*options).to_json(*options)
82
89
  end
90
+
91
+ private
92
+
93
+ def header_format_valid?(header)
94
+ return true if header.nil?
95
+ return false unless header.instance_of?(Array)
96
+
97
+ header.all? do |pair|
98
+ pair.instance_of?(Array) && pair.length == 2 && pair[0].instance_of?(String) && pair[1].instance_of?(String)
99
+ end
100
+ end
83
101
  end
84
102
  end
@@ -21,12 +21,11 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
25
24
 
26
- require 'export_model'
27
- require 'export_crawled_version'
28
- require 'export_pdf_report'
29
- require 'export_results'
25
+ require_relative 'export_model.rb'
26
+ require_relative 'export_crawled_version.rb'
27
+ require_relative 'export_pdf_report.rb'
28
+ require_relative 'export_results.rb'
30
29
 
31
30
  module Copyleaks
32
31
  end
@@ -21,15 +21,15 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
25
- require 'exceptions/index'
26
- require 'exports/index'
27
- require 'submissions/index'
28
- require 'auth_token'
29
24
 
30
- require 'id_object'
31
- require 'delete_request_model'
32
- require 'start_request_model'
25
+ require_relative 'exceptions/index.rb'
26
+ require_relative 'exports/index.rb'
27
+ require_relative 'submissions/index.rb'
28
+ require_relative 'auth_token.rb'
29
+
30
+ require_relative 'id_object.rb'
31
+ require_relative 'delete_request_model.rb'
32
+ require_relative 'start_request_model.rb'
33
33
 
34
34
  module Copyleaks
35
35
  end
@@ -21,13 +21,12 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
  # =
24
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
25
- require 'properties/index'
24
+ require_relative 'properties/index.rb'
26
25
 
27
- require 'submission_model'
28
- require 'file_submission_model'
29
- require 'file_ocr_submission_model'
30
- require 'url_submission_model'
26
+ require_relative 'submission_model.rb'
27
+ require_relative 'file_submission_model.rb'
28
+ require_relative 'file_ocr_submission_model.rb'
29
+ require_relative 'url_submission_model.rb'
31
30
 
32
31
  module Copyleaks
33
32
  end
@@ -21,25 +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
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
25
24
 
26
- require 'submission_properties'
25
+ require_relative 'submission_properties.rb'
27
26
 
28
- require 'actions'
29
- require 'author'
30
- require 'copyleaks_db'
31
- require 'domains_mode'
32
- require 'exclude'
33
- require 'filter'
34
- require 'indexing'
35
- require 'pdf_properties'
36
- require 'repository'
37
- require 'scanning'
38
- require 'scanning_exclude'
39
- require 'scanning_repository'
40
- require 'sensitive_data_protection'
41
- require 'submission_properties'
42
- require 'webhooks'
27
+ require_relative 'actions.rb'
28
+ require_relative 'author.rb'
29
+ require_relative 'copyleaks_db.rb'
30
+ require_relative 'domains_mode.rb'
31
+ require_relative 'exclude.rb'
32
+ require_relative 'filter.rb'
33
+ require_relative 'scan_method_algorithm.rb'
34
+ require_relative 'indexing.rb'
35
+ require_relative 'pdf_properties.rb'
36
+ require_relative 'repository.rb'
37
+ require_relative 'scanning.rb'
38
+ require_relative 'scanning_exclude.rb'
39
+ require_relative 'scanning_repository.rb'
40
+ require_relative 'sensitive_data_protection.rb'
41
+ require_relative 'submission_properties.rb'
42
+ require_relative 'webhooks.rb'
43
43
 
44
44
  module Copyleaks
45
45
  end
@@ -0,0 +1,31 @@
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 SubmissionScanMethodAlgorithm
26
+ # prioritize higher similarity
27
+ MAXIMUM_COVERAGE = 0
28
+ # prioritize finding more sources.
29
+ MAXIMUM_RESULTS = 1
30
+ end
31
+ end
@@ -23,9 +23,9 @@
23
23
  # =
24
24
  module Copyleaks
25
25
  class SubmissionScanningRepository < SubmissionRepository
26
- # @param [String] Id of a repository to add the scanned document to.
27
- # @param [Boolean] includeMySubmissions Compare the scanned document against MY submittions in the repository.
28
- # @param [Boolean] includeOthersSubmissions Compare the scanned document against OTHER users submittions in the repository.
26
+ # @param [String] ID of a repository to add the scanned document to.
27
+ # @param [Boolean] includeMySubmissions Compare the scanned document against MY submissions in the repository.
28
+ # @param [Boolean] includeOthersSubmissions Compare the scanned document against OTHER users submissions in the repository.
29
29
  def initialize(id, includeMySubmissions, includeOthersSubmissions)
30
30
  super(id)
31
31
  @includeMySubmissions = includeMySubmissions
@@ -24,7 +24,7 @@
24
24
  module Copyleaks
25
25
  class SubmissionProperties
26
26
  attr_reader :webhooks, :includeHtml, :developerPayload, :sandbox, :expiration, :sensitivityLevel, :cheatDetection,
27
- :action, :author, :filters, :scanning, :indexing, :exclude, :pdf, :sensitiveDataProtection
27
+ :action, :author, :filters, :scanning, :indexing, :exclude, :pdf, :sensitiveDataProtection, :scanMethodAlgorithm
28
28
 
29
29
  # @param [SubmissionWebhooks] webhooks - Check inner properties for more details.
30
30
  # @param [Boolean] includeHtml - By default, Copyleaks will present the report in text format. If set to true, Copyleaks will also include html format.
@@ -41,10 +41,11 @@ module Copyleaks
41
41
  # @param [SubmissionExclude] exclude - Check inner properties for more details.
42
42
  # @param [SubmissionPDF] pdf - Check inner properties for more details.
43
43
  # @param [SubmissionSensitiveData] sensitiveDataProtection - Check inner properties for more details.
44
+ # @param [SubmissionScanMethodAlgorithm] scanMethodAlgorithm - Check inner properties for more details.
44
45
  def initialize(
45
46
  webhooks, includeHtml = nil, developerPayload = nil, sandbox = nil, expiration = nil,
46
47
  sensitivityLevel = nil, cheatDetection = nil, action = nil, author = nil, filters = nil,
47
- scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil
48
+ scanning = nil, indexing = nil, exclude = nil, pdf = nil, sensitiveDataProtection = nil, scanMethodAlgorithm = nil
48
49
  )
49
50
  unless webhooks.instance_of?(SubmissionWebhooks)
50
51
  raise 'Copyleaks::SubmissionProperties - webhooks - webhooks must be of type SubmissionWebhooks'
@@ -91,6 +92,9 @@ module Copyleaks
91
92
  if !sensitiveDataProtection.nil? && !sensitiveDataProtection.instance_of?(SubmissionSensitiveData)
92
93
  raise 'Copyleaks::SubmissionProperties - sensitiveDataProtection - sensitiveDataProtection must be of type SubmissionSensitiveData'
93
94
  end
95
+ if !scanMethodAlgorithm.nil? && ![0, 1].include?(scanMethodAlgorithm)
96
+ raise 'Copyleaks::SubmissionProperties - scanMethodAlgorithm - action must be of type SubmissionScanMethodAlgorithm consts'
97
+ end
94
98
 
95
99
  @webhooks = webhooks
96
100
  @includeHtml = includeHtml
@@ -107,6 +111,7 @@ module Copyleaks
107
111
  @exclude = exclude
108
112
  @pdf = pdf
109
113
  @sensitiveDataProtection = sensitiveDataProtection
114
+ @scanMethodAlgorithm = scanMethodAlgorithm
110
115
  end
111
116
 
112
117
  def as_json(*_args)
@@ -125,7 +130,8 @@ module Copyleaks
125
130
  indexing: @indexing,
126
131
  exclude: @exclude,
127
132
  pdf: @pdf,
128
- sensitiveDataProtection: @sensitiveDataProtection
133
+ sensitiveDataProtection: @sensitiveDataProtection,
134
+ scanMethodAlgorithm: @scanMethodAlgorithm
129
135
  }.select { |_k, v| !v.nil? }
130
136
  end
131
137
 
@@ -25,20 +25,50 @@ module Copyleaks
25
25
  class SubmissionWebhooks
26
26
  # @param [String] status This webhook event is triggered once the scan status changes. Use the special token {STATUS} to track the current scan status. This special token will automatically be replaced by the Copyleaks servers with the optional values: completed, error, creditsChecked and indexed. Read more about webhooks: https://api.copyleaks.com/documentation/v3/webhooks
27
27
  # @param [String] newResult Http endpoint to be triggered while the scan is still running and a new result is found. This is useful when the report is being viewed by the user in real time so the results will load gradually as they are found.
28
- def initialize(status, newResult = nil)
28
+ # @param [Array] statusHeaders Adds headers to the webhook.
29
+ # @param [Array] newResultHeaders Adds headers to the webhook.
30
+ def initialize(status, newResult = nil, statusHeaders = nil, newResultHeaders = nil)
31
+ unless status.instance_of? String
32
+ raise 'Copyleaks::SubmissionWebhooks - status - status must be of type String'
33
+ end
34
+ unless newResult.nil? || newResult.instance_of?(String)
35
+ raise 'Copyleaks::SubmissionWebhooks - newResult - newResult must be of type String'
36
+ end
37
+ unless header_format_valid?(statusHeaders)
38
+ raise 'Copyleaks::SubmissionWebhooks - statusHeaders - statusHeaders must be an Array of String Array pairs'
39
+ end
40
+ unless header_format_valid?(newResultHeaders)
41
+ raise 'Copyleaks::SubmissionWebhooks - newResultHeaders - newResultHeaders must be an Array of String Array pairs'
42
+ end
43
+
29
44
  @newResult = newResult
30
45
  @status = status
46
+ @statusHeaders = statusHeaders
47
+ @newResultHeaders = newResultHeaders
31
48
  end
32
49
 
33
50
  def as_json(*_args)
34
51
  {
35
52
  newResult: @newResult,
36
- status: @status
53
+ status: @status,
54
+ statusHeaders: @statusHeaders,
55
+ newResultHeaders: @newResultHeaders
37
56
  }.select { |_k, v| !v.nil? }
38
57
  end
39
58
 
40
59
  def to_json(*options)
41
60
  as_json(*options).to_json(*options)
42
61
  end
62
+
63
+ private
64
+
65
+ def header_format_valid?(header)
66
+ return true if header.nil?
67
+ return false unless header.instance_of?(Array)
68
+
69
+ header.all? do |pair|
70
+ pair.instance_of?(Array) && pair.length == 2 && pair[0].instance_of?(String) && pair[1].instance_of?(String)
71
+ end
72
+ end
43
73
  end
44
74
  end
@@ -1,3 +1,3 @@
1
1
  module Copyleaks
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.2'
3
3
  end
data/lib/copyleaks.rb CHANGED
@@ -22,14 +22,11 @@
22
22
  # SOFTWARE.
23
23
  # =
24
24
 
25
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
26
-
27
- require 'copyleaks/version'
28
-
29
- require 'copyleaks/models/index'
30
- require 'copyleaks/utils/status-code.utils'
31
- require 'copyleaks/app.config'
32
- require 'copyleaks/api'
25
+ require_relative './copyleaks/api.rb'
26
+ require_relative './copyleaks/version.rb'
27
+ require_relative './copyleaks/app.config.rb'
28
+ require_relative './copyleaks/models/index.rb'
29
+ require_relative './copyleaks/utils/status-code.utils.rb'
33
30
 
34
31
  module Copyleaks
35
32
  end
data/lib/index.rb CHANGED
@@ -22,9 +22,7 @@
22
22
  # SOFTWARE.
23
23
  # =
24
24
 
25
- $LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
26
-
27
- require 'copyleaks'
25
+ require_relative 'copyleaks.rb'
28
26
 
29
27
  module Copyleaks
30
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plagiarism-checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Copyleaks ltd
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Copyleaks detects plagiarism and checks content distribution online.
14
14
  Use Copyleaks to find out if textual content is original and if it has been used
@@ -16,7 +16,9 @@ description: Copyleaks detects plagiarism and checks content distribution online
16
16
  doc, docx, ocr...), URLs and free text for plagiarism check.
17
17
  email:
18
18
  - sales@copyleaks.com
19
- executables: []
19
+ executables:
20
+ - console
21
+ - setup
20
22
  extensions: []
21
23
  extra_rdoc_files: []
22
24
  files:
@@ -58,6 +60,7 @@ files:
58
60
  - lib/copyleaks/models/submissions/properties/indexing.rb
59
61
  - lib/copyleaks/models/submissions/properties/pdf_properties.rb
60
62
  - lib/copyleaks/models/submissions/properties/repository.rb
63
+ - lib/copyleaks/models/submissions/properties/scan_method_algorithm.rb
61
64
  - lib/copyleaks/models/submissions/properties/scanning.rb
62
65
  - lib/copyleaks/models/submissions/properties/scanning_exclude.rb
63
66
  - lib/copyleaks/models/submissions/properties/scanning_repository.rb
@@ -69,7 +72,6 @@ files:
69
72
  - lib/copyleaks/utils/status-code.utils.rb
70
73
  - lib/copyleaks/version.rb
71
74
  - lib/index.rb
72
- - plagiarism-checker.gemspec
73
75
  homepage: https://api.copyleaks.com
74
76
  licenses:
75
77
  - MIT
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
-
6
- require 'copyleaks/version'
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = 'plagiarism-checker'
10
- spec.version = Copyleaks::VERSION
11
- spec.authors = ['Copyleaks ltd']
12
- spec.email = ['sales@copyleaks.com']
13
-
14
- spec.summary = 'Detects plagiarism and checks content distribution online.'
15
- spec.description = 'Copyleaks detects plagiarism and checks content distribution online. Use Copyleaks to find out if textual content is original and if it has been used before. With Copyleaks cloud publishers, academics, and more can scan files (pdf, doc, docx, ocr...), URLs and free text for plagiarism check.'
16
- spec.homepage = 'https://api.copyleaks.com'
17
- spec.license = 'MIT'
18
-
19
- spec.metadata['homepage_uri'] = spec.homepage
20
- spec.metadata['source_code_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker'
21
- spec.metadata['changelog_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases'
22
-
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:demo|test|spec|features)/}) }
25
- end
26
- spec.bindir = 'exe'
27
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
- spec.require_paths = ['lib']
29
- end