Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Strings instead of symbols in scanner

  • Loading branch information...
commit 4ceac05576ace35f74cabe9084d1e74b0d75bd00 1 parent fa5ef51
@rorymckinley rorymckinley authored
View
27 lib/whois/record/parser/whois.registry.net.za.rb
@@ -18,11 +18,11 @@ class WhoisRegistryNetZa < Base
include Scanners::Nodable
property_supported :disclaimer do
- node(:disclaimer)
+ node("field:disclaimer")
end
property_supported :domain do
- node(:domain_name)
+ node("field:domain_name")
end
property_not_supported :domain_id
@@ -32,11 +32,11 @@ class WhoisRegistryNetZa < Base
property_not_supported :referral_url
property_supported :status do
- node(:status)
+ node("field:status")
end
property_supported :available? do
- node(:available) ? true : false
+ node("status:available") ? true : false
end
property_supported :registered? do
@@ -44,24 +44,24 @@ class WhoisRegistryNetZa < Base
end
property_supported :created_on do
- parse_date(node(:registration_date))
+ parse_date(node("field:registration_date"))
end
property_not_supported :updated_on
property_supported :expires_on do
- parse_date(node(:renewal_date))
+ parse_date(node("field:renewal_date"))
end
property_supported :registrar do
- node(:registrar_id) do
- Whois::Record::Registrar.new(:name => node(:registrar_name), :id => node(:registrar_id))
+ node("field:registrar_id") do
+ Whois::Record::Registrar.new(:name => node("field:registrar_name"), :id => node("field:registrar_id"))
end
end
# The response for this property gets wrapped in an array by Whois::Record::Parser::Base#handle_property
property_supported :registrant_contacts do
- node(:registrant_name) do
+ node("field:registrant_name") do
build_registrant_contacts
end
end
@@ -71,7 +71,7 @@ class WhoisRegistryNetZa < Base
property_not_supported :technical_contacts
property_supported :nameservers do
- Array.wrap(node(:nameservers)).map do |nameserver|
+ Array.wrap(node("field:nameservers")).map do |nameserver|
Record::Nameserver.new(:name => nameserver)
end
end
@@ -89,11 +89,14 @@ def build_registrant_contacts
end
def registrant_details
- { :name => node(:registrant_name), :email => node(:registrant_email), :phone => node(:registrant_telephone), :fax => node(:registrant_fax)}
+ {
+ :name => node("field:registrant_name"), :email => node("field:registrant_email"),
+ :phone => node("field:registrant_telephone"), :fax => node("field:registrant_fax")
+ }
end
def registrant_address_details
- { :address => node(:registrant_address) }
+ { :address => node("field:registrant_address") }
end
def parse_date(date_string)
View
28 lib/whois/record/scanners/whois.registry.net.za.rb
@@ -28,70 +28,70 @@ class WhoisRegistryNetZa < Base
tokenizer :get_availability do
if @input.scan_until(/^Available\n$/m)
- @ast[:available] = true
+ @ast["status:available"] = true
end
end
tokenizer :get_domain_name do
if find_heading("Domain Name")
- @ast[:domain_name] = content_in_category
+ @ast["field:domain_name"] = content_in_category
end
end
tokenizer :get_registrant_details do
if find_heading("Registrant")
registrant_lines = content_in_category.split("\n")
- @ast[:registrant_name] = registrant_lines.shift
- [:registrant_email, :registrant_telephone, :registrant_fax].each do |contact_method|
- @ast[contact_method] = registrant_lines.shift.split(":").last.strip
+ @ast["field:registrant_name"] = registrant_lines.shift
+ ["registrant_email", "registrant_telephone", "registrant_fax"].each do |contact_method|
+ @ast["field:#{contact_method}"] = registrant_lines.shift.split(":").last.strip
end
end
end
tokenizer :get_registrant_address do
if find_heading("Registrant's Address")
- @ast[:registrant_address] = content_in_category.gsub(/\n\s+/, " ")
+ @ast["field:registrant_address"] = content_in_category.gsub(/\n\s+/, " ")
end
end
tokenizer :get_registrar_details do
if find_heading("Registrar")
content_in_category =~ /(.+) \[ ID = (.+) \]/
- @ast[:registrar_name] = $1.strip
- @ast[:registrar_id] = $2.strip
+ @ast["field:registrar_name"] = $1.strip
+ @ast["field:registrar_id"] = $2.strip
end
end
tokenizer :get_dates do
if find_heading("Relevant Dates")
dates = content_in_category.split("\n")
- @ast[:registration_date] = dates.shift.split(":").last.strip
- @ast[:renewal_date] = dates.shift.split(":").last.strip
+ @ast["field:registration_date"] = dates.shift.split(":").last.strip
+ @ast["field:renewal_date"] = dates.shift.split(":").last.strip
end
end
tokenizer :get_status do
if find_heading("Domain Status")
statuses = content_in_category
- @ast[:status] = statuses.split(", ")
+ @ast["field:status"] = statuses.split(", ")
end
end
tokenizer :get_pending_timer_events do
if find_heading("Pending Timer Events")
- @ast[:pending_timer_events] = content_in_category
+ @ast["field:pending_timer_events"] = content_in_category
end
end
tokenizer :get_nameservers do
if find_heading("Name Servers")
- @ast[:nameservers] = content_in_category.gsub(/\n\s+/, ",").split(",")
+ @ast["field:nameservers"] = content_in_category.gsub(/\n\s+/, ",").split(",")
end
end
tokenizer :get_disclaimer do
@input.skip_until(/\n--\n/m)
- @ast[:disclaimer] = @input.scan_until(/.*$/m)
+ @ast["field:disclaimer"] = @input.scan_until(/.*$/m)
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.