checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: 2127487f273cb1dc5b45d7571465bfa129c284fd6e7952be9f849fe40af01961
4
- data.tar.gz: e285ec1601bd3e3e0f05cc29b698b46620dfcbebdb39971f36fdb98a21e78224
3
+ metadata.gz: 23b89dfff549230388cfa7a7ce7036d144a634966772e6e7fe0b6c8047fba886
4
+ data.tar.gz: c4c73b11f7fa5030bcdb882ac547681c7195942c99ff560041eef40a64c51a4a
5
5
SHA512:
6
- metadata.gz: 770fab61fdd24d8ec9a7a76805fb939090858afdfd4237262cae40e43d0234c571363ffe5a99cadf926fe405afc006ab17a7f5e136acb1ccc0a06211b44a0378
7
- data.tar.gz: 38e719eda4185a53180bfd8fbeef79da80662c333a9f49fbc5769d2acc20bd56e389cfcdd3f4a08421ffe678980d6bed213eee9c2440cdc8a01c86c0c7fe9b0b
6
+ metadata.gz: 7fee157eb54c279e2f28203f602eed415205633ba33e093ae892de78410ad3e76992e566d450be4ee91d0e7ed4fdcf42adfdf07f84219d9adf2f02a8a4a0c317
7
+ data.tar.gz: b12160e32ab7cc6aa926b7f9b8a41f2e112eae2f4ff6da9354df03e33e83a280732da00b9a8f5ca4bb7cf914f4fe3cee6feea1ff1c425ad024aaaef81b4e38d7
data/.travis.yml CHANGED
@@ -1,5 +1,9 @@
1
1
language: ruby
2
2
3
+ env:
4
+ global:
5
+ - CC_TEST_REPORTER_ID=1e550d84766c7d7d61b7fb36d672a9cf6834600715a798b90e6a66d48574f592
6
+
3
7
rvm:
4
8
- 2.3
5
9
- 2.4
@@ -13,6 +17,14 @@ install:
13
17
- bundle install --jobs=3 --retry=3
14
18
- gem install rubocop
15
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
+
16
25
script:
17
26
- rubocop
18
27
- bundle exec rake
28
+
29
+ after_script:
30
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/CHANGELOG.md CHANGED
@@ -1,11 +1,18 @@
1
1
# Changelog
2
2
3
3
## Unreleased
4
- - none
4
+ ### Updated
5
+ - Support File params in body actions (multipart form)
6
+ - Include response body in invalid http response error message
7
+ - Symbolize names when parsing JSON response
8
+
9
+ ### Removed
10
+ - Unnecessary dependency for `rest-client` gem
5
11
6
12
## [0.0.2](releases/tag/v0.0.2) - 2019-08-14
7
- - Added support for `token` API
8
- - Added support for some `documents` APIs (create, check and retrieve)
13
+ ### Added
14
+ - Support for `token` API
15
+ - Support for some `documents` APIs (create, check and retrieve)
9
16
10
17
## [0.0.1](releases/tag/v0.0.1) - 2019-08-13
11
18
### Added
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![Travis Build Status](http://img.shields.io/travis/Studiosity/plagscan-ruby.svg?style=flat)](https://travis-ci.org/Studiosity/plagscan-ruby)
2
+ [![Maintainability](https://api.codeclimate.com/v1/badges/43ec9575fe4727b96adb/maintainability)](https://codeclimate.com/github/Studiosity/plagscan-ruby/maintainability)
3
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/43ec9575fe4727b96adb/test_coverage)](https://codeclimate.com/github/Studiosity/plagscan-ruby/test_coverage)
4
+ [![Gem Version](http://img.shields.io/gem/v/plagscan.svg?style=flat)](http://rubygems.org/gems/plagscan)
5
+
1
6
# PlagScan
2
7
3
8
Ruby wrapper for PlagScan plagiarism API
data/lib/plagscan/request.rb CHANGED
@@ -33,10 +33,10 @@ module Plagscan
33
33
response = Plagscan::Request.request(path, options)
34
34
35
35
unless response.is_a?(options[:expected_result] || Net::HTTPSuccess)
36
- raise Plagscan::HTTPError, "Invalid http response code: #{response.code}"
36
+ raise Plagscan::HTTPError, "Invalid http response: #{response.code} - #{response.body}"
37
37
end
38
38
39
- JSON.parse response.body
39
+ JSON.parse response.body, symbolize_names: true
40
40
rescue JSON::ParserError
41
41
raise Plagscan::JsonParseError, "PlagScan response parse error: #{response.body}"
42
42
end
@@ -83,8 +83,13 @@ module Plagscan
83
83
84
84
def add_body(request, body)
85
85
if body.is_a? Hash
86
- request.body = body.to_json
87
- request.content_type = 'application/json'
86
+ if body.any? { |_, v| v.is_a? File }
87
+ encoded_body = body.map { |k, v| [k.to_s, v.is_a?(File) ? v : v.to_s] }
88
+ request.set_form encoded_body, 'multipart/form-data'
89
+ else
90
+ request.body = body.to_json
91
+ request.content_type = 'application/json'
92
+ end
88
93
else
89
94
request.body = body.to_s
90
95
end
data/lib/plagscan/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
# frozen_string_literal: true
2
2
3
3
module Plagscan
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
end
data/plagscan.gemspec CHANGED
@@ -26,11 +26,11 @@ Gem::Specification.new do |spec|
26
26
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
spec.require_paths = ['lib']
28
28
29
- spec.add_runtime_dependency 'rest-client', '>= 1.4', '< 4.0'
30
29
spec.add_development_dependency 'bundler', '~> 2.0'
31
30
spec.add_development_dependency 'rake', '~> 10.0'
32
31
spec.add_development_dependency 'rspec', '~> 3.0'
33
32
spec.add_development_dependency 'rubocop', '~> 0.74'
34
33
spec.add_development_dependency 'rubocop-rspec', '~> 1.35'
34
+ spec.add_development_dependency 'simplecov', '~> 0.17'
35
35
spec.add_development_dependency 'webmock', '~> 3.0'
36
36
end
metadata CHANGED
@@ -1,36 +1,16 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: plagscan
3
3
version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
platform: ruby
6
6
authors:
7
7
- Andrew Bromwich
8
8
autorequire:
9
9
bindir: bin
10
10
cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2019-08-16 00:00:00.000000000 Z
12
12
dependencies:
13
13
- !ruby/object:Gem::Dependency
14
- name: rest-client
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.4'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '4.0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.4'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '4.0'
33
- - !ruby/object:Gem::Dependency
34
14
name: bundler
35
15
requirement: !ruby/object:Gem::Requirement
36
16
requirements:
@@ -101,6 +81,20 @@ dependencies:
101
81
- !ruby/object:Gem::Version
102
82
version: '1.35'
103
83
- !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.17'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.17'
97
+ - !ruby/object:Gem::Dependency
104
98
name: webmock
105
99
requirement: !ruby/object:Gem::Requirement
106
100
requirements: