Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

whois.nic.cz should support multiple status (closes GH-190).

  • Loading branch information...
commit 5f27dd1262e03da6f22e5d53168267c0b372cb18 1 parent 34c00cb
@weppos authored
View
2  CHANGELOG.md
@@ -39,6 +39,8 @@
- FIXED: whois.nic.cz should support status `To be deleted`.
+- FIXED: whois.nic.cz should support multiple status (GH-190).
+
## Release 2.7.0
View
11 lib/whois/record/parser/base_whoisd.rb
@@ -38,10 +38,13 @@ class BaseWhoisd < Base
property_supported :status do
- node('status') do |string|
- string = string.first if string.is_a?(Array)
- self.class.status_mapping[string.downcase] ||
- Whois.bug!(ParserError, "Unknown status `#{string}'.")
+ node('status') do |value|
+ values = Array.wrap(value)
+ status = values.each do |s|
+ v = self.class.status_mapping[s.downcase]
+ break v if v
+ end
+ status || Whois.bug!(ParserError, "Unknown status `#{string}'.")
end || :available
end
View
6 lib/whois/record/parser/whois.nic.cz.rb
@@ -20,10 +20,12 @@ class Parser
# The Example parser for the list of all available methods.
#
class WhoisNicCz < BaseWhoisd
- self.status_mapping.merge!({
+ self.status_mapping = {
+ 'paid and in zone' => :registered,
'update prohibited' => :registered,
+ 'expired' => :expired,
'to be deleted' => :expired,
- })
+ }
end
end
View
8 spec/fixtures/responses/whois.nic.cz/property_status_expired_and_more.expected
@@ -0,0 +1,8 @@
+#status
+ should: %s == :expired
+
+#available?
+ should: %s == false
+
+#registered?
+ should: %s == true
View
39 spec/whois/record/parser/responses/whois.nic.cz/property_status_expired_and_more_spec.rb
@@ -0,0 +1,39 @@
+# encoding: utf-8
+
+# This file is autogenerated. Do not edit it manually.
+# If you want change the content of this file, edit
+#
+# /spec/fixtures/responses/whois.nic.cz/property_status_expired_and_more.expected
+#
+# and regenerate the tests with the following rake task
+#
+# $ rake spec:generate
+#
+
+require 'spec_helper'
+require 'whois/record/parser/whois.nic.cz.rb'
+
+describe Whois::Record::Parser::WhoisNicCz, "property_status_expired_and_more.expected" do
+
+ subject do
+ file = fixture("responses", "whois.nic.cz/property_status_expired_and_more.txt")
+ part = Whois::Record::Part.new(:body => File.read(file))
+ described_class.new(part)
+ end
+
+ describe "#status" do
+ it do
+ subject.status.should == :expired
+ end
+ end
+ describe "#available?" do
+ it do
+ subject.available?.should == false
+ end
+ end
+ describe "#registered?" do
+ it do
+ subject.registered?.should == true
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.