virustotal_api 0.5.0 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require './test/test_helper'
4
+
5
+ class VirustotalAPIGroupReportTest < Minitest::Test
6
+ def setup
7
+ @group_id = 'GROUP_us'
8
+ @api_key = 'testapikey'
9
+ end
10
+
11
+ def test_class_exists
12
+ assert VirustotalAPI::Group
13
+ end
14
+
15
+ def test_report_response
16
+ VCR.use_cassette('group_find') do
17
+ vtgroup_report = VirustotalAPI::Group.find(@group_id, @api_key)
18
+
19
+ # Make sure that the JSON was parsed
20
+ assert vtgroup_report.exists?
21
+ assert vtgroup_report.is_a?(VirustotalAPI::Group)
22
+ assert vtgroup_report.report.is_a?(Hash)
23
+ assert vtgroup_report.id.is_a?(String)
24
+ assert vtgroup_report.report_url.is_a?(String)
25
+ end
26
+ end
27
+ end
data/test/ip_test.rb CHANGED
@@ -19,6 +19,8 @@ class VirustotalAPIIPReportTest < Minitest::Test
19
19
  # Make sure that the JSON was parsed
20
20
  assert vtip_report.is_a?(VirustotalAPI::IP)
21
21
  assert vtip_report.report.is_a?(Hash)
22
+ assert vtip_report.id.is_a?(String)
23
+ assert vtip_report.report_url.is_a?(String)
22
24
  end
23
25
  end
24
26
  end
data/test/url_test.rb CHANGED
@@ -18,24 +18,11 @@ class VirustotalAPIURLReportTest < Minitest::Test
18
18
  vturl_report = VirustotalAPI::URL.find(@url, @api_key)
19
19
 
20
20
  # Make sure that the JSON was parsed
21
+ assert vturl_report.exists?
21
22
  assert vturl_report.is_a?(VirustotalAPI::URL)
22
23
  assert vturl_report.report.is_a?(Hash)
23
- end
24
- end
25
-
26
- def test_find
27
- VCR.use_cassette('url_find') do
28
- vturl_report = VirustotalAPI::URL.find(@url, @api_key)
29
-
30
- assert vturl_report.report_url.is_a?(String)
31
- end
32
- end
33
-
34
- def test_scan_url
35
- VCR.use_cassette('url_find') do
36
- vturl_report = VirustotalAPI::URL.find(@url, @api_key)
37
-
38
24
  assert vturl_report.id.is_a?(String)
25
+ assert vturl_report.report_url.is_a?(String)
39
26
  end
40
27
  end
41
28
 
@@ -43,23 +30,18 @@ class VirustotalAPIURLReportTest < Minitest::Test
43
30
  VCR.use_cassette('unscanned_url_find') do
44
31
  vturl_report = VirustotalAPI::URL.find(@unscanned_url, @api_key)
45
32
 
46
- assert_nil vturl_report.report
33
+ assert !vturl_report.exists?
34
+ assert_empty vturl_report.report
47
35
  end
48
36
  end
49
37
 
50
38
  def test_analyse
51
39
  VCR.use_cassette('url_analyse') do
52
- vturl_scan = VirustotalAPI::URL.analyse(@url, @api_key)
53
-
54
- assert vturl_scan.report.is_a?(Hash)
55
- end
56
- end
57
-
58
- def test_analyse_id
59
- VCR.use_cassette('url_analyse') do
60
- vturl_scan = VirustotalAPI::URL.analyse(@url, @api_key)
40
+ vturl_analyse = VirustotalAPI::URL.analyse(@url, @api_key)
61
41
 
62
- assert vturl_scan.id.is_a?(String)
42
+ assert vturl_analyse.exists?
43
+ assert vturl_analyse.report.is_a?(Hash)
44
+ assert vturl_analyse.id.is_a?(String)
63
45
  end
64
46
  end
65
47
  end
data/test/user_test.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require './test/test_helper'
4
+
5
+ class VirustotalAPIUserReportTest < Minitest::Test
6
+ def setup
7
+ @api_key = 'testapikey'
8
+ end
9
+
10
+ def test_class_exists
11
+ assert VirustotalAPI::User
12
+ end
13
+
14
+ def test_report_response
15
+ VCR.use_cassette('user_find') do
16
+ vtuser_report = VirustotalAPI::User.find(@api_key, @api_key)
17
+
18
+ # Make sure that the JSON was parsed
19
+ assert vtuser_report.exists?
20
+ assert vtuser_report.is_a?(VirustotalAPI::User)
21
+ assert vtuser_report.report.is_a?(Hash)
22
+ assert vtuser_report.id.is_a?(String)
23
+ assert vtuser_report.report_url.is_a?(String)
24
+ end
25
+ end
26
+ end
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/pwelch/virustotal_api'
15
15
  spec.license = 'MIT'
16
16
 
17
- spec.required_ruby_version = '>= 2.6'
17
+ spec.required_ruby_version = '>= 2.5'
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0")
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virustotal_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - pwelch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-24 00:00:00.000000000 Z
11
+ date: 2021-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -181,10 +181,11 @@ executables: []
181
181
  extensions: []
