plagiarism-checker 2.1.0 → 3.0.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 +4 -4
- data/.gitignore +8 -12
- data/Gemfile +6 -4
- data/LICENSE.txt +21 -21
- data/README.md +39 -0
- data/Rakefile +4 -2
- data/bin/console +10 -2
- data/lib/copyleaks/api.rb +493 -0
- data/lib/copyleaks/app.config.rb +47 -0
- data/lib/copyleaks/models/auth_token.rb +54 -0
- data/lib/copyleaks/models/delete_request_model.rb +64 -0
- data/lib/copyleaks/models/exceptions/auth_exipred_exception.rb +32 -0
- data/lib/copyleaks/models/exceptions/command_exception.rb +32 -0
- data/lib/copyleaks/models/exceptions/index.rb +32 -0
- data/lib/copyleaks/models/exceptions/rate_limit_exception.rb +32 -0
- data/lib/copyleaks/models/exceptions/under_maintenance_exception.rb +32 -0
- data/lib/copyleaks/models/exports/export_crawled_version.rb +54 -0
- data/lib/copyleaks/models/exports/export_model.rb +84 -0
- data/lib/copyleaks/models/exports/export_pdf_report.rb +54 -0
- data/lib/copyleaks/models/exports/export_results.rb +56 -0
- data/lib/copyleaks/models/exports/index.rb +32 -0
- data/lib/copyleaks/models/id_object.rb +44 -0
- data/lib/copyleaks/models/index.rb +35 -0
- data/lib/copyleaks/models/start_request_model.rb +63 -0
- data/lib/copyleaks/models/submissions/file_ocr_submission_model.rb +61 -0
- data/lib/copyleaks/models/submissions/file_submission_model.rb +57 -0
- data/lib/copyleaks/models/submissions/index.rb +33 -0
- data/lib/copyleaks/models/submissions/properties/actions.rb +33 -0
- data/lib/copyleaks/models/submissions/properties/author.rb +41 -0
- data/lib/copyleaks/models/submissions/properties/copyleaks_db.rb +44 -0
- data/lib/copyleaks/models/submissions/properties/domains_mode.rb +31 -0
- data/lib/copyleaks/models/submissions/properties/exclude.rb +59 -0
- data/lib/copyleaks/models/submissions/properties/filter.rb +67 -0
- data/lib/copyleaks/models/submissions/properties/index.rb +45 -0
- data/lib/copyleaks/models/submissions/properties/indexing.rb +41 -0
- data/lib/copyleaks/models/submissions/properties/pdf_properties.rb +55 -0
- data/lib/copyleaks/models/submissions/properties/repository.rb +41 -0
- data/lib/copyleaks/models/submissions/properties/scanning.rb +55 -0
- data/lib/copyleaks/models/submissions/properties/scanning_exclude.rb +44 -0
- data/lib/copyleaks/models/submissions/properties/scanning_repository.rb +46 -0
- data/lib/copyleaks/models/submissions/properties/sensitive_data_protection.rb +71 -0
- data/lib/copyleaks/models/submissions/properties/submission_properties.rb +136 -0
- data/lib/copyleaks/models/submissions/properties/webhooks.rb +44 -0
- data/lib/copyleaks/models/submissions/submission_model.rb +47 -0
- data/lib/copyleaks/models/submissions/url_submission_model.rb +51 -0
- data/lib/copyleaks/utils/status-code.utils.rb +38 -0
- data/lib/copyleaks/version.rb +3 -0
- data/lib/index.rb +30 -0
- data/plagiarism-checker.gemspec +29 -0
- metadata +50 -108
- data/.rubocop.yml +0 -2
- data/copyleaks_api.gemspec +0 -29
- data/example_async.rb +0 -50
- data/example_syncronized.rb +0 -73
- data/lib/copyleaks_api.rb +0 -24
- data/lib/copyleaks_api/Models/ResultRecord.rb +0 -60
- data/lib/copyleaks_api/access_token.rb +0 -36
- data/lib/copyleaks_api/api.rb +0 -210
- data/lib/copyleaks_api/config.rb +0 -36
- data/lib/copyleaks_api/copyleaks_cloud.rb +0 -116
- data/lib/copyleaks_api/copyleaks_process.rb +0 -78
- data/lib/copyleaks_api/errors.rb +0 -29
- data/lib/copyleaks_api/validators/custom_fields_validator.rb +0 -35
- data/lib/copyleaks_api/validators/email_validator.rb +0 -13
- data/lib/copyleaks_api/validators/file_validator.rb +0 -56
- data/lib/copyleaks_api/validators/language_validator.rb +0 -12
- data/lib/copyleaks_api/validators/response_validator.rb +0 -27
- data/lib/copyleaks_api/validators/url_validator.rb +0 -12
- data/lib/copyleaks_api/version.rb +0 -3
@@ -0,0 +1,54 @@
|
|
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 ExportPdfReport
|
26
|
+
attr_reader :endpoint, :verb, :headers
|
27
|
+
|
28
|
+
# @param [String] endpoint The HTTP url to upload the data.
|
29
|
+
# @param [String] verb The HTTP verb (also called "HTTP Methods") to upload the data to your specified endpoint.
|
30
|
+
# @param [string[][]] headers List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as "Authorization" header. Example: [["header-key1", "header-value1"], ["header-key2", "header-value2"]]
|
31
|
+
def initialize(endpoint, verb, headers = nil)
|
32
|
+
unless endpoint.instance_of?(String)
|
33
|
+
raise 'Copyleaks::ExportPdfReport - endpoint - endpoint must be of type String'
|
34
|
+
end
|
35
|
+
raise 'Copyleaks::ExportPdfReport - verb - verb must be of type String' unless verb.instance_of?(String)
|
36
|
+
|
37
|
+
@endpoint = endpoint
|
38
|
+
@verb = verb
|
39
|
+
@headers = headers
|
40
|
+
end
|
41
|
+
|
42
|
+
def as_json(*_args)
|
43
|
+
{
|
44
|
+
endpoint: @endpoint,
|
45
|
+
verb: @verb,
|
46
|
+
headers: @headers
|
47
|
+
}.select { |_k, v| !v.nil? }
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_json(*options)
|
51
|
+
as_json(*options).to_json(*options)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 ExportResults
|
26
|
+
attr_reader :id, :endpoint, :verb, :headers
|
27
|
+
|
28
|
+
# @param [String] id Result identification to be downloaded. You get these identifications from the completed webhook. https://api.copyleaks.com/documentation/v3/webhooks/completed
|
29
|
+
# @param [String] endpoint The HTTP url to upload the data.
|
30
|
+
# @param [String] verb The HTTP verb (also called "HTTP Methods") to upload the data to your specified endpoint.
|
31
|
+
# @param [string[][]] headers List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as "Authorization" header. Example: [["header-key1", "header-value1"], ["header-key2", "header-value2"]]
|
32
|
+
def initialize(id, endpoint, verb, headers = nil)
|
33
|
+
raise 'Copyleaks::ExportResults - id - id must be of type String' unless id.instance_of?(String)
|
34
|
+
raise 'Copyleaks::ExportResults - endpoint - endpoint must be of type String' unless endpoint.instance_of?(String)
|
35
|
+
raise 'Copyleaks::ExportResults - verb - verb must be of type String' unless verb.instance_of?(String)
|
36
|
+
|
37
|
+
@id = id
|
38
|
+
@endpoint = endpoint
|
39
|
+
@verb = verb
|
40
|
+
@headers = headers
|
41
|
+
end
|
42
|
+
|
43
|
+
def as_json(*_args)
|
44
|
+
{
|
45
|
+
id: @id,
|
46
|
+
endpoint: @endpoint,
|
47
|
+
verb: @verb,
|
48
|
+
headers: @headers
|
49
|
+
}.select { |_k, v| !v.nil? }
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_json(*options)
|
53
|
+
as_json(*options).to_json(*options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
$LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
|
25
|
+
|
26
|
+
require 'export_model'
|
27
|
+
require 'export_crawled_version'
|
28
|
+
require 'export_pdf_report'
|
29
|
+
require 'export_results'
|
30
|
+
|
31
|
+
module Copyleaks
|
32
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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 IdObject
|
26
|
+
attr_reader :id
|
27
|
+
|
28
|
+
def initialize(id)
|
29
|
+
raise 'Copyleaks::IdObject - id - id must be of type String' unless id.instance_of?(String)
|
30
|
+
|
31
|
+
@id = id
|
32
|
+
end
|
33
|
+
|
34
|
+
def as_json(*_args)
|
35
|
+
{
|
36
|
+
id: @id
|
37
|
+
}.select { |_k, v| !v.nil? }
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_json(*options)
|
41
|
+
as_json(*options).to_json(*options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
+
$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
|
+
|
30
|
+
require 'id_object'
|
31
|
+
require 'delete_request_model'
|
32
|
+
require 'start_request_model'
|
33
|
+
|
34
|
+
module Copyleaks
|
35
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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 CopyleaksStartRequestModel
|
26
|
+
attr_reader :trigger, :errorHandling
|
27
|
+
|
28
|
+
# @param string[] trigger A list of scans that you submitted for a check-credits scan and that you would like to submit for a full scan.
|
29
|
+
# @param CopyleaksStartErrorHandlings errorHandling When set to ignore (ignore = 1) the trigger scans will start running even if some of them are in error mode, when set to cancel (cancel = 0) the request will be cancelled if any error was found.
|
30
|
+
def initialize(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE)
|
31
|
+
trigger.each do |item|
|
32
|
+
unless item.instance_of?(String)
|
33
|
+
raise 'Copyleaks::CopyleaksStartRequestModel - trigger - entity must be of type String'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
unless [0, 1].include? errorHandling
|
38
|
+
raise 'Copyleaks::CopyleaksStartRequestModel - errorHandling - errorHandling must be of type Copyleaks::CopyleaksStartErrorHandlings Consts'
|
39
|
+
end
|
40
|
+
|
41
|
+
@trigger = trigger
|
42
|
+
@errorHandling = errorHandling
|
43
|
+
end
|
44
|
+
|
45
|
+
def as_json(*_args)
|
46
|
+
{
|
47
|
+
trigger: @trigger,
|
48
|
+
errorHandling: @errorHandling
|
49
|
+
}.select { |_k, v| !v.nil? }
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_json(*options)
|
53
|
+
as_json(*options).to_json(*options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class CopyleaksStartErrorHandlings
|
58
|
+
# The request will be cancelled if any error was found.
|
59
|
+
CANCEL = 0
|
60
|
+
# The trigger scans will start running even if some of them are in error mode
|
61
|
+
IGNORE = 1
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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 CopyleaksFileOcrSubmissionModel < CopyleaksFileSubmissionModel
|
26
|
+
# @param [String] langCode The language code of your content. The selected language should be on the OCR supported languages list. https://api.copyleaks.com/documentation/v3/specifications/ocr-languages
|
27
|
+
# @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.
|
28
|
+
# @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.
|
29
|
+
# @param [SubmissionProperties] properties Check inner properties for more details.
|
30
|
+
def initialize(langCode, base64, filename, properties)
|
31
|
+
unless langCode.instance_of?(String)
|
32
|
+
raise 'Copyleaks::CopyleaksFileOcrSubmissionModel - langCode - langCode must be of type String'
|
33
|
+
end
|
34
|
+
unless base64.instance_of?(String)
|
35
|
+
raise 'Copyleaks::CopyleaksFileOcrSubmissionModel - base64 - base64 must be of type String'
|
36
|
+
end
|
37
|
+
unless filename.instance_of?(String)
|
38
|
+
raise 'Copyleaks::CopyleaksFileOcrSubmissionModel - filename - filename must be of type String'
|
39
|
+
end
|
40
|
+
unless properties.instance_of?(SubmissionProperties)
|
41
|
+
raise 'Copyleaks::CopyleaksFileOcrSubmissionModel - properties - properties must be of type SubmissionProperties'
|
42
|
+
end
|
43
|
+
|
44
|
+
super(base64, filename, properties)
|
45
|
+
@langCode = langCode
|
46
|
+
end
|
47
|
+
|
48
|
+
def as_json(*_args)
|
49
|
+
{
|
50
|
+
langCode: @langCode,
|
51
|
+
base64: @base64,
|
52
|
+
filename: @filename,
|
53
|
+
properties: @properties
|
54
|
+
}.select { |_k, v| !v.nil? }
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_json(*options)
|
58
|
+
as_json(*options).to_json(*options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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 CopyleaksFileSubmissionModel < CopyleaksSubmissionModel
|
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
|
+
# @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
|
+
# @param [SubmissionProperties] properties Check inner properties for more details.
|
29
|
+
def initialize(base64, filename, properties)
|
30
|
+
unless base64.instance_of?(String)
|
31
|
+
raise 'Copyleaks::CopyleaksFileSubmissionModel - base64 - base64 must be of type String'
|
32
|
+
end
|
33
|
+
unless filename.instance_of?(String)
|
34
|
+
raise 'Copyleaks::CopyleaksFileSubmissionModel - filename - filename must be of type String'
|
35
|
+
end
|
36
|
+
unless properties.instance_of?(SubmissionProperties)
|
37
|
+
raise 'Copyleaks::CopyleaksFileSubmissionModel - properties - properties must be of type SubmissionProperties'
|
38
|
+
end
|
39
|
+
|
40
|
+
super(properties)
|
41
|
+
@base64 = base64
|
42
|
+
@filename = filename
|
43
|
+
end
|
44
|
+
|
45
|
+
def as_json(*_args)
|
46
|
+
{
|
47
|
+
base64: @base64,
|
48
|
+
filename: @filename,
|
49
|
+
properties: @properties
|
50
|
+
}.select { |_k, v| !v.nil? }
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_json(*options)
|
54
|
+
as_json(*options).to_json(*options)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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
|
+
$LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
|
25
|
+
require 'properties/index'
|
26
|
+
|
27
|
+
require 'submission_model'
|
28
|
+
require 'file_submission_model'
|
29
|
+
require 'file_ocr_submission_model'
|
30
|
+
require 'url_submission_model'
|
31
|
+
|
32
|
+
module Copyleaks
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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 SubmissionActions
|
26
|
+
# Start scan immediately
|
27
|
+
SCAN = 0
|
28
|
+
# Check how many credits will be used for this scan.
|
29
|
+
CHECKCREDITS = 1
|
30
|
+
# Only index the file in the Copyleaks internal database. No credits will be used.
|
31
|
+
INDEXONLY = 2
|
32
|
+
end
|
33
|
+
end
|