whoisxmlapi 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7217317d0caf1be648ce6b96cef1c0b3c977bb90c65fa5d1e69cb6b181b36967
4
- data.tar.gz: 8c77cd66f5a26dbf8e7e99b86e64a42c332fb234d69d2b35c89784e667930775
3
+ metadata.gz: 39e664dd9681096b4aafa9c0820d5a25410b63fd6280302d68d88aa5261f3cbe
4
+ data.tar.gz: a7848bc7787d4e385cc720969e03d35715a4eb6283641a4a2c7576ddedaaae80
5
5
  SHA512:
6
- metadata.gz: dd9344a0e3a271d1641f9e91a12c5cbe3f04dc12a5acad25a6db009313932cafd9aaa8fe455702d666335452211dae33c4a8e38715a9dd8343ba47acfed3fefc
7
- data.tar.gz: 76e08efaf6aa25e334a9ee90dc20b10e3b500ab2ec571dc2a82aef2bcea2a36ae43d33ba2326e947ef6e16344db03e18b9ed1bca3d380cd9b3ee3ad91fd83208
6
+ metadata.gz: 2d3b11bd48e46a6dbb06f772c58a75e9016ff3af3a2c9ebed35f0854e51ac69a4654a51f79657d8300fc2d35ee2584a4f18ca6b9fcd34870a40a68c4e15cca30
7
+ data.tar.gz: 88f0fbaccb75928cc363242e249a8db69d7ca6f97155522d7f821b1ddd5e1c7e8488068b26fd1efb7f7720b39df9709a84ddf14d3a8d1717e04cdc163380fc58
@@ -23,5 +23,24 @@ module WhoisXMLAPI
23
23
  field :email
24
24
  field :telephone
25
25
  field :fax
26
+
27
+ def self.selectively_create_from_hash(h)
28
+ attr = {
29
+ :name => h['name'],
30
+ :organization => h['organization'],
31
+ :street1 => h['street1'],
32
+ :street2 => h['street2'],
33
+ :city => h['city'],
34
+ :state => h['state'],
35
+ :postalCode => h['postalCode'],
36
+ :country => h['country'],
37
+ :countryCode => h['countryCode'],
38
+ :email => h['email'],
39
+ :telephone => h['telephone'],
40
+ :fax => h['fax'],
41
+ }
42
+ Contact.create(attr)
43
+ end
44
+
26
45
  end
27
46
  end
@@ -57,10 +57,10 @@ module WhoisXMLAPI
57
57
  technical_data = record['technicalContact'] || (record['registryData'] ? record['registryData']['technicalContact'] : nil)
58
58
  billing_data = record['billingContact'] || (record['registryData'] ? record['registryData']['billingContact'] : nil)
59
59
 
60
- self.registrant = WhoisXMLAPI::Contact.create(registrant_data.merge({'email' => record['contactEmail']})) if registrant_data
61
- self.admin = WhoisXMLAPI::Contact.create(administrative_data) if administrative_data
62
- self.tech = WhoisXMLAPI::Contact.create(technical_data) if technical_data
63
- self.billing = WhoisXMLAPI::Contact.create(billing_data) if billing_data
60
+ self.registrant = WhoisXMLAPI::Contact.selectively_create_from_hash(registrant_data.merge({'email' => record['contactEmail']})) if registrant_data
61
+ self.admin = WhoisXMLAPI::Contact.selectively_create_from_hash(administrative_data) if administrative_data
62
+ self.tech = WhoisXMLAPI::Contact.selectively_create_from_hash(technical_data) if technical_data
63
+ self.billing = WhoisXMLAPI::Contact.selectively_create_from_hash(billing_data) if billing_data
64
64
  end
65
65
 
66
66
  def complete?
@@ -1,3 +1,3 @@
1
1
  module WhoisXMLAPI
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
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.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hillard