plagscan 0.0.5 → 0.0.6

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: bb9645222427fd2be445f133d7a239a9367233d9cdcc7d30132d5e8dab88c99e
4
- data.tar.gz: 9d0f91db86a1b9c513e095d567472bf0daf078b7d1192bb209339509c797e3b4
3
+ metadata.gz: 433c2ec8955ae950941672d96480f29dcf884c30c8a005fe7a1f2fd342d9a784
4
+ data.tar.gz: fbcb73f1371aee03721d53df442c9504f7cea64f1a3df183812ccffffe427a74
5
5
  SHA512:
6
- metadata.gz: 1679377a4395bdcbdc4bd49a6c725eea4b6541eb211de8365d23478b8f295b8e744e6d5d3f2bb75d5106f514c1c847c0cb9a6b33d08fc895daa52999551c262e
7
- data.tar.gz: e8bbb48fa2ae2d940c29158e4994172809b1042780aff6508ef53622f072620b10392b602d784b9fb3f403e683104f00e6546280bfc1c764885dc69b0ffcc22e
6
+ metadata.gz: 9bed202c3a3ddfebc0cd2f66c199982e5b1b997cf1b8f295ded6fe28d66d47e3c3e1afae544576622245f2beb1440be709564975cea04c34c383c794a0a0b0fb
7
+ data.tar.gz: c0c3a13c1550be8fbe9b35accc7759b63c7e88bc9c8b4103489e768f8e0157291b13bc130691d204f6dfc8a27b7488d06c93b23addbe26fb76123ac0ca62e5f5
@@ -0,0 +1,34 @@
1
+ name: Test Plagscan Ruby gem
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+
25
+ - name: Lint code - Rubocop
26
+ run: bundle exec rubocop
27
+
28
+ - name: Run tests
29
+ run: bundle exec rake
30
+
31
+ - name: Test & publish code coverage
32
+ uses: paambaati/codeclimate-action@v3.0.0
33
+ env:
34
+ CC_TEST_REPORTER_ID: 1e550d84766c7d7d61b7fb36d672a9cf6834600715a798b90e6a66d48574f592
data/.rubocop.yml CHANGED
@@ -1,8 +1,30 @@
1
1
  require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ NewCops: enable
6
+
3
7
  Layout/DotPosition:
4
8
  EnforcedStyle: trailing
5
9
 
10
+ Layout/EmptyLinesAroundAttributeAccessor:
11
+ Enabled: true
12
+
13
+ Layout/SpaceAroundMethodCallOperator:
14
+ Enabled: true
15
+
16
+ Lint/DeprecatedOpenSSLConstant:
17
+ Enabled: true
18
+
19
+ Lint/MixedRegexpCaptureTypes:
20
+ Enabled: true
21
+
22
+ Lint/RaiseException:
23
+ Enabled: true
24
+
25
+ Lint/StructNewOverride:
26
+ Enabled: true
27
+
6
28
  Metrics/BlockLength:
7
29
  Exclude:
8
30
  - "**/*_spec.rb"
@@ -21,3 +43,24 @@ RSpec/MessageSpies:
21
43
 
22
44
  RSpec/MultipleExpectations:
23
45
  Max: 2
46
+
47
+ Style/ExponentialNotation:
48
+ Enabled: true
49
+
50
+ Style/HashEachMethods:
51
+ Enabled: true
52
+
53
+ Style/HashTransformKeys:
54
+ Enabled: true
55
+
56
+ Style/HashTransformValues:
57
+ Enabled: true
58
+
59
+ Style/RedundantRegexpCharacterClass:
60
+ Enabled: true
61
+
62
+ Style/RedundantRegexpEscape:
63
+ Enabled: true
64
+
65
+ Style/SlicingWithRange:
66
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  ## Unreleased
4
4
  - none
5
5
 
