ipscanner-io 0.2.0 → 0.3.1
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 +14 -2
- data/lib/ipscanner/client.rb +2 -1
- data/lib/ipscanner/http.rb +5 -1
- data/lib/ipscanner/resources/email.rb +15 -0
- data/lib/ipscanner/resources/gate.rb +4 -2
- data/lib/ipscanner/version.rb +1 -1
- data/lib/ipscanner.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df858440c24cbe0277b8ee17f8e00e8f81c897286cdd474e4627779797873612
|
|
4
|
+
data.tar.gz: 8e4f7a77b7225b68a9d56cbe2b56b5e9b6ca356ff3623a18716164dcdea78257
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 343088adc303b451fdca73d1c8f1a8c1fb9dee443bade9b80288d94005f6787cfc9bb0679bcc99f06c84385f5d51125a87a2861aade1ca902ed504efff1c81cc
|
|
7
|
+
data.tar.gz: 32ef3a941da72a5d5e9cde5d24237ef8e913ef86ad3302714390988cee71981f8f4221e0487671af0bd28149959df0cc3c518874f12e9a160c9c78d1781e84c8
|
data/README.md
CHANGED
|
@@ -50,6 +50,17 @@ client.ip.demo("1.1.1.1") # no key needed
|
|
|
50
50
|
client.ip.myip # no key needed
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
`vpn` and `proxy` carry `purity` (the score breakdown) on paid plans; a locked answer has `deductionCount` instead.
|
|
54
|
+
|
|
55
|
+
### Email
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
result = client.email.check("jane@outlok.com")
|
|
59
|
+
# result["status"] "risky", result["reason"] "typo", result["suggestion"] "jane@outlook.com"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Checks syntax, throwaway domains, whether the domain receives mail, typos of big webmail domains and role addresses. The mailbox itself is not probed. One request per address.
|
|
63
|
+
|
|
53
64
|
### Bulk
|
|
54
65
|
|
|
55
66
|
```ruby
|
|
@@ -96,10 +107,11 @@ client.sites.policy("your-site-id")
|
|
|
96
107
|
### Gate
|
|
97
108
|
|
|
98
109
|
```ruby
|
|
99
|
-
result = client.gate.verify(secret: "gs_...", token: gate_token, remote_ip: request.remote_ip
|
|
110
|
+
result = client.gate.verify(secret: "gs_...", token: gate_token, remote_ip: request.remote_ip,
|
|
111
|
+
email: params["email"])
|
|
100
112
|
```
|
|
101
113
|
|
|
102
|
-
`gate.verify` sends the site secret instead of the API key and is never retried.
|
|
114
|
+
`gate.verify` sends the site secret instead of the API key and is never retried. `email` is optional; with it, `result["email"]` holds the check and its action, and `result["action"]` is the stricter of the network and email actions.
|
|
103
115
|
|
|
104
116
|
### Provenance
|
|
105
117
|
|
data/lib/ipscanner/client.rb
CHANGED
|
@@ -6,7 +6,7 @@ module IPScanner
|
|
|
6
6
|
DEFAULT_BASE_URL = "https://ipscanner.io"
|
|
7
7
|
|
|
8
8
|
attr_reader :ip, :bulk, :agentscan, :provenance, :account, :asn_directory, :crawlers,
|
|
9
|
-
:edge, :sites, :gate
|
|
9
|
+
:edge, :sites, :gate, :email
|
|
10
10
|
|
|
11
11
|
def initialize(api_key: nil, base_url: nil, timeout: 30, max_retries: 2)
|
|
12
12
|
api_key ||= ENV.fetch("IPSCANNER_API_KEY", nil)
|
|
@@ -24,6 +24,7 @@ module IPScanner
|
|
|
24
24
|
@edge = Resources::Edge.new(http)
|
|
25
25
|
@sites = Resources::Sites.new(http)
|
|
26
26
|
@gate = Resources::Gate.new(http)
|
|
27
|
+
@email = Resources::Email.new(http)
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
data/lib/ipscanner/http.rb
CHANGED
|
@@ -34,7 +34,11 @@ module IPScanner
|
|
|
34
34
|
}.freeze
|
|
35
35
|
|
|
36
36
|
def self.escape(segment)
|
|
37
|
-
segment.to_s
|
|
37
|
+
value = segment.to_s
|
|
38
|
+
# "." and ".." would be resolved to another endpoint, with the API key attached.
|
|
39
|
+
raise ArgumentError, "ipscanner: invalid path segment #{value.inspect}" if [".", ".."].include?(value)
|
|
40
|
+
|
|
41
|
+
value.b.gsub(/[^A-Za-z0-9\-._~]/) { |c| format("%%%02X", c.ord) }
|
|
38
42
|
end
|
|
39
43
|
|
|
40
44
|
def initialize(api_key:, base_url:, timeout:, max_retries:)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module IPScanner
|
|
6
|
+
module Resources
|
|
7
|
+
# Email: address checks before a signup is accepted.
|
|
8
|
+
class Email < Base
|
|
9
|
+
# Checks one address: syntax, throwaway domains, mail servers, typos and role addresses. One request.
|
|
10
|
+
def check(email)
|
|
11
|
+
@http.post("/v1/email/check", { email: email })
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -7,8 +7,10 @@ module IPScanner
|
|
|
7
7
|
# Gate: server-side redemption of form tokens.
|
|
8
8
|
class Gate < Base
|
|
9
9
|
# Redeems a gate token with the site secret. Sends no API key and is never retried.
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
# email (optional) adds an email check, one request.
|
|
11
|
+
def verify(secret:, token:, remote_ip: nil, email: nil)
|
|
12
|
+
body = compact({ secret: secret, token: token, remote_ip: remote_ip, email: email })
|
|
13
|
+
@http.post("/v1/gate/verify", body, auth: false)
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
end
|
data/lib/ipscanner/version.rb
CHANGED
data/lib/ipscanner.rb
CHANGED
|
@@ -13,6 +13,7 @@ require_relative "ipscanner/resources/crawlers"
|
|
|
13
13
|
require_relative "ipscanner/resources/edge"
|
|
14
14
|
require_relative "ipscanner/resources/sites"
|
|
15
15
|
require_relative "ipscanner/resources/gate"
|
|
16
|
+
require_relative "ipscanner/resources/email"
|
|
16
17
|
require_relative "ipscanner/client"
|
|
17
18
|
|
|
18
19
|
# Ruby client for the IPScanner API.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ipscanner-io
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- IPScanner
|
|
@@ -28,6 +28,7 @@ files:
|
|
|
28
28
|
- lib/ipscanner/resources/bulk.rb
|
|
29
29
|
- lib/ipscanner/resources/crawlers.rb
|
|
30
30
|
- lib/ipscanner/resources/edge.rb
|
|
31
|
+
- lib/ipscanner/resources/email.rb
|
|
31
32
|
- lib/ipscanner/resources/gate.rb
|
|
32
33
|
- lib/ipscanner/resources/ip.rb
|
|
33
34
|
- lib/ipscanner/resources/provenance.rb
|