passivetotal 0.1.0 → 0.2.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 +4 -4
- data/lib/passivetotal/api.rb +12 -1
- data/lib/passivetotal/cli.rb +2 -1
- data/lib/passivetotal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba999440914765150f5879f7e1477360c8004395
|
4
|
+
data.tar.gz: 4c5af19bed80397c721e95908500993825d15675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab4e9de47859d9a39ff2529701fdeb7bd71f625dfa62643a2ab043bca552c0e51a796401b008f7a1024a8f1f6acbe1aaec1e9c7c27e6f67338f5b6898130289
|
7
|
+
data.tar.gz: e7b9320ce2cd7638ee222220ed314de0c7044c5675273bc5be2b6e2fed643f568c36a324161a302cf3250b85f5d01207c95777275ba2095c57e79c18a4761a69
|
data/lib/passivetotal/api.rb
CHANGED
@@ -10,6 +10,10 @@ module PassiveTotal # :nodoc:
|
|
10
10
|
|
11
11
|
class InvalidAPIKeyError < ArgumentError; end
|
12
12
|
|
13
|
+
class Transaction < Struct.new(:query, :response, :response_time); end
|
14
|
+
class Query < Struct.new(:api, :query, :set, :url, :parameters); end
|
15
|
+
class Response < Struct.new(:json, :success, :request_time, :raw_query, :error, :result_count, :results); end
|
16
|
+
|
13
17
|
# The API class wraps the PassiveTotal.org web API for all the verbs that it supports
|
14
18
|
# See https://www.passivetotal.org/api/docs for the API documentation.
|
15
19
|
class API
|
@@ -273,7 +277,14 @@ module PassiveTotal # :nodoc:
|
|
273
277
|
response = http.request(request)
|
274
278
|
delta = (Time.now - t1).to_f
|
275
279
|
data = JSON.parse(response.body)
|
276
|
-
|
280
|
+
|
281
|
+
obj = Transaction.new(
|
282
|
+
Query.new(method, params['query'], params[method] || params['tag'], url, params),
|
283
|
+
Response.new(response.body, data['success'], data['request_time'], data['raw_query'], data['error'], data['result_count'], data['results']),
|
284
|
+
delta
|
285
|
+
)
|
286
|
+
|
287
|
+
return obj
|
277
288
|
end
|
278
289
|
|
279
290
|
# tests an item to see if it matches a valid type
|
data/lib/passivetotal/cli.rb
CHANGED
@@ -148,7 +148,8 @@ module PassiveTotal # :nodoc:
|
|
148
148
|
else
|
149
149
|
data = pt.send(options[:method], options[:query])
|
150
150
|
end
|
151
|
-
|
151
|
+
data.response.results['response_time'] = data.query.response_time
|
152
|
+
return JSON.pretty_generate(data.response.results)
|
152
153
|
end
|
153
154
|
return ''
|
154
155
|
end
|
data/lib/passivetotal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passivetotal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrislee35
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|