Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AFNIC parsers date format #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/whois/parsers/base_nic_fr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,19 @@ class BaseNicFr < Base

property_supported :created_on do
if content_for_scanner =~ /created:\s+(.+)\n/
d, m, y = $1.split("/")
parse_time("#{y}-#{m}-#{d}")
parse_time($1)
end
end

property_supported :updated_on do
if content_for_scanner =~ /last-update:\s+(.+)\n/
d, m, y = $1.split("/")
parse_time("#{y}-#{m}-#{d}")
parse_time($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Expiry Date:\s+(.+)\n/
d, m, y = $1.split("/")
parse_time("#{y}-#{m}-#{d}")
parse_time($1)
end
end

Expand Down Expand Up @@ -136,7 +133,7 @@ def parse_contact(element, type)
end
end

updated_on = values["changed"] ? Time.utc(*values["changed"].split(" ").first.split("/").reverse) : nil
updated_on = values["changed"] ? parse_time(values["changed"].split(" ").first) : nil

Parser::Contact.new({
:type => type,
Expand Down
25 changes: 25 additions & 0 deletions lib/whois/parsers/whois.nic.yt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <[email protected]>
#++


require_relative 'base_nic_fr'


module Whois
class Parsers

# Parser for the whois.nic.yt server.
#
# @see Whois::Parsers::Example
# The Example parser for the list of all available methods.
#
class WhoisNicYt < BaseNicFr
end

end
end

This file was deleted.

This file was deleted.

66 changes: 31 additions & 35 deletions spec/fixtures/responses/whois.nic.fr/fr/status_registered.expected
Original file line number Diff line number Diff line change
Expand Up @@ -10,83 +10,79 @@

#created_on
%s %CLASS{time}
%s %TIME{2000-07-27}
%s %TIME{2004-05-20 11:28:40 UTC}

#updated_on
%s %CLASS{time}
%s %TIME{2016-12-30}
%s %TIME{2018-04-08 03:52:04 UTC}

#expires_on
%s %CLASS{time}
%s %TIME{2017-12-30}
%s %TIME{2019-05-07 07:43:45 UTC}


#registrant_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_REGISTRANT
%s[0].id == "GIH6-FRNIC"
%s[0].id == "U4339-FRNIC"
%s[0].name == nil
%s[0].organization == "Google Ireland Holdings"
%s[0].address == "70 Sir John Rogersons Quay\n2 Dublin"
%s[0].organization == "1C2"
%s[0].address == "20-22, rue Louis Armand\n75015 Paris"
%s[0].city == nil
%s[0].zip == nil
%s[0].state == nil
%s[0].country == nil
%s[0].country_code == "IE"
%s[0].phone == "+353 14361000"
%s[0].country_code == "FR"
%s[0].phone == "+33 1 30 62 40 06"
%s[0].fax == nil
%s[0].email == "dns-admin@google.com"
%s[0].updated_on %TIME{2015-03-20 00:00:00 UTC}
%s[0].email == "jmr@1c2.com"
%s[0].updated_on %TIME{2016-09-22 07:52:47 UTC}

#admin_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_ADMINISTRATIVE
%s[0].id == "GIH5-FRNIC"
%s[0].name == nil
%s[0].organization == "Google Ireland Holdings"
%s[0].address == "70 Sir John Rogersons Quay\n2 Dublin"
%s[0].id == "MO2494-FRNIC"
%s[0].name == "Magic Online"
%s[0].organization == "Magic Online"
%s[0].address == "130, avenue President Wilson\n93100 Montreuil\nParis"
%s[0].city == nil
%s[0].zip == nil
%s[0].state == nil
%s[0].country == nil
%s[0].country_code == "IE"
%s[0].phone == "+353 14361000"
%s[0].fax == nil
%s[0].email == "[email protected]"
%s[0].updated_on %TIME{2011-12-06 00:00:00 UTC}
%s[0].country_code == "FR"
%s[0].phone == "+33 1 41 58 22 50"
%s[0].fax == "+33 1 56 72 93 30"
%s[0].email == "[email protected]"
%s[0].updated_on %TIME{2014-03-31 16:13:52 UTC}

#technical_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_TECHNICAL
%s[0].id == "CP4370-FRNIC"
%s[0].name == "Ccops Provisioning"
%s[0].organization == "MarkMonitor"
%s[0].address == "10400 Overland Rd.\nPMB 155\n83709 Boise"
%s[0].id == "MO2556-FRNIC"
%s[0].name == "Magic Online"
%s[0].organization == "Magic Online"
%s[0].address == "130-134, avenue du President Wilson\n93100 Montreuil\nFrance"
%s[0].city == nil
%s[0].zip == nil
%s[0].state == nil
%s[0].country == nil
%s[0].country_code == "US"
%s[0].phone == "+1 2083895740"
%s[0].fax == "+1 2083895771"
%s[0].email == "[email protected]"
%s[0].updated_on %TIME{2011-06-14 00:00:00 UTC}
%s[0].country_code == "FR"
%s[0].phone == "+33 1 41 58 22 50"
%s[0].fax == "+33 1 56 72 93 30"
%s[0].email == "[email protected]"
%s[0].updated_on %TIME{2014-05-20 15:07:08 UTC}


#nameservers
%s %CLASS{array}
%s %SIZE{4}
%s %SIZE{2}
%s[0] %CLASS{nameserver}
%s[0].name == "ns1.google.com"
%s[0].name == "ns.magic.fr"
%s[1] %CLASS{nameserver}
%s[1].name == "ns2.google.com"
%s[2] %CLASS{nameserver}
%s[2].name == "ns3.google.com"
%s[3] %CLASS{nameserver}
%s[3].name == "ns4.google.com"
%s[1].name == "ns2.magic.fr"
Loading