plagscan 0.0.3 → 0.0.4

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: 23b89dfff549230388cfa7a7ce7036d144a634966772e6e7fe0b6c8047fba886
4
- data.tar.gz: c4c73b11f7fa5030bcdb882ac547681c7195942c99ff560041eef40a64c51a4a
3
+ metadata.gz: e91832aeeed75d754081b6a4c7a5e50866500a5b7520455c1eb9d50cd49f8ee3
4
+ data.tar.gz: ffcefc0444bb5a19f0dec3d08f1dc3c3c77398d16943f1d83a06cc6a265d05df
5
5
  SHA512:
6
- metadata.gz: 7fee157eb54c279e2f28203f602eed415205633ba33e093ae892de78410ad3e76992e566d450be4ee91d0e7ed4fdcf42adfdf07f84219d9adf2f02a8a4a0c317
7
- data.tar.gz: b12160e32ab7cc6aa926b7f9b8a41f2e112eae2f4ff6da9354df03e33e83a280732da00b9a8f5ca4bb7cf914f4fe3cee6feea1ff1c425ad024aaaef81b4e38d7
6
+ metadata.gz: 5371b817bde97eb33623f19374dab3a3998bba2a5da348f34df30594797781e646cb7e00401190ae6418b15210c0dc7c66855f8a7af22ea2d5bf74acecfe12e6
7
+ data.tar.gz: 6ad3e5d00a4e17cbe999aa3d7795ae2f02f09739d56d5bd187d4ff27a8d138a740a105b16a1867b0097f6fa9a8072cd039a25c847e8c4bd977b2ae1dc76a9de3
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  *.gem
2
2
  Gemfile.lock
3
+ coverage/
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
3
  ## Unreleased
4
+ - none
5
+
6
+ ## [0.0.4](releases/tag/v0.0.4) - 2019-12-31
7
+ ### Added
8
+ - Support for some `users` APIs (list and get)
9
+
10
+ ## [0.0.3](releases/tag/v0.0.3) - 2019-08-16
4
11
  ### Updated
5
12
  - Support File params in body actions (multipart form)
6
13
  - Include response body in invalid http response error message
data/README.md CHANGED
@@ -23,6 +23,64 @@ Or install it yourself as:
23
23
 
24
24
  $ gem install plagscan
25
25
 
26
+ # Supported APIs
27
+
28
+ ## Ping
29
+ #### Check if the PlagScan API is available
30
+ ```ruby
31
+ Plagscan.ping
32
+ => true
33
+ ```
34
+
35
+ ## Token
36
+ #### Authenticate and fetch `access_token` to use with other APIs
37
+ ```ruby
38
+ Plagscan::Token.fetch client_id: '1234', client_secret: 'secret'
39
+ => { access_token: 'secret_token', expires_in: 86400 }
40
+ ```
41
+
42
+ ## Documents
43
+ #### Upload documents to be checked by PlagScan
44
+ ```ruby
45
+ Plagscan::Documents.create access_token: 'secret_token', file: file
46
+ => { documentID: '1234', .... }
47
+ ```
48
+
49
+ N.B. you can also pass through the document as raw text using the `text` parameter in place of the `file` parameter.
50
+
51
+ Optional parameters for `userID`, `textname`, `toRepository` and `saveOrig`.
52
+ See [document create documentation](https://api.plagscan.com/v3docs/#api-Document-SubmitDocument)
53
+ for further details
54
+
55
+ #### Begin check of document uploaded to PlagScan
56
+ ```ruby
57
+ Plagscan::Documents.check access_token: 'secret_token', document_id: 1234
58
+ => nil
59
+ ```
60
+
61
+ #### Retrieve results of document scan
62
+ ```ruby
63
+ Plagscan::Documents.retrieve access_token: 'secret_token', document_id: 1234, mode: 0
64
+ => { ... }
65
+ ```
66
+ See [document retrieve documentation](https://api.plagscan.com/v3docs/#api-Document-RetrieveDocumentReport)
67
+ for further details
68
+
69
+ ## Users
70
+ #### List user details
71
+ ```ruby
72
+ Plagscan::Users.list access_token: 'secret_token'
73
+ => [{ ... }, { ... }, ...]
74
+ ```
75
+ See [user list documentation](https://api.plagscan.com/v3docs/#api-User-ListUser) for further details
76
+
77
+ #### Get user details
78
+ ```ruby
79
+ Plagscan::Users.get access_token: 'secret_token', user_id: 123456
80
+ => { ... }
81
+ ```
82
+ See [user get documentation](https://api.plagscan.com/v3docs/#api-User-GetUser) for further details
83
+
26
84
 
27
85
  # Development
28
86
 
@@ -15,6 +15,7 @@ require 'plagscan/request'
15
15
  require 'plagscan/ping'
16
16
  require 'plagscan/token'
17
17
  require 'plagscan/documents'
18
+ require 'plagscan/users'
18
19
 
19
20
  #
20
21
  # Basic configuration for PlagScan API
@@ -24,3 +25,8 @@ module Plagscan
24
25
  'https://api.plagscan.com/v3/'
25
26
  end
26
27
  end
28
+
29
+ #
30
+ # Alias `PlagScan` to `Plagscan`
31
+ #
32
+ PlagScan = Plagscan
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Plagscan
4
+ #
5
+ # PlagScan users API
6
+ #
7
+ class Users
8
+ #
9
+ # User get REST API
10
+ # @param [Number] start The start position of the list (optional)
11
+ # @param [Number] limit The limit of results returned (optional)
12
+ # @return [Array] containing array of data for Users
13
+ #
14
+ # For more details, see https://api.plagscan.com/v3docs/#api-User-ListUser
15
+ #
16
+ def self.list(access_token:, **options)
17
+ list_props = options.delete_if { |k, _| !%i[start limit].include? k }
18
+
19
+ Plagscan::Request.json_request(
20
+ 'users',
21
+ access_token: access_token, body: list_props
22
+ )&.[](:data)
23
+ end
24
+
25
+ #
26
+ # User get REST API
27
+ # @param [Number] user_id PlagScan user ID
28
+ # @return [Hash] containing data from a User
29
+ #
30
+ # For more details, see https://api.plagscan.com/v3docs/#api-User-GetUser
31
+ #
32
+ def self.get(access_token:, user_id:)
33
+ Plagscan::Request.json_request(
34
+ "users/#{user_id}",
35
+ access_token: access_token
36
+ )&.[](:data)
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plagscan
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  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.3
4
+ version: 0.0.4
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-16 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ files:
131
131
  - lib/plagscan/ping.rb
132
132
  - lib/plagscan/request.rb
133
133
  - lib/plagscan/token.rb
134
+ - lib/plagscan/users.rb
134
135
  - lib/plagscan/version.rb
135
136
  - plagscan.gemspec
136
137
  homepage: https://github.com/Studiosity/plagscan-ruby
@@ -153,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.7.6.2
157
+ rubygems_version: 3.0.6
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Ruby gem for PlagScan plagiarism APIs