whoisxmlapi2 0.2.0 → 0.2.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 +18 -0
- data/lib/whoisxmlapi2.rb +14 -5
- data/lib/whoisxmlapi2/configuration.rb +25 -10
- data/lib/whoisxmlapi2/version.rb +1 -1
- data/whoisxmlapi2.gemspec +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11aacdb5bb689acfaba0658db2a5090c23dbcb49a34c4af768a793d2284c32d2
|
4
|
+
data.tar.gz: 11ccbe22adbd9841eba7e84adaa29a487485fbae058995eb91f8c772572ee8fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1fbc6287dfd329450a4c59309eafbf4ee3e9a34d5e204f333da95af3eed54f7e9f0ea17cce63d8ac8fe6f21b783854a0baf0078e16292d6314d14e74f879cd
|
7
|
+
data.tar.gz: b05db8de12b6a44b4f87f209edfc0b26bcfe4af4df334af4880e532a690070db9963df38487f7d5c9d0296aef32e6059626514f93baf7c13cd54d17864b1b054
|
data/README.md
CHANGED
@@ -20,12 +20,30 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
Provide your credentials
|
22
22
|
|
23
|
+
#### With block
|
24
|
+
|
23
25
|
```ruby
|
24
26
|
WhoisXMLAPI2.configure do |config|
|
25
27
|
config.api_key = "your-api-key"
|
28
|
+
config.username = "your-api-username"
|
29
|
+
config.secret = "your-secret-key"
|
30
|
+
config.mock_out_for_testing = false
|
26
31
|
end
|
27
32
|
```
|
28
33
|
|
34
|
+
#### With params
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
config_params = {
|
38
|
+
api_key: "your-api-key",
|
39
|
+
username: "your-api-username",
|
40
|
+
secret: "your-secret-key",
|
41
|
+
mock_out_for_testing: false
|
42
|
+
}
|
43
|
+
|
44
|
+
WhoisXMLAPI2.configure(config_params)
|
45
|
+
```
|
46
|
+
|
29
47
|
Make a request
|
30
48
|
|
31
49
|
```ruby
|
data/lib/whoisxmlapi2.rb
CHANGED
@@ -12,11 +12,20 @@ require "whoisxmlapi2/request"
|
|
12
12
|
require "whoisxmlapi2/version"
|
13
13
|
|
14
14
|
module WhoisXMLAPI2
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
class << self
|
16
|
+
def configuration(params = {})
|
17
|
+
@configuration ||= Configuration.new(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def config_instance
|
21
|
+
@configuration
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure(params = {})
|
25
|
+
configuration(params) unless params.empty?
|
26
|
+
raise InvalidArgument, 'Block is required' if params.empty? && !block_given?
|
18
27
|
|
19
|
-
|
20
|
-
|
28
|
+
yield configuration if block_given?
|
29
|
+
end
|
21
30
|
end
|
22
31
|
end
|
@@ -5,20 +5,35 @@ module WhoisXMLAPI2
|
|
5
5
|
|
6
6
|
DEFAULT_SERVICE_ENDPOINT = "https://whoisxmlapi.com/whoisserver/WhoisService?".freeze
|
7
7
|
|
8
|
-
def initialize
|
9
|
-
|
8
|
+
def initialize(params = {})
|
9
|
+
apply_configuration(params)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
class << self
|
13
|
+
def set?
|
14
|
+
WhoisXMLAPI2.configuration.url && \
|
15
|
+
WhoisXMLAPI2.configuration.api_key || \
|
16
|
+
WhoisXMLAPI2.configuration.mock_out_for_testing
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_v1?
|
20
|
+
WhoisXMLAPI2.configuration.url && \
|
21
|
+
WhoisXMLAPI2.configuration.username && \
|
22
|
+
WhoisXMLAPI2.configuration.api_key && \
|
23
|
+
WhoisXMLAPI2.configuration.secret || \
|
24
|
+
WhoisXMLAPI2.configuration.mock_out_for_testing
|
25
|
+
end
|
15
26
|
end
|
16
27
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
28
|
+
def apply_configuration(params)
|
29
|
+
params[:url] ||= DEFAULT_SERVICE_ENDPOINT
|
30
|
+
|
31
|
+
@username = params[:username]
|
32
|
+
@api_key = params[:api_key]
|
33
|
+
@secret = params[:secret]
|
34
|
+
@url = params[:url]
|
35
|
+
@browser_key = params[:browser_key]
|
36
|
+
@mock_out_for_testing = params[:mock_out_for_testing]
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
data/lib/whoisxmlapi2/version.rb
CHANGED
data/whoisxmlapi2.gemspec
CHANGED
@@ -10,7 +10,6 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["scnissen@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{An open source WhoisXMLAPI interface}
|
13
|
-
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
13
|
spec.homepage = "https://github.com"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoisxmlapi2
|
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
|
- Sam Nissen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|