Skip to content

Commit

Permalink
Updated whois.arnesi.si to the new response format
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed May 13, 2014
1 parent b65aea2 commit 7061db7
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 42 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@

- CHANGED: Updated whois.gg to the new response format.

- CHANGED: Updated whois.arnesi.si to the new response format.


#### Release 3.5.3

Expand Down
27 changes: 14 additions & 13 deletions lib/whois/record/parser/whois.arnes.si.rb
Expand Up @@ -14,25 +14,26 @@ module Whois
class Record
class Parser

# Parser for the whois.arnesi.si server.
#
# = whois.arnes.si parser
# @note This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
#
# Parser for the whois.arnes.si server.
#
# NOTE: This parser is just a stub and provides only a few basic methods
# to check for domain availability and get domain status.
# Please consider to contribute implementing missing methods.
# See WhoisNicIt parser for an explanation of all available methods
# and examples.
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
class WhoisArnesSi < Base

property_supported :status do
if content_for_scanner =~ /status:\s+(.+)\n/
case $1.downcase
when "ok" then :registered
else
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
statuses = $1.strip.downcase.split(",")
if statuses.include?("ok")
:registered
elsif statuses.include?("serverupdateprohibited")
:registered
else
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
end
else
:available
Expand Down Expand Up @@ -65,7 +66,7 @@ class WhoisArnesSi < Base

property_supported :nameservers do
content_for_scanner.scan(/nameserver:\s+(.+)\n/).flatten.map do |name|
Record::Nameserver.new(:name => name)
Record::Nameserver.new(name: name.strip)
end
end

Expand Down
@@ -0,0 +1,8 @@
#status
%s == :registered

#available?
%s == false

#registered?
%s == true
51 changes: 51 additions & 0 deletions spec/fixtures/responses/whois.arnes.si/property_status_ok.txt
@@ -0,0 +1,51 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is ARNES whois database
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Rights restricted by copyright.
% See http://www.arnes.si/domene/whois-legal.html
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The WHOIS service offered by Arnes, .si Registry, is
% provided for information purposes only. It allows persons
% to check whether a specific domain name is still available
% or not and to obtain information related to the registration
% records of existing domain names.
%
% This WHOIS service accepts and displays only ASCII characters.
%
% Arnes cannot be held liable should the stored information
% prove to be wrong, incomplete or inaccurate in any sense.
%
% By submitting a query you agree not to use the information
% made available to:
% o Allow, enable or otherwise support the transmission
% of unsolicited, commercial advertising or other solicitations
% whether via email or otherwise;
% o Target advertising in any possible way;
% o Cause nuisance in any possible way to the registrants
% by sending (whether by automated, electronic processes
% capable of enabling high volumes or other possible
% means) messages to them;
% o copy, extract and/or publish contents of the WHOIS database.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

domain: paypal-topup.si
registrar: AOI d.o.o.
registrar-url: http://www.aoi.eu/arneswhois
nameserver: ns3.isc-sns.info
nameserver: ns1.isc-sns.net
nameserver: ns2.isc-sns.com
status: ok
created: 2012-07-19
expire: 2014-07-19
source: ARNES

Domain holder:
NOT DISCLOSED

Tech:
NOT DISCLOSED

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For more information, please visit http://www.registry.si/whois.html
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5 changes: 4 additions & 1 deletion spec/fixtures/responses/whois.arnes.si/status_available.txt
Expand Up @@ -10,6 +10,8 @@
% or not and to obtain information related to the registration
% records of existing domain names.
%
% This WHOIS service accepts and displays only ASCII characters.
%
% Arnes cannot be held liable should the stored information
% prove to be wrong, incomplete or inaccurate in any sense.
%
Expand All @@ -22,7 +24,8 @@
% o Cause nuisance in any possible way to the registrants
% by sending (whether by automated, electronic processes
% capable of enabling high volumes or other possible
% means) messages to them.
% means) messages to them;
% o copy, extract and/or publish contents of the WHOIS database.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% No entries found for the selected source(s).
Expand Down
Expand Up @@ -17,7 +17,7 @@

#expires_on
%s %CLASS{time}
%s %TIME{2010-07-19}
%s %TIME{2014-07-19}


#nameservers
Expand Down
49 changes: 23 additions & 26 deletions spec/fixtures/responses/whois.arnes.si/status_registered.txt
Expand Up @@ -10,6 +10,8 @@
% or not and to obtain information related to the registration
% records of existing domain names.
%
% This WHOIS service accepts and displays only ASCII characters.
%
% Arnes cannot be held liable should the stored information
% prove to be wrong, incomplete or inaccurate in any sense.
%
Expand All @@ -22,34 +24,29 @@
% o Cause nuisance in any possible way to the registrants
% by sending (whether by automated, electronic processes
% capable of enabling high volumes or other possible
% means) messages to them.
% means) messages to them;
% o copy, extract and/or publish contents of the WHOIS database.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

domain: google.si
registrar: AOI d.o.o.
registrar-url: http://www.aoi.eu/arneswhois
nameserver: ns1.google.com
nameserver: ns2.google.com
nameserver: ns3.google.com
nameserver: ns4.google.com
tech-c: O157350
registrant: G58334
status: ok
created: 2005-04-04
expire: 2010-07-19
source: ARNES
domain: google.si
registrar: AOI d.o.o.
registrar-url: http://www.aoi.eu/arneswhois
nameserver: ns1.google.com
nameserver: ns2.google.com
nameserver: ns3.google.com
nameserver: ns4.google.com
status: serverDeleteProhibited,serverTransferProhibited,serverUpdateProhibited
created: 2005-04-04
expire: 2014-07-19
source: ARNES

Domain holder:
NOT DISCLOSED

organization: MARK - INVENTA d.o.o.
nic-hdl: G58334
email: mark-inventa@siol.net
phone: +386.14266503
fax-no: +386.12527202
address: Rimska 6
address: 1000 Ljubljana
address: SI
source: ARNES
Tech:
NOT DISCLOSED

email: ccops@markmonitor.com
nic-hdl: O157350
source: ARNES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For more information, please visit http://www.registry.si/whois.html
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

@@ -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.arnes.si/property_status_ok.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#

require 'spec_helper'
require 'whois/record/parser/whois.arnes.si.rb'

describe Whois::Record::Parser::WhoisArnesSi, "property_status_ok.expected" do

subject do
file = fixture("responses", "whois.arnes.si/property_status_ok.txt")
part = Whois::Record::Part.new(body: File.read(file))
described_class.new(part)
end

describe "#status" do
it do
expect(subject.status).to eq(:registered)
end
end
describe "#available?" do
it do
expect(subject.available?).to eq(false)
end
end
describe "#registered?" do
it do
expect(subject.registered?).to eq(true)
end
end
end
Expand Up @@ -50,7 +50,7 @@
describe "#expires_on" do
it do
expect(subject.expires_on).to be_a(Time)
expect(subject.expires_on).to eq(Time.parse("2010-07-19"))
expect(subject.expires_on).to eq(Time.parse("2014-07-19"))
end
end
describe "#nameservers" do
Expand Down

0 comments on commit 7061db7

Please sign in to comment.