6
+ ## [0.0.6](releases/tag/v0.0.6) - 2022-07-25
7
+ ### Fixed
8
+ - [#3] Increase read timeout for Documents#create to 2 minutes
9
+
6
10
  ## [0.0.5](releases/tag/v0.0.5) - 2020-03-01
7
11
  ### Fixed
8
12
  - Address CVE-2020-8130 - `rake` OS command injection vulnerability
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Travis Build Status](http://img.shields.io/travis/Studiosity/plagscan-ruby.svg?style=flat)](https://travis-ci.org/Studiosity/plagscan-ruby)
1
+ [![Github Build Status](https://github.com/Studiosity/plagscan-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/Studiosity/plagscan-ruby/actions/workflows/test.yml)
2
2
  [![Maintainability](https://api.codeclimate.com/v1/badges/43ec9575fe4727b96adb/maintainability)](https://codeclimate.com/github/Studiosity/plagscan-ruby/maintainability)
3
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/43ec9575fe4727b96adb/test_coverage)](https://codeclimate.com/github/Studiosity/plagscan-ruby/test_coverage)
4
4
  [![Gem Version](http://img.shields.io/gem/v/plagscan.svg?style=flat)](http://rubygems.org/gems/plagscan)
@@ -26,7 +26,8 @@ module Plagscan
26
26
  Plagscan::Request.json_request(
27
27
  'documents',
28
28
  method: :post, access_token: access_token, expected_result: Net::HTTPCreated,
29
- body: create_props.merge(file ? { fileUpload: file } : { textdata: text })
29
+ body: create_props.merge(file ? { fileUpload: file } : { textdata: text }),
30
+ read_timeout: 120
30
31
  )
31
32
  end
32
33
 
@@ -22,15 +22,15 @@ module Plagscan
22
22
  "PlagScan-Ruby/#{Plagscan::VERSION}"
23
23
  end
24
24
 
25
- def request(path, options = {})
25
+ def request(path, **options)
26
26
  options = DEFAULT_REQUEST_OPTIONS.merge(options)
27
27
  http = create_http(options)
28
28
  req = create_request(path, options)
29
29
  http.start { http.request(req) }
30
30
  end
31
31
 
32
- def json_request(path, options = {})
33
- response = Plagscan::Request.request(path, options)
32
+ def json_request(path, **options)
33
+ response = Plagscan::Request.request(path, **options)
34
34
 
35
35
  unless response.is_a?(options[:expected_result] || Net::HTTPSuccess)
36
36
  raise Plagscan::HTTPError, "Invalid http response: #{response.code} - #{response.body}"
@@ -43,7 +43,7 @@ module Plagscan
43
43
 
44
44
  private
45
45
 
46
- def create_http(options)
46
+ def create_http(options) # rubocop:disable Metrics/AbcSize
47
47
  uri = URI api_url
48
48
  http = Net::HTTP.new(uri.host, uri.port)
49
49
 
@@ -53,6 +53,10 @@ module Plagscan
53
53
  http.ca_file = options[:ssl_ca_file] if options[:ssl_ca_file]
54
54
  end
55
55
 
56
+ %i[open_timeout write_timeout read_timeout].each do |option|
57
+ http.__send__("#{option}=", options[option]) if options[option]
58
+ end
59
+
56
60
  http
57
61
  end
58
62
 
@@ -68,7 +72,7 @@ module Plagscan
68
72
  end
69
73
 
70
74
  def body_request(uri, headers, options)
71
- uri += '?access_token=' + options[:access_token] if options[:access_token]
75
+ uri += "?access_token=#{options[:access_token]}" if options[:access_token]
72
76
  req = http_method(options).new(uri, headers)
73
77
  add_body(req, options[:body]) if options[:body]
74
78
  req
@@ -77,7 +81,7 @@ module Plagscan
77
81
  def uri_request(uri, headers, options)
78
82
  body = options[:body] || {}
79
83
  body[:access_token] = options[:access_token] if options[:access_token]
80
- uri += '?' + body.map { |k, v| "#{k}=#{v}" }.join('&') unless body.empty?
84
+ uri += "?#{body.map { |k, v| "#{k}=#{v}" }.join('&')}" unless body.empty?
81
85
  http_method(options).new(uri, headers)
82
86
  end
83
87
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plagscan
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
data/plagscan.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = 'Ruby gem for PlagScan (https://www.plagscan.com/) plagiarism checking APIs'
15
15
  spec.homepage = 'https://github.com/Studiosity/plagscan-ruby'
16
16
  spec.license = 'MIT'
17
+ spec.required_ruby_version = ['>= 2.5.0', '< 3.2.0']
17
18
 
18
19
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
19
20
  # delete this section to allow pushing this gem to any host.
@@ -22,6 +23,7 @@ Gem::Specification.new do |spec|
22
23
  end
23
24
 
24
25
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
26
+ spec.metadata['rubygems_mfa_required'] = 'true'
25
27
 
26
28
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
29
  spec.require_paths = ['lib']
@@ -29,8 +31,9 @@ Gem::Specification.new do |spec|
29
31
  spec.add_development_dependency 'bundler', '~> 2.0'
30
32
  spec.add_development_dependency 'rake', '>= 12.3.3'
31
33
  spec.add_development_dependency 'rspec', '~> 3.0'
32
- spec.add_development_dependency 'rubocop', '~> 0.74'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 1.35'
34
- spec.add_development_dependency 'simplecov', '~> 0.17'
34
+ spec.add_development_dependency 'rubocop', '~> 1.28'
35
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
36
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
37
+ spec.add_development_dependency 'simplecov', '~> 0.17', '< 0.18'
35
38
  spec.add_development_dependency 'webmock', '~> 3.0'
36
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plagscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2022-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,28 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.74'
61
+ version: '1.28'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.74'
68
+ version: '1.28'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.6'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubocop-rspec
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '1.35'
89
+ version: '2.10'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '1.35'
96
+ version: '2.10'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: simplecov
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +101,9 @@ dependencies:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0.17'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '0.18'
90
107
  type: :development
91
108
  prerelease: false
92
109
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,6 +111,9 @@ dependencies:
94
111
  - - "~>"
95
112
  - !ruby/object:Gem::Version
96
113
  version: '0.17'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.18'
97
117
  - !ruby/object:Gem::Dependency
98
118
  name: webmock
99
119
  requirement: !ruby/object:Gem::Requirement
@@ -116,9 +136,9 @@ executables: []
116
136
  extensions: []
117
137
  extra_rdoc_files: []
118
138
  files:
139
+ - ".github/workflows/test.yml"
119
140
  - ".gitignore"
120
141
  - ".rubocop.yml"
121
- - ".travis.yml"
122
142
  - CHANGELOG.md
123
143
  - Gemfile
124
144
  - LICENSE
@@ -139,7 +159,8 @@ licenses:
139
159
  - MIT
140
160
  metadata:
141
161
  allowed_push_host: https://rubygems.org
142
- post_install_message:
162
+ rubygems_mfa_required: 'true'
163
+ post_install_message:
143
164
  rdoc_options: []
144
165
  require_paths:
145
166
  - lib
@@ -147,15 +168,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
168
  requirements:
148
169
  - - ">="
149
170
  - !ruby/object:Gem::Version
150
- version: '0'
171
+ version: 2.5.0
172
+ - - "<"
173
+ - !ruby/object:Gem::Version
174
+ version: 3.2.0
151
175
  required_rubygems_version: !ruby/object:Gem::Requirement
152
176
  requirements:
153
177
  - - ">="
154
178
  - !ruby/object:Gem::Version
155
179
  version: '0'
156
180
  requirements: []
157
- rubygems_version: 3.0.6
158
- signing_key:
181
+ rubygems_version: 3.1.4
182
+ signing_key:
159
183
  specification_version: 4
160
184
  summary: Ruby gem for PlagScan plagiarism APIs
161
185
  test_files: []
data/.travis.yml DELETED
@@ -1,30 +0,0 @@
1
- language: ruby
2
-
3
- env:
4
- global:
5
- - CC_TEST_REPORTER_ID=1e550d84766c7d7d61b7fb36d672a9cf6834600715a798b90e6a66d48574f592
6
-
7
- rvm:
8
- - 2.3
9
- - 2.4
10
- - 2.5
11
- - 2.6
12
-
13
- before_install:
14
- - gem update bundler
15
-
16
- install:
17
- - bundle install --jobs=3 --retry=3
18
- - gem install rubocop
19
-
20
- before_script:
21
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22
- - chmod +x ./cc-test-reporter
23
- - ./cc-test-reporter before-build
24
-
25
- script:
26
- - rubocop
27
- - bundle exec rake
28
-
29
- after_script:
30
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT