virustotalx 0.1.0 → 0.1.1

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: 81764924df363de73f62d4368dc94e147e127191600079c6469c3395d15b54fa
4
- data.tar.gz: 9afc5ef8eaecf1dbfec5db769e744cfaa605f185b04449a5443fa74acf5014ff
3
+ metadata.gz: 18dd7bc4a5890a35b197f8ce635e736dec2507a9af5405cee5289dd7b2713ea2
4
+ data.tar.gz: d4d8c7ce2a065cfc287b8f376d8a15128542a7e1ad95db3f4d0000a32a721bce
5
5
  SHA512:
6
- metadata.gz: c8ae7d801c06e49e166a8fce75a637dee7bef7d985758f5d01ecd0ebbcd515850c12961f13554f6caf0372b5f236acaa9651a5d359cd5174bfecba79814a777e
7
- data.tar.gz: 7c5866ffd1eed670f9e0da74db74446b18e648f12497c6cdb08c5b8fac1ff260e7a04cb7c5d3f7f10a1878295227b7f523683cd5df90b88c17cddd04dd06b989
6
+ metadata.gz: 1b2b3ca2a70c7861dcf9c04c8570134157bc0bda833bbac8e25cdc10378968e0cbf075bc80d8523537c1f8398e24f005dae4da7d26ca48d69ef874d1d0942b29
7
+ data.tar.gz: a6d86db493ba0045bed293681be7a7d640dbcec2c3bd795bdefd5f666b3dc7d53465b6c15d7268d82044f537c74add8a512d51449fbe06629867415029164cfc
data/.gitignore CHANGED
@@ -42,6 +42,9 @@ build-iPhoneSimulator/
42
42
 
43
43
  # for a library or gem, you might want to ignore these files since the code is
44
44
  # intended to run in multiple environments; otherwise, check them in:
45
+ Gemfile.lock
46
+ .ruby-version
47
+ .ruby-gemset
45
48
 
46
49
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
47
50
  .rvmrc
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # virustotalx
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/virustotalx.svg)](https://badge.fury.io/rb/virustotalx)
3
4
  [![Build Status](https://travis-ci.org/ninoseki/virustotalx.svg?branch=master)](https://travis-ci.org/ninoseki/virustotalx)
4
5
  [![Coverage Status](https://coveralls.io/repos/github/ninoseki/virustotalx/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/virustotalx?branch=master)
5
6
 
@@ -40,6 +41,10 @@ api.url.scan("https://github.com/ninoseki/virustotalx")
40
41
  api.domain.report("github.com")
41
42
 
42
43
  api.ip_address.report("1.1.1.1")
44
+
45
+ # it returns nil when given a non-existing resource to #report methods
46
+ api.domain.report("a_domain_which_does_not_exist.com")
47
+ # => nil
43
48
  ```
44
49
 
45
50
  See `/spec/clients` for more.
@@ -93,6 +93,11 @@ module VirusTotal
93
93
 
94
94
  request(post, &block)
95
95
  end
96
+
97
+ def handle_response_code(json)
98
+ response_code = json.dig("response_code").to_i
99
+ response_code.zero? ? nil : json
100
+ end
96
101
  end
97
102
  end
98
103
  end
@@ -4,7 +4,9 @@ module VirusTotal
4
4
  module Client
5
5
  class Domain < Base
6
6
  def report(domain)
7
- get("/domain/report", domain: domain) { |json| json }
7
+ get("/domain/report", domain: domain) do |json|
8
+ handle_response_code json
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -5,7 +5,9 @@ module VirusTotal
5
5
  class File < Base
6
6
  def report(resource, allinfo: nil)
7
7
  params = { resource: resource, allinfo: allinfo }.compact
8
- post("/file/report", params) { |json| json }
8
+ post("/file/report", params) do |json|
9
+ handle_response_code json
10
+ end
9
11
  end
10
12
 
11
13
  def scan(path)
@@ -4,7 +4,9 @@ module VirusTotal
4
4
  module Client
5
5
  class IPAddress < Base
6
6
  def report(ip)
7
- get("/ip-address/report", ip: ip) { |json| json }
7
+ get("/ip-address/report", ip: ip) do |json|
8
+ handle_response_code json
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -5,7 +5,9 @@ module VirusTotal
5
5
  class URL < Base
6
6
  def report(resource, allinfo: nil)
7
7
  params = { resource: resource, allinfo: allinfo }.compact
8
- post("/url/report", params) { |json| json }
8
+ post("/url/report", params) do |json|
9
+ handle_response_code json
10
+ end
9
11
  end
10
12
 
11
13
  def scan(url)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VirusTotal
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virustotalx
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
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,7 +105,6 @@ files:
105
105
  - ".rspec"
106
106
  - ".travis.yml"
107
107
  - Gemfile
108
- - Gemfile.lock
109
108
  - LICENSE
110
109
  - README.md
111
110
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,67 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- virustotalx (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- addressable (2.6.0)
10
- public_suffix (>= 2.0.2, < 4.0)
11
- coveralls (0.8.23)
12
- json (>= 1.8, < 3)
13
- simplecov (~> 0.16.1)
14
- term-ansicolor (~> 1.3)
15
- thor (>= 0.19.4, < 2.0)
16
- tins (~> 1.6)
17
- crack (0.4.3)
18
- safe_yaml (~> 1.0.0)
19
- diff-lcs (1.3)
20
- docile (1.3.1)
21
- hashdiff (0.3.9)
22
- json (2.2.0)
23
- public_suffix (3.0.3)
24
- rake (12.3.2)
25
- rspec (3.8.0)
26
- rspec-core (~> 3.8.0)
27
- rspec-expectations (~> 3.8.0)
28
- rspec-mocks (~> 3.8.0)
29
- rspec-core (3.8.0)
30
- rspec-support (~> 3.8.0)
31
- rspec-expectations (3.8.3)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.8.0)
34
- rspec-mocks (3.8.0)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.8.0)
37
- rspec-support (3.8.0)
38
- safe_yaml (1.0.5)
39
- simplecov (0.16.1)
40
- docile (~> 1.1)
41
- json (>= 1.8, < 3)
42
- simplecov-html (~> 0.10.0)
43
- simplecov-html (0.10.2)
44
- term-ansicolor (1.7.1)
45
- tins (~> 1.0)
46
- thor (0.20.3)
47
- tins (1.20.2)
48
- vcr (4.0.0)
49
- webmock (3.5.1)
50
- addressable (>= 2.3.6)
51
- crack (>= 0.3.2)
52
- hashdiff
53
-
54
- PLATFORMS
55
- ruby
56
-
57
- DEPENDENCIES
58
- bundler (~> 2.0)
59
- coveralls (~> 0.8)
60
- rake (~> 12.3)
61
- rspec (~> 3.8)
62
- vcr (~> 4.0)
63
- virustotalx!
64
- webmock (~> 3.5)
65
-
66
- BUNDLED WITH
67
- 2.0.1