urlscan 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/urlscan/api.rb +3 -3
- data/lib/urlscan/version.rb +1 -1
- data/urlscan.gemspec +4 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c860d94c43d840a9ae3e1de318125cd3751bb7343ddc0c6804befda52f07fd51
|
4
|
+
data.tar.gz: 4a3c41475e008a8c2e20507a17b3a69476be3741e7d2010906d34a4bfdf47b86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 396ff9ada2223c5a2dae1db5cdd79c76d62b6673f2750e9cbcd3c6285c4bb940d0dcf8cdd9533b583641d1f299eb1abb668f882e02489dc476fb49011112f07a
|
7
|
+
data.tar.gz: d9f65c8c0d4c79d23e665f2d32b96103068a5b0b8c2f15e67e0ab8289786e34d279712187570866ad768bd7a06ffe160203de1fdf619efaa958a74deb86ff547
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ gem install urlscan
|
|
19
19
|
```ruby
|
20
20
|
require 'urlscan'
|
21
21
|
|
22
|
-
# when given nothing, it tries to load your API key from ENV["
|
22
|
+
# when given nothing, it tries to load your API key from ENV["URLSCAN_API_KEY"]
|
23
23
|
api = UrlScan::API.new
|
24
24
|
# or you can set it manually
|
25
25
|
api = UrlScan::API.new(api_key)
|
@@ -45,12 +45,12 @@ p res # => See the following URL as an example of the reponse.
|
|
45
45
|
|
46
46
|
### Supported API endpoints
|
47
47
|
|
48
|
-
| HTTP Method | URI
|
49
|
-
|
50
|
-
| POST | /scan
|
51
|
-
| GET | /result
|
52
|
-
| GET | /dom
|
53
|
-
| GET | /search
|
48
|
+
| HTTP Method | URI | API method |
|
49
|
+
| ----------- | --------------- | ----------------------------------------------------------------- |
|
50
|
+
| POST | /scan | `UrlScan::API#submit(url, is_public = true)` |
|
51
|
+
| GET | /result/\$uuid/ | `UrlScan::API#result(uuid)` |
|
52
|
+
| GET | /dom/\$uuid/ | `UrlScan::API#dom(uuid)` |
|
53
|
+
| GET | /search | `UrlScan::API#search(q, size = 100, offset = 0, sort = "_score")` |
|
54
54
|
|
55
55
|
## CLI usage
|
56
56
|
|
data/lib/urlscan/api.rb
CHANGED
@@ -14,13 +14,13 @@ module UrlScan
|
|
14
14
|
attr_reader :key
|
15
15
|
|
16
16
|
def initialize(key = ENV["URLSCAN_API_KEY"])
|
17
|
-
raise ArgumentError, "`key` argument required" if key.nil?
|
18
|
-
|
19
17
|
@key = key
|
20
18
|
end
|
21
19
|
|
22
20
|
# @return [Hash]
|
23
21
|
def submit(url, is_public = true)
|
22
|
+
raise ArgumentError, "API key is required for this method." if key.nil?
|
23
|
+
|
24
24
|
params = { url: url, public: is_public ? "on" : "off" }
|
25
25
|
post("/scan/", params) { |json| json }
|
26
26
|
end
|
@@ -87,7 +87,7 @@ module UrlScan
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def get(path, &block)
|
90
|
-
get = Net::HTTP::Get.new(url_for(path)
|
90
|
+
get = Net::HTTP::Get.new(url_for(path))
|
91
91
|
request(get, &block)
|
92
92
|
end
|
93
93
|
|
data/lib/urlscan/version.rb
CHANGED
data/urlscan.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require "urlscan/version"
|
@@ -24,8 +26,8 @@ Gem::Specification.new do |spec|
|
|
24
26
|
spec.add_development_dependency "dotenv", "~> 2.5"
|
25
27
|
spec.add_development_dependency "rake", "~> 12.3"
|
26
28
|
spec.add_development_dependency "rspec", "~> 3.8"
|
27
|
-
spec.add_development_dependency "vcr", "~>
|
28
|
-
spec.add_development_dependency "webmock", "~> 3.
|
29
|
+
spec.add_development_dependency "vcr", "~> 5.0"
|
30
|
+
spec.add_development_dependency "webmock", "~> 3.6"
|
29
31
|
|
30
32
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
31
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urlscan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '5.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '5.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3.
|
103
|
+
version: '3.6'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3.
|
110
|
+
version: '3.6'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: thor
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|