whoisxmlapi 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39e664dd9681096b4aafa9c0820d5a25410b63fd6280302d68d88aa5261f3cbe
4
- data.tar.gz: a7848bc7787d4e385cc720969e03d35715a4eb6283641a4a2c7576ddedaaae80
3
+ metadata.gz: a2318f280097862c5b63d9710aeb834d41d868588bc318fbe122d8b0e0b7a1ab
4
+ data.tar.gz: 986c4bfd1f08fa3f087e1efc4a2b9326ae90b1a2c61f64741860bdeaf296d712
5
5
  SHA512:
6
- metadata.gz: 2d3b11bd48e46a6dbb06f772c58a75e9016ff3af3a2c9ebed35f0854e51ac69a4654a51f79657d8300fc2d35ee2584a4f18ca6b9fcd34870a40a68c4e15cca30
7
- data.tar.gz: 88f0fbaccb75928cc363242e249a8db69d7ca6f97155522d7f821b1ddd5e1c7e8488068b26fd1efb7f7720b39df9709a84ddf14d3a8d1717e04cdc163380fc58
6
+ metadata.gz: 6449e69dc4a531efa3d70f1cb2c2826985e4ac1e8f159c36c65bef83434bd7ec1af326b2029e75d8628ecd3ff995b70c5692fd35e432fa63719297401c8d2cad
7
+ data.tar.gz: c33e7244b6eba1282fa1b91b35c8d74eafd5e72f6b3af5219389d196506da63b78acd37dd5b3a9684958c9eee1bb30663728ac8d258305c916bfbd391e651350
@@ -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.create(:entity_name => entity_name)
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.create(:entity_name => domain_sld)
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
- res.save
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
@@ -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
- belongs_to :whoisable, :polymorphic => true
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
- belongs_to :rwhoisable, :polymorphic => true
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
- # index([
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
@@ -1,3 +1,3 @@
1
1
  module WhoisXMLAPI
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
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
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-10-28 00:00:00.000000000 Z
14
+ date: 2019-11-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport