sonar-client 0.0.6 → 0.0.7
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/README.md +13 -0
- data/lib/sonar/cli/cli.rb +1 -1
- data/lib/sonar/request.rb +1 -0
- data/lib/sonar/version.rb +1 -1
- data/spec/sonar/search_spec.rb +2 -2
- 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: 15839192f17588137b628922b797277e51fe1a4a
|
4
|
+
data.tar.gz: 952a6e55b998608df85d565e5d6bda643e09b2dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 367276131352b48040143cd3b7d5894475fda23c2020fd28efa56452a92af79e89b8f84830ae9132d44ca1ea26c3d2f3d3eb6d7f9bec91f6e28d80faebcc41c5
|
7
|
+
data.tar.gz: aaf7ac557f0f5622ee9a5c3e46db451b63e3470fd1279b712da2669fea2af75fcab91ac892c43855ad416a86728e1a5e870c2935e50cfed06932c657858c71d1
|
data/README.md
CHANGED
@@ -50,6 +50,19 @@ And then execute:
|
|
50
50
|
# => responds with a Hashie object
|
51
51
|
```
|
52
52
|
|
53
|
+
## Running the specs
|
54
|
+
|
55
|
+
Until they're mocked, specs are run against a live API, either production, staging, or localhost (development). The config in `spec/spec_helper.rb` requires several credentials to be set as environment variables to make requests. Consider adding this to your `~/.bashrc` or export the variables before running the specs:
|
56
|
+
|
57
|
+
```
|
58
|
+
# Sonar config
|
59
|
+
export SONAR_TOKEN=asldkstokenalskdjf
|
60
|
+
export SONAR_API_URL=http://sonar-staging.labs.rapid7.com/
|
61
|
+
export SONAR_EMAIL=youremail@example.com
|
62
|
+
```
|
63
|
+
|
64
|
+
Once you have the variables set, `rspec spec` will run all the specs.
|
65
|
+
|
53
66
|
## CLI dev setup
|
54
67
|
|
55
68
|
From the project root directory
|
data/lib/sonar/cli/cli.rb
CHANGED
@@ -28,7 +28,7 @@ module Sonar
|
|
28
28
|
|
29
29
|
desc 'search [QUERY TYPE] [QUERY TERM]', 'Search anything from Sonars'
|
30
30
|
method_option 'record_limit', type: :numeric, aliases: '-n', desc: 'Maximum number of records to fetch'
|
31
|
-
method_option 'exact', type: :boolean, aliases: '-e', desc: 'Search for the query string exactly, do not
|
31
|
+
method_option 'exact', type: :boolean, aliases: '-e', desc: 'Search for the query string exactly, do not include partial string matches'
|
32
32
|
|
33
33
|
def search(type, term)
|
34
34
|
@query = {}
|
data/lib/sonar/request.rb
CHANGED
data/lib/sonar/version.rb
CHANGED
data/spec/sonar/search_spec.rb
CHANGED
@@ -98,7 +98,7 @@ describe Sonar::Search do
|
|
98
98
|
let(:resp) { client.search(fdns: '208.118.227.10') }
|
99
99
|
|
100
100
|
it "finds fdnsip rapid7.com at 208.118.227.10" do
|
101
|
-
expect(resp['collection'].any? { |x| x['address']
|
101
|
+
expect(resp['collection'].any? { |x| x['address'].match('rapid7') }).to be(true)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -155,7 +155,7 @@ describe Sonar::Search do
|
|
155
155
|
context "whois_ip" do
|
156
156
|
let(:resp) { client.search(whois_ip: '208.118.227.10') }
|
157
157
|
|
158
|
-
|
158
|
+
xit "should find rapid7.com" do
|
159
159
|
expect(resp['name']).to eq('TWDX-208-118-227-0-1')
|
160
160
|
end
|
161
161
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Deardorff & HD Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|