virus_scan_service 0.0.8 → 0.1.0

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
  SHA1:
3
- metadata.gz: 371745c9fa7656ebc95bff2a471861961978f3eb
4
- data.tar.gz: 6149799e687ed9a11730e558606fd854936c65a4
3
+ metadata.gz: c7812a4d3d7f5f6d41008eadba3e0adb2910ed9f
4
+ data.tar.gz: 0f61de10f3e3f73a1a5bc6cacb48572351b77548
5
5
  SHA512:
6
- metadata.gz: 92f8d01f68a75caefaedf6dd19cdf21107ec3b70fc5a36da5000b1db71d4728e49f73e8dab5afd506add7a84d36b0aa352df70c4002b48f863ada8962918ef30
7
- data.tar.gz: ce4c379926311585102ec0053f63dc07f9e4b21818809e0f93f0bdbebebf3cd2968ec1b611b976d2ba023f30c9268f08047737b1c93eebbec2e392a6651492b4
6
+ metadata.gz: 0635159920ccc7b052bcd0a4629d4ef2457e70d29f056cc34cbaf20a58e22402642be52ee1a4d8b5008848ebb9fa3b60873757ad7b1858bcda2da48bfba9c581
7
+ data.tar.gz: b7a9cac97858a7ac03cc84929b13a753797bf4c7fcce4987d57d397018f3af738d931e1e54e1d0a1bbe430b9efa1e5c071199df521b5f87e79d163cf9baf127c
data/README.md CHANGED
@@ -9,7 +9,11 @@ files to be scanned from your application server, lunch antivirus check (current
9
9
  Kasperky Endponit Security runner Windows or Linux) and send scan result
10
10
  back to server.
11
11
 
12
- You don't need to have this script running on the same server
12
+ If you want to use difrent antivirus (like `ClamAV`) that's fine,
13
+ but you will have to implement your own runner `:)`.
14
+ Pull requests are welcome.
15
+
16
+ You don't need to have script running this service on the same server
13
17
  as application server VM. (Article comming soon)
14
18
 
15
19
  Originaly built to work along [witch_doctor engine gem](https://github.com/equivalent/witch_doctor)
@@ -21,7 +25,7 @@ is provide API that this secvice can comunicate with:
21
25
  response
22
26
 
23
27
  ```json
24
- [{"id":"123","scan_result":"","file_url":"http://thisis.test/download/file.png"}]
28
+ {"data":[{"id":"123","scan_result":"","file_url":"http://thisis.test/download/file.png"}]}
25
29
  ```
26
30
 
27
31
  #### PUT `/wd/virus_scans/123` `ContentType: application/json`
@@ -35,11 +39,14 @@ request body
35
39
  response
36
40
 
37
41
  ```json
38
- {"id":"123","scan_result":"Clean","file_url":"http://thisis.test/download/file.png"}
42
+ {"data":{"id":"123","scan_result":"Clean","file_url":"http://thisis.test/download/file.png"}}
39
43
  ```
40
44
 
41
45
  For more examples check `spec/courier_spec.rb`, `spec/support/request_response_mocks.rb
42
46
 
47
+ ## JSON API
48
+
49
+ gem is implementing [JSON API standard](http://jsonapi.org/)
43
50
 
44
51
  ## Statuses
45
52
 
@@ -18,8 +18,8 @@ module VirusScanService
18
18
  scheduled_scans
19
19
  .first(num_of_scans)
20
20
  .each do |scheduled_scan|
21
- resoult = yield(scheduled_scan.fetch('file_url'))
22
- update_scan_result(scheduled_scan.fetch('id'), resoult)
21
+ result = yield(scheduled_scan.fetch('file_url'))
22
+ update_scan_result(scheduled_scan.fetch('id'), result)
23
23
  end
24
24
  end
25
25
 
@@ -68,7 +68,9 @@ module VirusScanService
68
68
 
69
69
  def json(body)
70
70
  logger.debug "Response body #{body}"
71
- JSON.parse(body)
71
+ JSON
72
+ .parse(body)
73
+ .fetch("data")
72
74
  end
73
75
 
74
76
  def check_status(response)
@@ -1,3 +1,3 @@
1
1
  module VirusScanService
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
data/spec/courier_spec.rb CHANGED
@@ -11,11 +11,11 @@ RSpec.describe VirusScanService::Courier do
11
11
 
12
12
  before do
13
13
  server_response_list do
14
- '[{"id":"123","scan_result":"","file_url":"http://thisis.test/download/file.png"}]'
14
+ '{"data":[{"id":"123","scan_result":"","file_url":"http://thisis.test/download/file.png"}]}'
15
15
  end
16
16
 
17
17
  server_request_put(id: 123, status: 'Clean') do
18
- '{"id":"123","scan_result":"Clean","file_url":"http://thisis.test/download/file.png"}'
18
+ '{"data":{"id":"123","scan_result":"Clean","file_url":"http://thisis.test/download/file.png"}}'
19
19
  end
20
20
  end
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virus_scan_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Valent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -166,3 +166,4 @@ test_files:
166
166
  - spec/support/dummy_viruscheck_runner.rb
167
167
  - spec/support/null_logger.rb
168
168
  - spec/support/request_response_mocks.rb
169
+ has_rdoc: