Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
705 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class Time | ||
|
||
# Returns a new Time where one or more of the elements have been changed according | ||
# to the +options+ parameter. The time options (<tt>:hour</tt>, <tt>:min</tt>, | ||
# <tt>:sec</tt>, <tt>:usec</tt>) reset cascadingly, so if only the hour is passed, | ||
# then minute, sec, and usec is set to 0. If the hour and minute is passed, then | ||
# sec and usec is set to 0. The +options+ parameter takes a hash with any of these | ||
# keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, <tt>:hour</tt>, <tt>:min</tt>, | ||
# <tt>:sec</tt>, <tt>:usec</tt>. | ||
# | ||
# Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0) | ||
# Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0) | ||
# Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0) | ||
def change(options) | ||
new_year = options.fetch(:year, year) | ||
new_month = options.fetch(:month, month) | ||
new_day = options.fetch(:day, day) | ||
new_hour = options.fetch(:hour, hour) | ||
new_min = options.fetch(:min, options[:hour] ? 0 : min) | ||
new_sec = options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) | ||
new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000)) | ||
|
||
if utc? | ||
::Time.utc(new_year, new_month, new_day, new_hour, new_min, new_sec, new_usec) | ||
elsif zone | ||
::Time.local(new_year, new_month, new_day, new_hour, new_min, new_sec, new_usec) | ||
else | ||
::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec + (new_usec.to_r / 1000000), utc_offset) | ||
end | ||
end unless method_defined? :change | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#-- | ||
# Ruby Whois | ||
# | ||
# An intelligent pure Ruby WHOIS client and parser. | ||
# | ||
# Copyright (c) 2009-2014 Simone Carletti <weppos@weppos.net> | ||
#++ | ||
|
||
|
||
require 'whois/record/parser/base_icann_compliant' | ||
|
||
|
||
module Whois | ||
class Record | ||
class Parser | ||
|
||
# Parser for the whois.donuts.com server. | ||
# | ||
# @see Whois::Record::Parser::Example | ||
# The Example parser for the list of all available methods. | ||
# | ||
class WhoisUniregistryNet < BaseIcannCompliant | ||
self.scanner = Scanners::BaseIcannCompliant, { | ||
pattern_available: />>> Domain \".+\" is available/ | ||
} | ||
|
||
|
||
property_supported :domain_id do | ||
node('Domain ID') | ||
end | ||
|
||
|
||
property_supported :expires_on do | ||
node('Registry Expiry Date') do |value| | ||
parse_time(value) | ||
end | ||
end | ||
|
||
|
||
property_supported :registrar do | ||
return unless node('Sponsoring Registrar') | ||
Record::Registrar.new( | ||
id: node('Sponsoring Registrar IANA ID'), | ||
name: node('Sponsoring Registrar'), | ||
organization: node('Sponsoring Registrar') | ||
) | ||
end | ||
|
||
|
||
private | ||
|
||
def build_contact(element, type) | ||
if (contact = super) | ||
contact.id = node("#{element} ID") | ||
end | ||
contact | ||
end | ||
|
||
def parse_time(value) | ||
Time.parse(value).change(usec: 0) | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end |
47 changes: 47 additions & 0 deletions
47
spec/fixtures/responses/whois.uniregistry.net/tattoo/status_available.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#domain | ||
%s == nil | ||
|
||
#domain_id | ||
%s == nil | ||
|
||
|
||
#status | ||
%s == :available | ||
|
||
#available? | ||
%s == true | ||
|
||
#registered? | ||
%s == false | ||
|
||
|
||
#created_on | ||
%s == nil | ||
|
||
#updated_on | ||
%s == nil | ||
|
||
#expires_on | ||
%s == nil | ||
|
||
|
||
#registrar | ||
%s == nil | ||
|
||
|
||
#registrant_contacts | ||
%s %CLASS{array} | ||
%s == [] | ||
|
||
#admin_contacts | ||
%s %CLASS{array} | ||
%s == [] | ||
|
||
#technical_contacts | ||
%s %CLASS{array} | ||
%s == [] | ||
|
||
|
||
#nameservers | ||
%s %CLASS{array} | ||
%s == [] |
39 changes: 39 additions & 0 deletions
39
spec/fixtures/responses/whois.uniregistry.net/tattoo/status_available.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
>>> Domain "u34jedzcq.tattoo" is available for registration | ||
|
||
>>> Please visit http://uniregistry.com/registry/where-to-buy for a | ||
>>> list of accredited registrars. | ||
|
||
|
||
>>> Last update of WHOIS database: 2014-03-10T17:08:32.890Z <<< | ||
|
||
|
||
The WHOIS information provided on this page is intended to provide you | ||
with relevant contact information for a domain name registrant and the | ||
identity of certain administrative and technical contacts associated | ||
with the domain name. | ||
|
||
The data in this record is provided by Uniregistry for informational | ||
purposes only, and it does not guarantee its accuracy. Uniregistry is | ||
authoritative for whois information in top-level domains it operates | ||
under contract with the Internet Corporation for Assigned Names and | ||
Numbers. Whois information from other top-level domains is provided by | ||
a third-party under license to Uniregistry. | ||
|
||
This service is intended only for query-based access. By using this | ||
service, you agree that you will use any data presented only for lawful | ||
purposes and that, under no circumstances will you use (a) data | ||
acquired for the purpose of allowing, enabling, or otherwise supporting | ||
the transmission by e-mail, telephone, facsimile or other | ||
communications mechanism of mass unsolicited, commercial advertising | ||
or solicitations to entities other than your existing customers; or | ||
(b) this service to enable high volume, automated, electronic processes | ||
that send queries or data to the systems of any Registrar or any | ||
Registry except as reasonably necessary to register domain names or | ||
modify existing domain name registrations. | ||
|
||
Uniregistry reserves the right to modify these terms at any time. By | ||
submitting this query, you agree to abide by this policy. All rights | ||
reserved. | ||
|
118 changes: 118 additions & 0 deletions
118
spec/fixtures/responses/whois.uniregistry.net/tattoo/status_registered.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#domain | ||
%s == "nic.tattoo" | ||
|
||
#domain_id | ||
%s == "DO_4810ec9890fdf872f2e23b58df485dc4-ISC" | ||
|
||
|
||
#status | ||
%s == :registered | ||
|
||
#available? | ||
%s == false | ||
|
||
#registered? | ||
%s == true | ||
|
||
|
||
#created_on | ||
%s %CLASS{time} | ||
%s %TIME{2013-09-16 14:21:26 UTC} | ||
|
||
#updated_on | ||
%s %CLASS{time} | ||
%s %TIME{2013-11-09 02:51:24 UTC} | ||
|
||
#expires_on | ||
%s %CLASS{time} | ||
%s %TIME{2023-09-16 14:21:26 UTC} | ||
|
||
|
||
#registrar | ||
%s %CLASS{registrar} | ||
%s.id == "9999" | ||
%s.name == "Uniregistry, Corp." | ||
%s.organization == "Uniregistry, Corp." | ||
%s.url == nil | ||
|
||
|
||
#registrant_contacts | ||
%s %CLASS{array} | ||
%s %SIZE{1} | ||
%s[0] %CLASS{contact} | ||
%s[0].type == Whois::Record::Contact::TYPE_REGISTRANT | ||
%s[0].id == "uniregistry" | ||
%s[0].name == "Uniregistry Registry Internal Resources" | ||
%s[0].organization == "Uniregistry, Corp" | ||
%s[0].address == "PO Box 1361" | ||
%s[0].city == "Grand Cayman" | ||
%s[0].zip == "KY1-1108" | ||
%s[0].state == "George Town" | ||
%s[0].country == nil | ||
%s[0].country_code == "KY" | ||
%s[0].phone == "+1.3457496263" | ||
%s[0].fax == "+1.3457496263" | ||
%s[0].email == "info+whois@uniregistry.com" | ||
%s[0].created_on == nil | ||
%s[0].updated_on == nil | ||
|
||
#admin_contacts | ||
%s %CLASS{array} | ||
%s %SIZE{1} | ||
%s[0] %CLASS{contact} | ||
%s[0].type == Whois::Record::Contact::TYPE_ADMINISTRATIVE | ||
%s[0].id == "tattoo-admin" | ||
%s[0].name == "Uniregistry admin contact" | ||
%s[0].organization == "Uniregistry, Corp" | ||
%s[0].address == "PO Box 1361" | ||
%s[0].city == "Grand Cayman" | ||
%s[0].zip == "KY1-1108" | ||
%s[0].state == "George Town" | ||
%s[0].country == nil | ||
%s[0].country_code == "KY" | ||
%s[0].phone == "+1.3457496263" | ||
%s[0].fax == "+1.3457496263" | ||
%s[0].email == "admin@nic.tattoo" | ||
%s[0].created_on == nil | ||
%s[0].updated_on == nil | ||
|
||
#technical_contacts | ||
%s %CLASS{array} | ||
%s %SIZE{1} | ||
%s[0] %CLASS{contact} | ||
%s[0].type == Whois::Record::Contact::TYPE_TECHNICAL | ||
%s[0].id == "tattoo-tech" | ||
%s[0].name == "Uniregistry tech contact" | ||
%s[0].organization == "Uniregistry, Corp" | ||
%s[0].address == "PO Box 1361" | ||
%s[0].city == "Grand Cayman" | ||
%s[0].zip == "KY1-1108" | ||
%s[0].state == "George Town" | ||
%s[0].country == nil | ||
%s[0].country_code == "KY" | ||
%s[0].phone == "+1.3457496263" | ||
%s[0].fax == "+1.3457496263" | ||
%s[0].email == "tech@nic.tattoo" | ||
%s[0].created_on == nil | ||
%s[0].updated_on == nil | ||
|
||
|
||
#nameservers | ||
%s %CLASS{array} | ||
%s %SIZE{4} | ||
%s[0] %CLASS{nameserver} | ||
%s[0].name == "a.ns.uniregistry.net" | ||
%s[0].ipv4 == nil | ||
%s[0].ipv6 == nil | ||
%s[1] %CLASS{nameserver} | ||
%s[1].name == "tld.isc-sns.info" | ||
%s[1].ipv4 == nil | ||
%s[1].ipv6 == nil | ||
%s[2] %CLASS{nameserver} | ||
%s[2].name == "tld.isc-sns.com" | ||
%s[2].ipv4 == nil | ||
%s[2].ipv6 == nil | ||
%s[3] %CLASS{nameserver} | ||
%s[3].name == "tld.isc-sns.net" | ||
%s[3].ipv4 == nil | ||
%s[3].ipv6 == nil |
Oops, something went wrong.