whois 3.4.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +23 -0
- data/README.md +1 -1
- data/data/tld.json +4 -4
- data/lib/whois/record/parser/base_icann_compliant.rb +13 -15
- data/lib/whois/record/parser/whois.1und1.info.rb +30 -0
- data/lib/whois/record/parser/whois.ascio.com.rb +0 -3
- data/lib/whois/record/parser/whois.comlaude.com.rb +1 -0
- data/lib/whois/record/parser/whois.dk-hostmaster.dk.rb +2 -0
- data/lib/whois/record/parser/whois.enom.com.rb +4 -0
- data/lib/whois/record/parser/whois.gandi.net.rb +4 -119
- data/lib/whois/record/parser/whois.godaddy.com.rb +0 -3
- data/lib/whois/record/parser/whois.kenic.or.ke.rb +24 -16
- data/lib/whois/record/parser/whois.markmonitor.com.rb +1 -0
- data/lib/whois/record/parser/whois.networksolutions.com.rb +11 -125
- data/lib/whois/record/parser/whois.nic.hu.rb +18 -100
- data/lib/whois/record/parser/whois.pairnic.com.rb +30 -0
- data/lib/whois/record/parser/whois.rrpproxy.net.rb +0 -3
- data/lib/whois/record/parser/whois.schlund.info.rb +4 -0
- data/lib/whois/record/parser/whois.tucows.com.rb +30 -0
- data/lib/whois/record/parser/whois.udag.net.rb +4 -0
- data/lib/whois/record/parser/whois.wildwestdomains.com.rb +37 -0
- data/lib/whois/record/parser/whois.yoursrs.com.rb +0 -3
- data/lib/whois/record/scanners/base_icann_compliant.rb +4 -3
- data/lib/whois/record/scanners/scannable.rb +0 -1
- data/lib/whois/record/scanners/whois.tucows.com.rb +35 -0
- data/lib/whois/version.rb +1 -1
- data/whois.gemspec +6 -5
- metadata +36 -32
- data/lib/whois/record/scanners/whois.nic.hu.rb +0 -178
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 42ce09ac779c94795254e665e5d126542509c5d7
|
4
|
+
data.tar.gz: 1253b6280f08a7d1f00c47e9c59ed4968422b37c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 803338a05e1146ce3359093df7ff322cfde58e48c87855c82eae2bbf2c839a28c55faffa2c3028ef7e8d45e6b0240a238ecfac99f684ea58661c7cc7c47f4e5e
|
7
|
+
data.tar.gz: 18e02ea776d7a6bfbce15224b039e7815a95ee593d7ef6443716423c355e7999a5c4deb382f3a6cf27bc1235233be5afbc985da84311d43c94ecd2febbe7abc7
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
|
4
|
+
## Release 3.4.1
|
5
|
+
|
6
|
+
- SERVER: Updated .XN--NGBC5AZD IDN TLD definition.
|
7
|
+
|
8
|
+
- NEW: whois.whois.kenic.or.ke parser now recognizes invalid status.
|
9
|
+
|
10
|
+
- NEW: Added whois.tucows.com parser (GH-260). [Thanks @takama]
|
11
|
+
|
12
|
+
- NEW: Added whois.wildwestdomains.com parser (GH-271). [Thanks @gromnsk]
|
13
|
+
|
14
|
+
- NEW: Added whois.pairnic.com parser (GH-275). [Thanks @gromnsk]
|
15
|
+
|
16
|
+
- NEW: Added whois.1und1.info parser (GH-278). [Thanks @gromnsk]
|
17
|
+
|
18
|
+
- FIXED: whois.dk-hostmaster.dk crashes when the status is `reserved` (GH-281). [Thanks @Pietr]
|
19
|
+
|
20
|
+
- CHANGED: Updated whois.nic.hu parser to the new response format.
|
21
|
+
|
22
|
+
- CHANGED: Updated whois.networksolutions.com parser to the new response format (GH-280). [Thanks @takama]
|
23
|
+
|
24
|
+
- CHANGED: Updated whois.gandi.net parser to the new response format.
|
25
|
+
|
26
|
+
|
4
27
|
## Release 3.4.0
|
5
28
|
|
6
29
|
- SERVER: Added .XN--MGBX4CD0AB (.ایران, Iran) IDN TLD definition.
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ An extensive test suite is available to verify the library correctness but you m
|
|
15
15
|
|
16
16
|
[Support Whois at Pledgie](http://www.pledgie.com/campaigns/11383).
|
17
17
|
|
18
|
-
<a href='
|
18
|
+
<a href='https://pledgie.com/campaigns/11383'><img alt='Click here to lend your support to: whois and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/11383.png?skin_name=chrome' border='0' ></a>
|
19
19
|
|
20
20
|
*Whois* is free software, but it costs money to write, test, and distribute it. You can support the development by sending a donation. **Any amount, even $5, is greatly appreciated**.
|
21
21
|
|
data/data/tld.json
CHANGED
@@ -1154,6 +1154,9 @@
|
|
1154
1154
|
".ws": {
|
1155
1155
|
"host": "whois.samoanic.ws"
|
1156
1156
|
},
|
1157
|
+
".xxx": {
|
1158
|
+
"host": "whois.nic.xxx"
|
1159
|
+
},
|
1157
1160
|
".ye": {
|
1158
1161
|
"host": null,
|
1159
1162
|
"adapter": "none"
|
@@ -1185,9 +1188,6 @@
|
|
1185
1188
|
"host": null,
|
1186
1189
|
"adapter": "none"
|
1187
1190
|
},
|
1188
|
-
".xxx": {
|
1189
|
-
"host": "whois.nic.xxx"
|
1190
|
-
},
|
1191
1191
|
".xn--3e0b707e": {
|
1192
1192
|
"host": "whois.kr"
|
1193
1193
|
},
|
@@ -1276,7 +1276,7 @@
|
|
1276
1276
|
"host": "whois.domainregistry.my"
|
1277
1277
|
},
|
1278
1278
|
".xn--ngbc5azd": {
|
1279
|
-
"host": "whois.xn--ngbc5azd
|
1279
|
+
"host": "whois.nic.xn--ngbc5azd"
|
1280
1280
|
},
|
1281
1281
|
".xn--o3cw4h": {
|
1282
1282
|
"host": "whois.thnic.co.th"
|
@@ -22,7 +22,6 @@ module Whois
|
|
22
22
|
# @author Simone Carletti
|
23
23
|
# @author Igor Dolzhikov <bluesriverz@gmail.com>
|
24
24
|
#
|
25
|
-
|
26
25
|
class BaseIcannCompliant < Base
|
27
26
|
include Scanners::Scannable
|
28
27
|
|
@@ -39,15 +38,11 @@ module Whois
|
|
39
38
|
|
40
39
|
|
41
40
|
property_supported :status do
|
42
|
-
status = Array.wrap(node('Domain Status'))
|
43
|
-
if
|
44
|
-
|
45
|
-
:available
|
46
|
-
else
|
47
|
-
:registered
|
48
|
-
end
|
41
|
+
# status = Array.wrap(node('Domain Status'))
|
42
|
+
if available?
|
43
|
+
:available
|
49
44
|
else
|
50
|
-
|
45
|
+
:registered
|
51
46
|
end
|
52
47
|
end
|
53
48
|
|
@@ -124,17 +119,20 @@ module Whois
|
|
124
119
|
zip: value_for_property(element, 'Postal Code'),
|
125
120
|
state: value_for_property(element, 'State/Province'),
|
126
121
|
country_code: value_for_property(element, 'Country'),
|
127
|
-
phone:
|
128
|
-
|
129
|
-
].reject(&:empty?).join(' ext: '),
|
130
|
-
fax: [ value_for_property(element, 'Fax'),
|
131
|
-
value_for_property(element, 'Fax Ext')
|
132
|
-
].reject(&:empty?).join(' ext: '),
|
122
|
+
phone: value_for_phone_property(element, 'Phone'),
|
123
|
+
fax: value_for_phone_property(element, 'Fax'),
|
133
124
|
email: value_for_property(element, 'Email')
|
134
125
|
)
|
135
126
|
end
|
136
127
|
end
|
137
128
|
|
129
|
+
def value_for_phone_property(element, property)
|
130
|
+
[
|
131
|
+
value_for_property(element, "#{property}"),
|
132
|
+
value_for_property(element, "#{property} Ext")
|
133
|
+
].reject(&:empty?).join(' ext: ')
|
134
|
+
end
|
135
|
+
|
138
136
|
def value_for_property(element, property)
|
139
137
|
Array.wrap(node("#{element} #{property}")).reject(&:empty?).join(', ')
|
140
138
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base_icann_compliant'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
# Parser for the whois.1und1.info server.
|
18
|
+
#
|
19
|
+
# @see Whois::Record::Parser::Example
|
20
|
+
# The Example parser for the list of all available methods.
|
21
|
+
#
|
22
|
+
class Whois1und1Info < BaseIcannCompliant
|
23
|
+
self.scanner = Scanners::BaseIcannCompliant, {
|
24
|
+
pattern_available: /^Domain (.+) is not registered here.\n/
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -20,9 +20,6 @@ module Whois
|
|
20
20
|
# @see Whois::Record::Parser::Example
|
21
21
|
# The Example parser for the list of all available methods.
|
22
22
|
#
|
23
|
-
# @author Simone Carletti
|
24
|
-
# @author Igor Dolzhikov <bluesriverz@gmail.com>
|
25
|
-
#
|
26
23
|
class WhoisAscioCom < Base
|
27
24
|
include Scanners::Scannable
|
28
25
|
|
@@ -15,6 +15,10 @@ module Whois
|
|
15
15
|
class Parser
|
16
16
|
|
17
17
|
# Parser for the whois.enom.com server.
|
18
|
+
#
|
19
|
+
# @see Whois::Record::Parser::Example
|
20
|
+
# The Example parser for the list of all available methods.
|
21
|
+
#
|
18
22
|
class WhoisEnomCom < BaseIcannCompliant
|
19
23
|
self.scanner = Scanners::BaseIcannCompliant, {
|
20
24
|
pattern_available: /^Domain not found\.\n/
|
@@ -7,8 +7,7 @@
|
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
10
|
-
require '
|
11
|
-
require 'whois/record/parser/base'
|
10
|
+
require 'whois/record/parser/base_icann_compliant'
|
12
11
|
|
13
12
|
|
14
13
|
module Whois
|
@@ -20,128 +19,14 @@ module Whois
|
|
20
19
|
# @see Whois::Record::Parser::Example
|
21
20
|
# The Example parser for the list of all available methods.
|
22
21
|
#
|
23
|
-
|
24
|
-
# @author Igor Dolzhikov <bluesriverz@gmail.com>
|
25
|
-
#
|
26
|
-
class WhoisGandiNet < Base
|
27
|
-
include Scanners::Scannable
|
28
|
-
|
29
|
-
|
30
|
-
property_not_supported :disclaimer
|
31
|
-
|
32
|
-
|
33
|
-
property_supported :domain do
|
34
|
-
node("domain")
|
35
|
-
end
|
36
|
-
|
37
|
-
property_not_supported :domain_id
|
38
|
-
|
39
|
-
|
40
|
-
property_supported :status do
|
41
|
-
if available?
|
42
|
-
:available
|
43
|
-
else
|
44
|
-
:registered
|
45
|
-
end
|
46
|
-
end
|
22
|
+
class WhoisGandiNet < BaseIcannCompliant
|
47
23
|
|
48
24
|
property_supported :available? do
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
property_supported :registered? do
|
53
|
-
!available?
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
property_supported :created_on do
|
58
|
-
node("created")
|
59
|
-
end
|
60
|
-
|
61
|
-
property_supported :updated_on do
|
62
|
-
node("changed")
|
63
|
-
end
|
64
|
-
|
65
|
-
property_supported :expires_on do
|
66
|
-
node("expires")
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
property_supported :registrar do
|
71
|
-
Record::Registrar.new(
|
72
|
-
name: "GANDI Registrar",
|
73
|
-
organization: "GANDI Registrar",
|
74
|
-
)
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
property_supported :registrant_contacts do
|
79
|
-
build_contact("owner-c", Whois::Record::Contact::TYPE_REGISTRANT)
|
80
|
-
end
|
81
|
-
|
82
|
-
property_supported :admin_contacts do
|
83
|
-
build_contact("admin-c", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
|
84
|
-
end
|
85
|
-
|
86
|
-
property_supported :technical_contacts do
|
87
|
-
build_contact("tech-c", Whois::Record::Contact::TYPE_TECHNICAL)
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
property_supported :nameservers do
|
92
|
-
content_for_scanner.scan(/^ns\d{1}:\s(.*)/).flatten.map do |line|
|
93
|
-
name, ipv4 = line.strip.split(" ")
|
94
|
-
Record::Nameserver.new(name: name.downcase, ipv4: ipv4)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def parse
|
102
|
-
patched = content_for_scanner.dup
|
103
|
-
patched.gsub!(/(zipcode|phone|fax): (.+)/, %Q{\\1: "\\2"})
|
104
|
-
|
105
|
-
result = YAML.load(patched)
|
106
|
-
unless result
|
107
|
-
result = {}
|
108
|
-
result["status:available"] = true
|
109
|
-
end
|
110
|
-
result
|
111
|
-
end
|
112
|
-
|
113
|
-
def build_contact(element, type)
|
114
|
-
# nic-hdl: NG270-GANDI
|
115
|
-
# organisation: GANDI SAS
|
116
|
-
# person: NOC GANDI
|
117
|
-
# address: 63-65 Boulevard MASSENA
|
118
|
-
# zipcode: 75013
|
119
|
-
# city: Paris
|
120
|
-
# country: France
|
121
|
-
# phone: +33.143737851
|
122
|
-
# fax: +33.143731851
|
123
|
-
# email: 12e7da77f638acdf8d9f4d0b828ca80c-248842@contact.gandi.net
|
124
|
-
# lastupdated: 2013-04-04 15:53:42
|
125
|
-
|
126
|
-
node(element) do |section|
|
127
|
-
Record::Contact.new(
|
128
|
-
type: type,
|
129
|
-
id: section["nic-hdl"],
|
130
|
-
name: section["person"],
|
131
|
-
organization: section["organisation"],
|
132
|
-
address: section["address"],
|
133
|
-
zip: section["zipcode"],
|
134
|
-
city: section["city"],
|
135
|
-
country: section["country"],
|
136
|
-
phone: section["phone"],
|
137
|
-
fax: section["fax"],
|
138
|
-
email: section["email"],
|
139
|
-
updated_on: section["lastupdated"],
|
140
|
-
)
|
141
|
-
end
|
25
|
+
content_for_scanner == "\n"
|
142
26
|
end
|
143
27
|
|
144
28
|
end
|
29
|
+
|
145
30
|
end
|
146
31
|
end
|
147
32
|
end
|
@@ -19,9 +19,6 @@ module Whois
|
|
19
19
|
# @see Whois::Record::Parser::Example
|
20
20
|
# The Example parser for the list of all available methods.
|
21
21
|
#
|
22
|
-
# @author Simone Carletti
|
23
|
-
# @author Tom Nicholls <tom.nicholls@oii.ox.ac.uk>
|
24
|
-
#
|
25
22
|
class WhoisGodaddyCom < Base
|
26
23
|
|
27
24
|
property_not_supported :status
|
@@ -14,28 +14,28 @@ module Whois
|
|
14
14
|
class Record
|
15
15
|
class Parser
|
16
16
|
|
17
|
-
#
|
18
|
-
# = whois.kenic.or.ke parser
|
19
|
-
#
|
20
17
|
# Parser for the whois.kenic.or.ke server.
|
21
18
|
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
19
|
+
# @note This parser is just a stub and provides only a few basic methods
|
20
|
+
# to check for domain availability and get domain status.
|
21
|
+
# Please consider to contribute implementing missing methods.
|
22
|
+
#
|
23
|
+
# @see Whois::Record::Parser::Example
|
24
|
+
# The Example parser for the list of all available methods.
|
27
25
|
#
|
28
26
|
class WhoisKenicOrKe < Base
|
29
27
|
|
30
28
|
property_supported :status do
|
31
29
|
if content_for_scanner =~ /Status:\s+(.+?)\n/
|
32
30
|
case $1.downcase
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
when "active"
|
32
|
+
:registered
|
33
|
+
when "not registered"
|
34
|
+
:available
|
35
|
+
when "this whois server does not have any records for that zone."
|
36
|
+
:invalid
|
37
|
+
else
|
38
|
+
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
|
39
39
|
end
|
40
40
|
else
|
41
41
|
Whois.bug!(ParserError, "Unable to parse status.")
|
@@ -43,11 +43,11 @@ module Whois
|
|
43
43
|
end
|
44
44
|
|
45
45
|
property_supported :available? do
|
46
|
-
status == :available
|
46
|
+
!invalid? && status == :available
|
47
47
|
end
|
48
48
|
|
49
49
|
property_supported :registered? do
|
50
|
-
!available?
|
50
|
+
!invalid? && !available?
|
51
51
|
end
|
52
52
|
|
53
53
|
|
@@ -78,6 +78,14 @@ module Whois
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
|
82
|
+
# NEWPROPERTY
|
83
|
+
def invalid?
|
84
|
+
cached_properties_fetch(:invalid?) do
|
85
|
+
status == :invalid
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
81
89
|
end
|
82
90
|
|
83
91
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
10
|
-
require 'whois/record/parser/
|
10
|
+
require 'whois/record/parser/base_icann_compliant'
|
11
11
|
|
12
12
|
|
13
13
|
module Whois
|
@@ -19,136 +19,22 @@ module Whois
|
|
19
19
|
# @see Whois::Record::Parser::Example
|
20
20
|
# The Example parser for the list of all available methods.
|
21
21
|
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
property_not_supported :status
|
27
|
-
|
28
|
-
# The server is contacted only in case of a registered domain.
|
29
|
-
property_supported :available? do
|
30
|
-
false
|
31
|
-
end
|
32
|
-
|
33
|
-
property_supported :registered? do
|
34
|
-
!available?
|
35
|
-
end
|
22
|
+
class WhoisNetworksolutionsCom < BaseIcannCompliant
|
23
|
+
self.scanner = Scanners::BaseIcannCompliant, {
|
24
|
+
pattern_available: /^No match for "[\w\.]+"\.\n/
|
25
|
+
}
|
36
26
|
|
37
|
-
|
38
|
-
property_supported :created_on do
|
39
|
-
if content_for_scanner =~ /Record created on (.+)\.\n/
|
40
|
-
Time.parse($1)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
property_not_supported :updated_on
|
45
|
-
|
46
|
-
property_supported :expires_on do
|
47
|
-
if content_for_scanner =~ /Record expires on (.+)\.\n/
|
48
|
-
Time.parse($1)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
property_supported :registrar do
|
54
|
-
Record::Registrar.new(
|
55
|
-
:name => 'Network Solutions',
|
56
|
-
:organization => 'Network Solutions, LLC',
|
57
|
-
:url => 'http://www.networksolutions.com/'
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
property_supported :registrant_contacts do
|
62
|
-
build_contact('Registrant:', Record::Contact::TYPE_REGISTRANT)
|
63
|
-
end
|
64
|
-
|
65
|
-
property_supported :admin_contacts do
|
66
|
-
build_contact('Administrative Contact', Record::Contact::TYPE_ADMINISTRATIVE)
|
67
|
-
end
|
68
|
-
|
69
|
-
property_supported :technical_contacts do
|
70
|
-
build_contact('Technical Contact', Record::Contact::TYPE_TECHNICAL)
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
property_supported :nameservers do
|
75
|
-
if content_for_scanner =~ /Domain servers in listed order:\n\n((?:[^\n]+\n)+)/
|
76
|
-
$1.split("\n").map do |line|
|
77
|
-
# NS01.XIF.COM 63.240.200.70
|
78
|
-
name, ipv4 = line.strip.split(" ")
|
79
|
-
Record::Nameserver.new(:name => name.downcase, :ipv4 => ipv4)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def response_throttled?
|
85
|
-
!!(content_for_scanner =~ /The IP address from which you have visited/)
|
86
|
-
end
|
87
|
-
|
88
|
-
private
|
27
|
+
private
|
89
28
|
|
90
29
|
def build_contact(element, type)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
# Split lines but don't strip them now because in some cases
|
95
|
-
# we need the entire line, including extra-spaces.
|
96
|
-
lines = match.split("\n")
|
97
|
-
|
98
|
-
# 0 XIF Communications | mpowers LLC
|
99
|
-
# 1 1200 New Hampshire Avenue NW | 21010 Southbank St #575
|
100
|
-
# 2 Suite 410 | Potomac Falls, VA 20165
|
101
|
-
# 3 Washington, DC 20036 | US
|
102
|
-
# 4 US
|
103
|
-
|
104
|
-
# 0 Communications, XIF ContactMiddleName noc@xif.com | mpowers LLC michael@mpowers.net
|
105
|
-
# 1 XIF Communications | 21010 Southbank St #575
|
106
|
-
# 2 1200 New Hampshire Avenue NW | Potomac Falls, VA 20165
|
107
|
-
# 3 Suite 410 | US
|
108
|
-
# 4 Washington, DC 20036 | +1.5712832829
|
109
|
-
# 5 US
|
110
|
-
# 6 202-463-7200 fax: 202-318-4003
|
111
|
-
|
112
|
-
# Does the first line end in something that looks like a email address?
|
113
|
-
if lines[0].to_s =~ /\S+@\S+$/
|
114
|
-
# p lines.shift
|
115
|
-
# The record has a extra name and number line
|
116
|
-
name, email = lines.shift.scan(/^(.+)\s(\S+@\S+)$/).first
|
117
|
-
name = name.strip if name
|
118
|
-
end
|
119
|
-
|
120
|
-
lines.each(&:strip!)
|
121
|
-
|
122
|
-
# Does the last line contains the word fax, or has >9 digits
|
123
|
-
if lines[-1].to_s =~ / fax: /
|
124
|
-
phone, fax = lines.pop.to_s.scan(/^(.+) fax: (.+)$/).first
|
125
|
-
phone = phone.strip
|
126
|
-
fax = fax.strip
|
127
|
-
elsif lines[-1].to_s.gsub(/[^\d]+/, '').length > 9
|
128
|
-
phone = lines.pop
|
30
|
+
if (contact = super) && !contact.state.present?
|
31
|
+
contact.state = value_for_property(element, 'State')
|
129
32
|
end
|
130
|
-
|
131
|
-
country_code = lines.pop
|
132
|
-
city, state, zip = lines.pop.scan(/^(.+), ([A-Z]{2}) ([\sA-Z0-9\-]+)$/).first
|
133
|
-
organization = lines.shift if lines.length >= 2
|
134
|
-
|
135
|
-
address = lines.join("\n")
|
136
|
-
|
137
|
-
Record::Contact.new(
|
138
|
-
:type => type,
|
139
|
-
:name => name,
|
140
|
-
:organization => organization,
|
141
|
-
:address => address,
|
142
|
-
:city => city,
|
143
|
-
:state => state,
|
144
|
-
:zip => zip,
|
145
|
-
:country_code => country_code,
|
146
|
-
:email => email,
|
147
|
-
:phone => phone,
|
148
|
-
:fax => fax
|
149
|
-
)
|
33
|
+
contact
|
150
34
|
end
|
35
|
+
|
151
36
|
end
|
37
|
+
|
152
38
|
end
|
153
39
|
end
|
154
40
|
end
|