whoisxmlapi 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/whoisxmlapi/client.rb +6 -6
- data/lib/whoisxmlapi/result.rb +2 -1
- data/lib/whoisxmlapi/rwhois_result.rb +3 -8
- data/lib/whoisxmlapi/version.rb +1 -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: a2318f280097862c5b63d9710aeb834d41d868588bc318fbe122d8b0e0b7a1ab
|
4
|
+
data.tar.gz: 986c4bfd1f08fa3f087e1efc4a2b9326ae90b1a2c61f64741860bdeaf296d712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6449e69dc4a531efa3d70f1cb2c2826985e4ac1e8f159c36c65bef83434bd7ec1af326b2029e75d8628ecd3ff995b70c5692fd35e432fa63719297401c8d2cad
|
7
|
+
data.tar.gz: c33e7244b6eba1282fa1b91b35c8d74eafd5e72f6b3af5219389d196506da63b78acd37dd5b3a9684958c9eee1bb30663728ac8d258305c916bfbd391e651350
|
data/lib/whoisxmlapi/client.rb
CHANGED
@@ -115,31 +115,31 @@ module WhoisXMLAPI
|
|
115
115
|
WhoisXMLAPI.logger.debug "WhoisXMLAPI#rwhois - using cached rwhois data for #{entity_name}"
|
116
116
|
else
|
117
117
|
WhoisXMLAPI.logger.debug "WhoisXMLAPI#rwhois - no cached rwhois data for #{entity_name}"
|
118
|
-
res = WhoisXMLAPI::RWhoisResult.
|
118
|
+
res = WhoisXMLAPI::RWhoisResult.new(:entity_name => entity_name)
|
119
119
|
|
120
120
|
r = WhoisXMLAPI::Client.send_rwhois_request(entity_name)
|
121
121
|
if r && r.parsed_response && r.parsed_response['domainsList']
|
122
122
|
res.domains = r.parsed_response['domainsList']
|
123
|
-
res.save
|
124
123
|
elsif PublicSuffix.valid?(entity_name)
|
125
124
|
# if no luck with what was passed in and we have a valid domain with TLD, try just the second-level domain.
|
126
125
|
domain = PublicSuffix.parse(entity_name)
|
127
126
|
domain_sld = domain.sld
|
128
127
|
WhoisXMLAPI.logger.debug "WhoisXMLAPI#rwhois - no domains found for domain #{entity_name}, trying #{domain_sld}"
|
129
|
-
res = WhoisXMLAPI::RWhoisResult.
|
128
|
+
res = WhoisXMLAPI::RWhoisResult.new(:entity_name => domain_sld)
|
130
129
|
|
131
130
|
r = WhoisXMLAPI::Client.send_rwhois_request(domain_sld)
|
132
131
|
if r && r.parsed_response && r.parsed_response['domainsList']
|
133
132
|
res.domains = r.parsed_response['domainsList']
|
134
|
-
res.save
|
135
133
|
else
|
136
134
|
res.domains = []
|
137
|
-
res.save
|
138
135
|
end
|
139
136
|
else
|
140
137
|
WhoisXMLAPI.logger.debug "WhoisXMLAPI#rwhois - no domains found for #{entity_name}!"
|
141
138
|
res.domains = []
|
142
|
-
|
139
|
+
end
|
140
|
+
res.save
|
141
|
+
if res.errors.any?
|
142
|
+
WhoisXMLAPI.logger.debug "WhoisXMLAPI#rwhois - ERROR saving RWhoisResult: #{res.errors.full_messages.join('; ')} - #{res}!"
|
143
143
|
end
|
144
144
|
end
|
145
145
|
res
|
data/lib/whoisxmlapi/result.rb
CHANGED
@@ -19,7 +19,8 @@ module WhoisXMLAPI
|
|
19
19
|
has_one :tech, :as => :contactable, :class_name => "WhoisXMLAPI::Contact", :autosave => true
|
20
20
|
has_one :billing, :as => :contactable, :class_name => "WhoisXMLAPI::Contact", :autosave => true
|
21
21
|
|
22
|
-
|
22
|
+
# https://blog.bigbinary.com/2016/02/15/rails-5-makes-belong-to-association-required-by-default.html
|
23
|
+
belongs_to :whoisable, :polymorphic => true, optional: true
|
23
24
|
# Actual indexing is performed in db_mongoid_extend.rake
|
24
25
|
# index([
|
25
26
|
# [ :whoisable_id, Mongo::ASCENDING ],
|
@@ -3,15 +3,10 @@ module WhoisXMLAPI
|
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
|
-
|
6
|
+
# https://blog.bigbinary.com/2016/02/15/rails-5-makes-belong-to-association-required-by-default.html
|
7
|
+
belongs_to :rwhoisable, :polymorphic => true, optional: true
|
7
8
|
# Actual indexing is performed in db_mongoid_extend.rake
|
8
|
-
|
9
|
-
# [ :rwhoisable_id, Mongo::ASCENDING ],
|
10
|
-
# [ :rwhoisable_type, Mongo::ASCENDING ]
|
11
|
-
# ])
|
12
|
-
index({rwhoisable_id: 1, rwhoisable_type: 1})
|
13
|
-
|
14
|
-
field :entity_name, :type => String
|
9
|
+
field :entity_name, :type => String, index: true
|
15
10
|
field :domains, :type => Array
|
16
11
|
|
17
12
|
end
|
data/lib/whoisxmlapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoisxmlapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Hillard
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-11-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|