ruby-deepviz 1.1.1 → 2.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a44b01fa727f0399b883d01335d5dc16f1fba6fe
4
- data.tar.gz: da7bbe5af9c42701c3482bf555c63aa590960d35
3
+ metadata.gz: 315585d0473d6645a28885fe73792f08ef8b6761
4
+ data.tar.gz: 28abe1ebaa5fe667e3244ed65f2b65216450ff27
5
5
  SHA512:
6
- metadata.gz: 00bc1d775013fb84b31dfc056c7a7102193cde2da6caf33ab639db5a42e26708e48e4059da31f87925a0aadc6e2f196d6a7211c76921a0c2ecdba236afe416e3
7
- data.tar.gz: c3d5ef4da194adab29d1774c5e5cd830d8be91b3c9d357ed73ecba8f8c180e2f3bc24bded69a003eeb1fb79df4d50ac34a06ff6e1011906b4dacf48041cfdcd7
6
+ metadata.gz: dd125a0812e4c121986638250f058f3cb09643ca3f9dba303e6150f7bd852c1247ad906995bea146bd0d4a364429509ca7ff8705fe1a23ca2ad6c00204614625
7
+ data.tar.gz: 1e908fb70c7830624b0d7af1e10425b06ffe7187fda6c98c65bae3525613094c11cb8d90f2328225a8e66ba6c9dd1343ac5a12283cfb97c90c5c0b9845f554fd
@@ -8,116 +8,65 @@ class Intel
8
8
  URL_INTEL_DOMAIN = 'https://api.deepviz.com/intel/network/domain'
9
9
  URL_INTEL_SEARCH_ADVANCED = 'https://api.deepviz.com/intel/search/advanced'
10
10
 
11
- def ip_info(api_key, options={})
11
+ def ip_info(api_key, ip, filters=nil)
12
12
  if api_key == nil or api_key == ''
13
13
  return Result.new(status=INPUT_ERROR, msg='API key cannot be null or empty String')
14
14
  end
15
15
 
16
- defaults = {
17
- :ip => nil,
18
- :history => false,
19
- :time_delta => nil,
20
- }
21
-
22
- options = defaults.merge(options)
23
-
24
- if (!options['ip'].kind_of?(Array) and (options['time_delta'] == nil or options['time_delta'] == '')) or (options['ip'].kind_of?(Array) and options['time_delta'] != nil and options['time_delta'] != '')
25
- msg = 'Parameters missing or invalid. You must specify either a list of IPs or time delta'
16
+ if ip.nil? or ip == ''
17
+ msg = 'Parameters missing or invalid. You must specify an IP.'
26
18
  return Result.new(status=INPUT_ERROR, msg=msg)
27
19
  end
28
20
 
29
- if options['history']
30
- _history = 'true'
31
- else
32
- _history = 'false'
21
+ if filters != nil and !filters.kind_of?(Array)
22
+ msg = 'You must provide one or more output filters in a list'
23
+ return Result.new(status=INPUT_ERROR, msg=msg)
33
24
  end
34
25
 
35
- if options['ip'] != nil and !options['ip'].kind_of?(Array)
36
- msg = 'You must provide one or more IPs in a list'
37
- return Result.new(status=INPUT_ERROR, msg=msg)
38
- else
26
+ if filters != nil
39
27
  body = {
40
- :ip => options['ip'],
41
- :history => _history,
28
+ :output_filters => filters,
42
29
  :api_key => api_key,
30
+ :ip => ip,
43
31
  }
44
- end
45
-
46
- if options['time_delta'] != nil and options['time_delta'] != ''
32
+ else
47
33
  body = {
48
- :time_delta => options['time_delta'],
49
- :history => _history,
50
34
  :api_key => api_key,
35
+ :ip => ip,
51
36
  }
52
37
  end
53
38
 
54
39
  return do_post(body, URL_INTEL_IP)
55
40
  end
56
41
 
57
- def domain_info(api_key, options={})
58
- if api_key == nil or api_key == ''
42
+
43
+ def domain_info(api_key, domain, filters = nil)
44
+ if api_key.nil? or api_key == ''
59
45
  return Result.new(status=INPUT_ERROR, msg='API key cannot be null or empty String')
60
46
  end
61
47
 
62
- defaults = {
63
- :domain => nil,
64
- :filters => nil,
65
- :history => false,
66
- :time_delta => nil,
67
- }
68
-
69
- options = defaults.merge(options)
70
48
 
71
- if (!options['domain'].kind_of?(Array) and (options['time_delta'] == nil or options['time_delta'] == '')) or (options['domain'].kind_of?(Array) and options['time_delta'] != nil and options['time_delta'] != '')
72
- msg = 'Parameters missing or invalid. You must specify either a list of domains or time delta'
49
+ if domain.nil? or domain == ''
50
+ msg = 'Parameters missing or invalid. You must specify an domain.'
73
51
  return Result.new(status=INPUT_ERROR, msg=msg)
74
52
  end
75
53
 
76
- if options['history']
77
- _history = 'true'
78
- else
79
- _history = 'false'
80
- end
81
-
82
- if options['filters'] != nil and !options['filters'].kind_of?(Array)
54
+ if filters != nil and !filters.kind_of?(Array)
83
55
  msg = 'You must provide one or more output filters in a list'
84
56
  return Result.new(status=INPUT_ERROR, msg=msg)
85
57
  end
86
58
 
87
- body = {}
88
-
89
- if options['domain'].kind_of?(Array)
90
- if options['filters'] != nil
91
- body = {
92
- :output_filters => options['filters'],
93
- :domain => options['domain'],
94
- :history => _history,
95
- :api_key => api_key,
96
- }
97
- else
98
- body = {
99
- :domain => options['domain'],
100
- :history => _history,
101
- :api_key => api_key,
102
- }
103
- end
104
- end
105
-
106
- if options['time_delta'] != nil and options['time_delta'] != ''
107
- if options['filters'] != nil
108
- body = {
109
- :time_delta => options['time_delta'],
110
- :output_filters => options['filters'],
111
- :history => _history,
59
+ if filters != nil
60
+ body = {
61
+ :output_filters => filters,
112
62
  :api_key => api_key,
113
- }
114
- else
115
- body = {
116
- :time_delta => options['time_delta'],
117
- :history => _history,
63
+ :domain => domain,
64
+ }
65
+ else
66
+ body = {
118
67
  :api_key => api_key,
119
- }
120
- end
68
+ :domain => domain,
69
+ }
121
70
  end
122
71
 
123
72
  return do_post(body, URL_INTEL_DOMAIN)
@@ -299,5 +248,4 @@ class Intel
299
248
  end
300
249
 
301
250
  private :do_post
302
- end
303
-
251
+ end
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-deepviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saferbytes S.r.l.s.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.12.a
19
+ version: '1.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.12.a
26
+ version: '1.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '11.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '11.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: unirest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.2.2
84
+ rubygems_version: 2.5.1
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: ruby-deepviz is a Ruby wrapper for deepviz.com REST APIs