metascan 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scan.rb +7 -3
  3. data/metascan.rb +3 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8b106f508db192aa4466c1a3d02026eff07f26f
4
- data.tar.gz: 41e9c4da741cba423929530e55bd010af0f4cbf8
3
+ metadata.gz: 9e7ce42d8d9d26760f48a2156c5e62cbbbe922bf
4
+ data.tar.gz: c696294c89fe68d24c77fd469478802e15a0dbd1
5
5
  SHA512:
6
- metadata.gz: 4abbce86ee4991ab4f081741eb897fa73830b70b0ff5c654e6bb71a3f7792eb18b58c459078a9472d3fcea4b18a80abb42a2da99f56168e54d9302162d06972b
7
- data.tar.gz: abffaaa71c84dae9b6d547ec1c351f23353060a97008c05e65e0fd7063a967aa59c9ffe762bb32355bc5a26da1fc1d7dd8ee4931c68d06cbf0e944a96e830c16
6
+ metadata.gz: 76f78211a4fdb26981a2869bdb1ff3d3d37236d55ab5545a953b01afd210b149f7218d15b16d5465e3a1dd0cb4e049e61e0ffb7359fdd3648d28b8411ef8e2a7
7
+ data.tar.gz: 1fb2f6ed91db69ecc86e2cd211420527035a95acebc4f116142ea109d52a8c05ab8c22b33d25a015cb8fac0c2db1b0b4ce7743547c755bd557c35f655f7b8c26
data/lib/scan.rb CHANGED
@@ -37,15 +37,19 @@ module Metascan
37
37
 
38
38
  request.on_complete do |r|
39
39
  @data_id = JSON.parse(r.body)["data_id"]
40
+ @rest_ip = JSON.parse(r.body)["rest_ip"].split(":")[0] + '/v2/file'
40
41
  end
41
-
42
42
  request
43
43
  end
44
44
 
45
45
  # Returns true iff the Metascan virus scan found no threats.
46
46
  # If POLL is true (false by default) then retrieve_results first.
47
47
  def clean?(poll: false)
48
- self.results(poll: poll)["scan_results"]["scan_all_result_i"] == 0
48
+ if self.results(poll: poll)["scan_results"]["progress_percentage"] < 100 then
49
+ nil
50
+ else
51
+ self.results(poll: poll)["scan_results"]["scan_all_result_i"] == 0
52
+ end
49
53
  end
50
54
 
51
55
  # Only useful for testing.
@@ -69,7 +73,7 @@ module Metascan
69
73
  # my Batch runs me)
70
74
  def retrieve_results
71
75
  request = Typhoeus::Request.new(
72
- Metascan::PATHS[:results_by_data_id] + @data_id,
76
+ @rest_ip + '/' + @data_id,
73
77
  headers: {
74
78
  'apikey' => @client.api_key
75
79
  },
data/metascan.rb CHANGED
@@ -5,9 +5,9 @@ module Metascan
5
5
 
6
6
  # Paths to use for api calls.
7
7
  PATHS = {
8
- :scan_file => "https://api.metascan-online.com/v1/file",
9
- :results_by_data_id => "https://api.metascan-online.com/v1/file/",
10
- :results_by_file_hash => "https://api.metascan-online.com/v1/hash/"
8
+ :scan_file => "https://scan.metascan-online.com/v2/file",
9
+ :results_by_data_id => "https://scan.metascan-online.com/v2/file",
10
+ :results_by_file_hash => "https://hashlookup.metascan-online.com/v2/hash"
11
11
  }
12
12
 
13
13
  # a miserable pile of library classes!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metascan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grayson Chao
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.0.3
85
+ rubygems_version: 2.0.14
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Scan files for viruses using the Metascan public API.