plagiarism-checker 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daf1bb5b06a87dabf0c3d99f66e95b59f622ae62da8ad1b23c3f86bee1294b28
4
- data.tar.gz: edb0ffa236e2dd08e313d1fd0287c06820184932a9856b5bf11beccf8496188e
3
+ metadata.gz: e947c529be01e971d5887175ba1dcf763a48de09c9ab732759d555c2311b07d5
4
+ data.tar.gz: ec0ef3fe06953dc9e2e213fd9c26434833c006b6facd49fa94edeec63d88962f
5
5
  SHA512:
6
- metadata.gz: dad101affa1aede0700fedd94b14206bbde93627d9de8e3070101a9390c198e035729909f3e458c63080f262b8836bcce3bcf98b1202e9bc8cc8a977f69e2e72
7
- data.tar.gz: 0e6e41a65a7c5a7caf680d23c4f098bcd02b9f0ebc7478258b3bc11377d31bb9424c9d078827cd8cfb1c099e0a259b058ad7dcc79067abf435659275f22da2ae
6
+ metadata.gz: de8559653ead6ea1ea1160f29dd5ba10426a7d4fb16729c170bd32157e78ec8168f1711b93e94a910c52a41b5bf9eba1f95d905a3b762efcb9806f0db7bce3bb
7
+ data.tar.gz: 20fefac0dd0751da77c1e9568f4ee6458f1caabc3a8b974b3e8918c9940e698107347669a20a518e2f1ee31944f3b6499e5043b3897caf1c2889e679c9817b1c
@@ -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
@@ -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.1'
2
+ VERSION = '3.1.2'
3
3
  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.1
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-11-20 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:
@@ -70,8 +72,6 @@ files:
70
72
  - lib/copyleaks/utils/status-code.utils.rb
71
73
  - lib/copyleaks/version.rb
72
74
  - lib/index.rb
73
- - plagiarism-checker-3.1.0.gem
74
- - plagiarism-checker.gemspec
75
75
  homepage: https://api.copyleaks.com
76
76
  licenses:
77
77
  - MIT
Binary file
@@ -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