182
182
  extra_rdoc_files: []
183
183
  files:
184
- - ".circleci/config.yml"
185
184
  - ".github/CODE_OF_CONDUCT.md"
186
185
  - ".github/CONTRIBUTING.md"
187
- - ".github/ISSUE_TEMPLATE.md"
186
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
187
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
188
+ - ".github/pull_request_template.md"
188
189
  - ".github/workflows/ruby.yml"
189
190
  - ".gitignore"
190
191
  - ".rubocop.yml"
@@ -199,9 +200,11 @@ files:
199
200
  - lib/virustotal_api/domain.rb
200
201
  - lib/virustotal_api/exceptions.rb
201
202
  - lib/virustotal_api/file.rb
203
+ - lib/virustotal_api/group.rb
202
204
  - lib/virustotal_api/ip.rb
203
205
  - lib/virustotal_api/uri.rb
204
206
  - lib/virustotal_api/url.rb
207
+ - lib/virustotal_api/user.rb
205
208
  - lib/virustotal_api/version.rb
206
209
  - test/analysis_test.rb
207
210
  - test/base_test.rb
@@ -210,19 +213,27 @@ files:
210
213
  - test/file_test.rb
211
214
  - test/fixtures/analysis.yml
212
215
  - test/fixtures/domain.yml
216
+ - test/fixtures/domain_bad_request.yml
213
217
  - test/fixtures/file_analyse.yml
214
218
  - test/fixtures/file_find.yml
219
+ - test/fixtures/file_not_found.yml
220
+ - test/fixtures/file_rate_limit.yml
215
221
  - test/fixtures/file_unauthorized.yml
216
222
  - test/fixtures/file_upload.yml
223
+ - test/fixtures/group_find.yml
217
224
  - test/fixtures/ip.yml
225
+ - test/fixtures/large_file_upload.yml
218
226
  - test/fixtures/null_file
219
227
  - test/fixtures/unscanned_url_find.yml
220
228
  - test/fixtures/url_analyse.yml
221
229
  - test/fixtures/url_find.yml
230
+ - test/fixtures/user_find.yml
231
+ - test/group_test.rb
222
232
  - test/ip_test.rb
223
233
  - test/test_helper.rb
224
234
  - test/uri_test.rb
225
235
  - test/url_test.rb
236
+ - test/user_test.rb
226
237
  - test/version_test.rb
227
238
  - virustotal_api.gemspec
228
239
  homepage: https://github.com/pwelch/virustotal_api
@@ -237,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
248
  requirements:
238
249
  - - ">="
239
250
  - !ruby/object:Gem::Version
240
- version: '2.6'
251
+ version: '2.5'
241
252
  required_rubygems_version: !ruby/object:Gem::Requirement
242
253
  requirements:
243
254
  - - ">="
@@ -256,17 +267,25 @@ test_files:
256
267
  - test/file_test.rb
257
268
  - test/fixtures/analysis.yml
258
269
  - test/fixtures/domain.yml
270
+ - test/fixtures/domain_bad_request.yml
259
271
  - test/fixtures/file_analyse.yml
260
272
  - test/fixtures/file_find.yml
273
+ - test/fixtures/file_not_found.yml
274
+ - test/fixtures/file_rate_limit.yml
261
275
  - test/fixtures/file_unauthorized.yml
262
276
  - test/fixtures/file_upload.yml
277
+ - test/fixtures/group_find.yml
263
278
  - test/fixtures/ip.yml
279
+ - test/fixtures/large_file_upload.yml
264
280
  - test/fixtures/null_file
265
281
  - test/fixtures/unscanned_url_find.yml
266
282
  - test/fixtures/url_analyse.yml
267
283
  - test/fixtures/url_find.yml
284
+ - test/fixtures/user_find.yml
285
+ - test/group_test.rb
268
286
  - test/ip_test.rb
269
287
  - test/test_helper.rb
270
288
  - test/uri_test.rb
271
289
  - test/url_test.rb
290
+ - test/user_test.rb
272
291
  - test/version_test.rb
data/.circleci/config.yml DELETED
@@ -1,23 +0,0 @@
1
- version: 2
2
- jobs:
3
- test:
4
- docker:
5
- - image: circleci/ruby:2.5.3-stretch
6
- steps:
7
- - checkout
8
- - run:
9
- name: Setup
10
- command: |
11
- gem update bundler
12
- bundle install
13
- - run:
14
- name: Rubocop
15
- command: bundle exec rake rubocop
16
- - run:
17
- name: Run Tests
18
- command: bundle exec rake test
19
- workflows:
20
- version: 2
21
- test:
22
- jobs:
23
- - test
@@ -1,15 +0,0 @@
1
- ## Expected Behavior
2
-
3
-
4
- ## Actual Behavior
5
-
6
-
7
- ## Steps to Reproduce the Problem
8
-
9
- 1.
10
-
11
- ## Specifications
12
-
13
- - Version:
14
- - Platform:
15
- - Subsystem: