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
data/lib/index.rb
ADDED
@@ -0,0 +1,30 @@
|
|
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
|
+
$LOAD_PATH.unshift(__dir__) unless $LOAD_PATH.include?(__dir__)
|
26
|
+
|
27
|
+
require 'copyleaks'
|
28
|
+
|
29
|
+
module Copyleaks
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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
|
metadata
CHANGED
@@ -1,99 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plagiarism-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Copyleaks ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: webmock
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.7'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.7'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: mimemagic
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
11
|
+
date: 2021-01-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
97
13
|
description: Copyleaks detects plagiarism and checks content distribution online.
|
98
14
|
Use Copyleaks to find out if textual content is original and if it has been used
|
99
15
|
before. With Copyleaks cloud publishers, academics, and more can scan files (pdf,
|
@@ -105,35 +21,61 @@ extensions: []
|
|
105
21
|
extra_rdoc_files: []
|
106
22
|
files:
|
107
23
|
- ".gitignore"
|
108
|
-
- ".rubocop.yml"
|
109
24
|
- Gemfile
|
110
25
|
- LICENSE.txt
|
111
26
|
- README.md
|
112
27
|
- Rakefile
|
113
28
|
- bin/console
|
114
29
|
- bin/setup
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
30
|
+
- lib/copyleaks/api.rb
|
31
|
+
- lib/copyleaks/app.config.rb
|
32
|
+
- lib/copyleaks/models/auth_token.rb
|
33
|
+
- lib/copyleaks/models/delete_request_model.rb
|
34
|
+
- lib/copyleaks/models/exceptions/auth_exipred_exception.rb
|
35
|
+
- lib/copyleaks/models/exceptions/command_exception.rb
|
36
|
+
- lib/copyleaks/models/exceptions/index.rb
|
37
|
+
- lib/copyleaks/models/exceptions/rate_limit_exception.rb
|
38
|
+
- lib/copyleaks/models/exceptions/under_maintenance_exception.rb
|
39
|
+
- lib/copyleaks/models/exports/export_crawled_version.rb
|
40
|
+
- lib/copyleaks/models/exports/export_model.rb
|
41
|
+
- lib/copyleaks/models/exports/export_pdf_report.rb
|
42
|
+
- lib/copyleaks/models/exports/export_results.rb
|
43
|
+
- lib/copyleaks/models/exports/index.rb
|
44
|
+
- lib/copyleaks/models/id_object.rb
|
45
|
+
- lib/copyleaks/models/index.rb
|
46
|
+
- lib/copyleaks/models/start_request_model.rb
|
47
|
+
- lib/copyleaks/models/submissions/file_ocr_submission_model.rb
|
48
|
+
- lib/copyleaks/models/submissions/file_submission_model.rb
|
49
|
+
- lib/copyleaks/models/submissions/index.rb
|
50
|
+
- lib/copyleaks/models/submissions/properties/actions.rb
|
51
|
+
- lib/copyleaks/models/submissions/properties/author.rb
|
52
|
+
- lib/copyleaks/models/submissions/properties/copyleaks_db.rb
|
53
|
+
- lib/copyleaks/models/submissions/properties/domains_mode.rb
|
54
|
+
- lib/copyleaks/models/submissions/properties/exclude.rb
|
55
|
+
- lib/copyleaks/models/submissions/properties/filter.rb
|
56
|
+
- lib/copyleaks/models/submissions/properties/index.rb
|
57
|
+
- lib/copyleaks/models/submissions/properties/indexing.rb
|
58
|
+
- lib/copyleaks/models/submissions/properties/pdf_properties.rb
|
59
|
+
- lib/copyleaks/models/submissions/properties/repository.rb
|
60
|
+
- lib/copyleaks/models/submissions/properties/scanning.rb
|
61
|
+
- lib/copyleaks/models/submissions/properties/scanning_exclude.rb
|
62
|
+
- lib/copyleaks/models/submissions/properties/scanning_repository.rb
|
63
|
+
- lib/copyleaks/models/submissions/properties/sensitive_data_protection.rb
|
64
|
+
- lib/copyleaks/models/submissions/properties/submission_properties.rb
|
65
|
+
- lib/copyleaks/models/submissions/properties/webhooks.rb
|
66
|
+
- lib/copyleaks/models/submissions/submission_model.rb
|
67
|
+
- lib/copyleaks/models/submissions/url_submission_model.rb
|
68
|
+
- lib/copyleaks/utils/status-code.utils.rb
|
69
|
+
- lib/copyleaks/version.rb
|
70
|
+
- lib/index.rb
|
71
|
+
- plagiarism-checker.gemspec
|
133
72
|
homepage: https://api.copyleaks.com
|
134
73
|
licenses:
|
135
74
|
- MIT
|
136
|
-
metadata:
|
75
|
+
metadata:
|
76
|
+
homepage_uri: https://api.copyleaks.com
|
77
|
+
source_code_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker
|
78
|
+
changelog_uri: https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases
|
137
79
|
post_install_message:
|
138
80
|
rdoc_options: []
|
139
81
|
require_paths:
|
@@ -150,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
92
|
version: '0'
|
151
93
|
requirements: []
|
152
94
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.6.
|
95
|
+
rubygems_version: 2.6.14.4
|
154
96
|
signing_key:
|
155
97
|
specification_version: 4
|
156
98
|
summary: Detects plagiarism and checks content distribution online.
|
data/.rubocop.yml
DELETED
data/copyleaks_api.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'copyleaks_api/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "plagiarism-checker"
|
8
|
-
spec.version = CopyleaksApi::VERSION
|
9
|
-
spec.authors = ["Copyleaks ltd"]
|
10
|
-
spec.email = ["sales@copyleaks.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Detects plagiarism and checks content distribution online.}
|
13
|
-
spec.description = %q{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.}
|
14
|
-
spec.homepage = "https://api.copyleaks.com"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_development_dependency 'webmock'
|
23
|
-
spec.add_development_dependency 'pry'
|
24
|
-
spec.add_development_dependency 'rspec'
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
-
|
28
|
-
spec.add_runtime_dependency 'mimemagic'
|
29
|
-
end
|
data/example_async.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# Import the module
|
2
|
-
require_relative './lib/copyleaks_api'
|
3
|
-
# If you installed this library using gem install use this import
|
4
|
-
#require 'copyleaks_api'
|
5
|
-
|
6
|
-
# In order to use this API you need to register to Copyleaks at https://copyleaks.com/account/register
|
7
|
-
# Login using your account email and account key provided at api.copyleaks.com dashboards.
|
8
|
-
email = "<--YOUR-EMAIL-->"
|
9
|
-
api_key = "<--API-KEY-->"
|
10
|
-
# There are currently 3 available products - :businesses, :education, :websites
|
11
|
-
cloud = CopyleaksApi::CopyleaksCloud.new(email, api_key, :businesses)
|
12
|
-
|
13
|
-
# Check your account balance
|
14
|
-
puts "You have #{cloud.get_credits_balance} credits"
|
15
|
-
|
16
|
-
# Process Configuration
|
17
|
-
CopyleaksApi::Config.sandbox_mode = true # Sandbox mode will not consume any credits while returning dummy results
|
18
|
-
CopyleaksApi::Config.http_callback = 'http://yoursite.here/callback/completion/{PID}'
|
19
|
-
# For testing purposes you can use http://requestb.in
|
20
|
-
|
21
|
-
#CopyleaksApi::Config
|
22
|
-
# For more information: https://api.copyleaks.com/GeneralDocumentation/RequestHeaders
|
23
|
-
# Available configuration options:
|
24
|
-
#CopyleaksApi::Config do |config|
|
25
|
-
# config.sanbox_mode = true
|
26
|
-
# config.allow_partial_scan = true
|
27
|
-
# config.http_callback = 'http://yoursite.here/callback/{PID}'
|
28
|
-
# config.in_progress_result = 'http://yoursite.here/callback/results/{PID}'
|
29
|
-
# config.email_callback = 'your@email.com'
|
30
|
-
# config.custom_fields = { some_field: 'and its value' }
|
31
|
-
# config.compare_only = true # Only while using create-by-files
|
32
|
-
#end
|
33
|
-
|
34
|
-
|
35
|
-
# Create a process using one of the optional methods
|
36
|
-
# Available methods: create_by_url, create_by_text, create_by_file, create_by_files and create_by_ocr.
|
37
|
-
# For more information see our documentation on http://api.copyleaks.com/
|
38
|
-
begin
|
39
|
-
process = cloud.create_by_url("https://microsoft.com/")
|
40
|
-
#process = cloud.create_by_text("THE TEXT YOU WISH TO SCAN")
|
41
|
-
#process = cloud.create_by_file(path_to_file)
|
42
|
-
#processes = cloud.create_by_files(files_paths)
|
43
|
-
#process = cloud.create_by_ocr(path_to_image, language: 'en') # Requires the language of the text.
|
44
|
-
# Use cloud.get_ocr_languages to get the supported langauges.
|
45
|
-
# or take a look at this page: https://api.copyleaks.com/GeneralDocumentation/OcrLanguagesList
|
46
|
-
|
47
|
-
puts "Your scan(#{process.process_id}) was created successfully. We will trigger the callback soon."
|
48
|
-
rescue Exception => ex
|
49
|
-
puts "Failed to create new process with exception: #{ex}"
|
50
|
-
end
|
data/example_syncronized.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# Import the module
|
2
|
-
require_relative './lib/copyleaks_api'
|
3
|
-
# If you installed this library using gem install use this import
|
4
|
-
#require 'copyleaks_api'
|
5
|
-
|
6
|
-
# In order to use this API you need to register to Copyleaks at https://copyleaks.com/account/register
|
7
|
-
# Login using your account email and account key provided at api.copyleaks.com dashboards.
|
8
|
-
email = "<--YOUR-EMAIL-->"
|
9
|
-
api_key = "<--API-KEY-->"
|
10
|
-
# There are currently 3 available products - :businesses, :education, :websites
|
11
|
-
cloud = CopyleaksApi::CopyleaksCloud.new(email, api_key, :businesses)
|
12
|
-
|
13
|
-
# Check your account balance
|
14
|
-
puts "You have #{cloud.get_credits_balance} credits"
|
15
|
-
|
16
|
-
# Process Configuration
|
17
|
-
CopyleaksApi::Config.sandbox_mode = true # Sandbox mode will not consume any credits while returning fake results
|
18
|
-
#CopyleaksApi::Config
|
19
|
-
# For more information: https://api.copyleaks.com/GeneralDocumentation/RequestHeaders
|
20
|
-
# Available configuration options:
|
21
|
-
#CopyleaksApi::Config do |config|
|
22
|
-
# config.sanbox_mode = true
|
23
|
-
# config.allow_partial_scan = true
|
24
|
-
# config.http_callback = 'http://yoursite.here'
|
25
|
-
# config.in_progress_result = 'http://yoursite.here'
|
26
|
-
# config.email_callback = 'your@email.com'
|
27
|
-
# config.custom_fields = { some_field: 'and its value' }
|
28
|
-
# config.compare_only = true # Only while using create-by-files
|
29
|
-
#end
|
30
|
-
|
31
|
-
|
32
|
-
# Create a process using one of the optional methods
|
33
|
-
# Available methods: create_by_url, create_by_text, create_by_file, create_by_files and create_by_ocr.
|
34
|
-
# For more information see our documentation on http://api.copyleaks.com/
|
35
|
-
process = cloud.create_by_url("https://copyleaks.com/")
|
36
|
-
#process = cloud.create_by_text("THE TEXT YOU WISH TO SCAN")
|
37
|
-
#process = cloud.create_by_file(path_to_file)
|
38
|
-
#processes = cloud.create_by_files(files_paths)
|
39
|
-
#process = cloud.create_by_ocr(path_to_image, language: 'en') # Requires the language of the text.
|
40
|
-
# Use cloud.get_ocr_languages to get the supported langauges.
|
41
|
-
# or take a look at this page: https://api.copyleaks.com/GeneralDocumentation/OcrLanguagesList
|
42
|
-
|
43
|
-
puts "Processing Started"
|
44
|
-
|
45
|
-
# Now we will check the status of the process until its done
|
46
|
-
# **We highly recommend to use the http_callback option at the config in order to get a callback once the process is finished**
|
47
|
-
# For more info visit: https://api.copyleaks.com/GeneralDocumentation/RequestHeaders
|
48
|
-
while process.processing?
|
49
|
-
sleep(1)
|
50
|
-
process.update_status
|
51
|
-
puts "#"*(process.progress/2) + "-"*(50 - process.progress/2) + "#{process.progress}%"
|
52
|
-
end
|
53
|
-
|
54
|
-
puts "Processing Ended"
|
55
|
-
# to get our results from processing we can just call correspond method
|
56
|
-
results = process.get_results
|
57
|
-
|
58
|
-
puts "#{results.size} Results: "
|
59
|
-
results.each do |res|
|
60
|
-
#puts cloud.get_comparison_report(res)
|
61
|
-
#puts cloud.get_raw_text(res)
|
62
|
-
puts res.to_s
|
63
|
-
end
|
64
|
-
|
65
|
-
# Delete the created process
|
66
|
-
#puts process.delete
|
67
|
-
|
68
|
-
# In order to get all your past processes
|
69
|
-
#processes = cloud.get_processes
|
70
|
-
#puts "Overall you have #{processes.size} processes"
|
71
|
-
#processes.each do |res|
|
72
|
-
# puts res.to_s
|
73
|
-
#end
|
data/lib/copyleaks_api.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
-
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
3
|
-
end
|
4
|
-
require 'copyleaks_api/version'
|
5
|
-
|
6
|
-
require 'copyleaks_api/errors'
|
7
|
-
|
8
|
-
require 'copyleaks_api/Models/ResultRecord'
|
9
|
-
|
10
|
-
require 'copyleaks_api/validators/custom_fields_validator'
|
11
|
-
require 'copyleaks_api/validators/email_validator'
|
12
|
-
require 'copyleaks_api/validators/file_validator'
|
13
|
-
require 'copyleaks_api/validators/response_validator'
|
14
|
-
require 'copyleaks_api/validators/url_validator'
|
15
|
-
require 'copyleaks_api/validators/language_validator'
|
16
|
-
|
17
|
-
require 'copyleaks_api/copyleaks_cloud'
|
18
|
-
require 'copyleaks_api/access_token'
|
19
|
-
require 'copyleaks_api/api'
|
20
|
-
require 'copyleaks_api/config'
|
21
|
-
require 'copyleaks_api/copyleaks_process'
|
22
|
-
|
23
|
-
module CopyleaksApi
|
24
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module CopyleaksApi
|
2
|
-
module Models
|
3
|
-
class ResultRecord
|
4
|
-
def initialize(response)
|
5
|
-
@URL = response['URL']
|
6
|
-
@Percents = response['Percents']
|
7
|
-
@NumberOfCopiedWords = response['NumberOfCopiedWords']
|
8
|
-
@CachedVersion = response['CachedVersion']
|
9
|
-
@Title = response['Title']
|
10
|
-
@Introduction = response['Introduction']
|
11
|
-
@ComparisonReport = response['ComparisonReport']
|
12
|
-
@EmbededComparison = response['EmbededComparison']
|
13
|
-
end
|
14
|
-
|
15
|
-
def get_url
|
16
|
-
@URL
|
17
|
-
end
|
18
|
-
|
19
|
-
def get_percents
|
20
|
-
@Percents
|
21
|
-
end
|
22
|
-
|
23
|
-
def get_number_of_copied_words
|
24
|
-
@NumberOfCopiedWords
|
25
|
-
end
|
26
|
-
|
27
|
-
def get_cached_version
|
28
|
-
@CachedVersion
|
29
|
-
end
|
30
|
-
|
31
|
-
def get_title
|
32
|
-
@Title
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_introduction
|
36
|
-
@Introduction
|
37
|
-
end
|
38
|
-
|
39
|
-
def get_comparison_report
|
40
|
-
@ComparisonReport
|
41
|
-
end
|
42
|
-
|
43
|
-
def get_embeded_comparison
|
44
|
-
@EmbededComparison
|
45
|
-
end
|
46
|
-
|
47
|
-
def to_s
|
48
|
-
puts "----------------------------------------------------------------"
|
49
|
-
puts "Title: #{@Title}"
|
50
|
-
puts "Introduction: #{@Introduction}"
|
51
|
-
puts "Url: #{@URL}"
|
52
|
-
puts "Percents: #{@Percents}%"
|
53
|
-
puts "NumberOfCopiedWords: #{@NumberOfCopiedWords}"
|
54
|
-
puts "CachedVersion: #{@CachedVersion}"
|
55
|
-
puts "ComparisonReport: #{@ComparisonReport}"
|
56
|
-
puts "EmbededComparison: #{@EmbededComparison}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|