whois 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,13 @@
1
1
  = Changelog
2
2
 
3
+
4
+ == Release 2.0.2
5
+
6
+ * CHANGED: whois.ripn.net now returns an array of contacts, one for each email (#89)
7
+
8
+ * FIXED: whois.nic.it parser must support UNASSIGNABLE status.
9
+
10
+
3
11
  == Release 2.0.1
4
12
 
5
13
  * FIXED: Removed invalid test files.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
1
+ The MIT License
2
2
 
3
- MIT License
3
+ Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -124,7 +124,7 @@ Any WHOIS query returns a <tt>Whois::Record</tt>. This object looks like a Strin
124
124
  r.created_on
125
125
  # => Fri Dec 10 00:00:00 +0100 1999
126
126
 
127
- t = r.technical
127
+ t = r.technical_contact
128
128
  # => #<Whois::Record::Contact>
129
129
  t.id
130
130
  # => "TS7016-ITNIC"
data/Rakefile CHANGED
@@ -34,8 +34,8 @@ spec = Gem::Specification.new do |s|
34
34
 
35
35
  s.required_ruby_version = ">= 1.8.7"
36
36
 
37
- s.author = "Simone Carletti"
38
- s.email = "weppos@weppos.net"
37
+ s.authors = ["Simone Carletti"]
38
+ s.email = ["weppos@weppos.net"]
39
39
  s.homepage = "http://www.ruby-whois.org"
40
40
  s.rubyforge_project = "whois"
41
41
 
@@ -101,13 +101,12 @@ namespace :multitest do
101
101
  end
102
102
 
103
103
 
104
- desc "Remove any temporary products, including gemspec"
105
- task :clean => [:clobber] do
106
- rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
104
+ task :clean_gemspec do
105
+ rm "#{spec.name}.gemspec" rescue nil
107
106
  end
108
107
 
109
- desc "Remove any generated file"
110
- task :clobber => [:clobber_rcov, :clobber_package]
108
+ task :clean => [:clean_gemspec]
109
+ task :clobber => [:clobber_package]
111
110
 
112
111
  desc "Package the library and generates the gemspec"
113
112
  task :package => [:gemspec]
@@ -49,6 +49,8 @@ module Whois
49
49
  :registered
50
50
  when "pendingdelete / redemptionperiod", "grace-period"
51
51
  :registered
52
+ when "unassignable"
53
+ :reserved
52
54
  when "available"
53
55
  :available
54
56
  else
@@ -61,6 +63,7 @@ module Whois
61
63
  end
62
64
 
63
65
  property_supported :registered? do
66
+ node("Status") != "UNASSIGNABLE" &&
64
67
  !available?
65
68
  end
66
69
 
@@ -67,15 +67,14 @@ module Whois
67
67
 
68
68
 
69
69
  property_supported :admin_contacts do
70
- if content_for_scanner =~ /e-mail:\s+(.+)\n/
70
+ content_for_scanner.scan(/e-mail:\s+(.+)\n/).flatten.map do |email|
71
71
  Record::Contact.new(
72
72
  :type => Record::Contact::TYPE_ADMIN,
73
73
  :name => content_for_scanner[/person:\s+(.+)\n/, 1],
74
74
  :organization => content_for_scanner[/org:\s+(.+)\n/, 1],
75
75
  :phone => content_for_scanner[/phone:\s+(.+)\n/, 1],
76
76
  :fax => content_for_scanner[/fax-no:\s+(.+)\n/, 1],
77
- # Return the first matched email, even if there are a few of them
78
- :email => content_for_scanner[/e-mail:\s+(.+)\n/, 1]
77
+ :email => email
79
78
  )
80
79
  end
81
80
  end
@@ -185,7 +185,7 @@ module Whois
185
185
  # @see Whois::Record::Parser::Base#contacts
186
186
  #
187
187
  def contacts
188
- parsers.inject([]) { |all, parser| all.concat(parser.contacts) }
188
+ parsers.map(&:contacts).flatten
189
189
  end
190
190
 
191
191
  # @endgroup
data/lib/whois/version.rb CHANGED
@@ -13,7 +13,7 @@ module Whois
13
13
  module Version
14
14
  MAJOR = 2
15
15
  MINOR = 0
16
- PATCH = 1
16
+ PATCH = 2
17
17
  BUILD = nil
18
18
 
19
19
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -0,0 +1,8 @@
1
+ #status
2
+ should: %s == :reserved
3
+
4
+ #available?
5
+ should: %s == false
6
+
7
+ #registered?
8
+ should: %s == false
@@ -0,0 +1,2 @@
1
+ Domain: la.it
2
+ Status: UNASSIGNABLE
@@ -31,7 +31,7 @@
31
31
 
32
32
  #admin_contacts
33
33
  should: %s be_a(Array)
34
- should: %s have(1).items
34
+ should: %s have(2).items
35
35
  should: %s[0] be_a(_contact)
36
36
  should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
37
37
  should: %s[0].id == nil
@@ -40,6 +40,13 @@
40
40
  should: %s[0].phone == "+1 650 330 0100"
41
41
  should: %s[0].fax == "+1 650 618 8571"
42
42
  should: %s[0].email == "dns-admin@google.com"
43
+ should: %s[1].type == Whois::Record::Contact::TYPE_ADMIN
44
+ should: %s[1].id == nil
45
+ should: %s[1].name == nil
46
+ should: %s[1].organization == "Google Inc"
47
+ should: %s[1].phone == "+1 650 330 0100"
48
+ should: %s[1].fax == "+1 650 618 8571"
49
+ should: %s[1].email == "ccops@markmonitor.com"
43
50
 
44
51
  #technical_contacts
45
52
  should: %s raise_error(Whois::PropertyNotSupported)
@@ -1,3 +1,18 @@
1
+ module Helper
2
+
3
+ # Gets the currently described class.
4
+ # Conversely to +subject+, it returns the class
5
+ # instead of an instance.
6
+ def klass
7
+ described_class
8
+ end
9
+
10
+ def fixture(*names)
11
+ File.join(SPEC_ROOT, "fixtures", *names)
12
+ end
13
+
14
+ end
15
+
1
16
  module SpecHelper
2
17
 
3
18
  private
@@ -31,17 +46,6 @@ module SpecHelper
31
46
  Whois::Record::Parser::Base.send :class_variable_set, :@@property_registry, @_property_registry
32
47
  end
33
48
 
34
- # Gets the currently described class.
35
- # Conversely to +subject+, it returns the class
36
- # instead of an instance.
37
- def klass
38
- described_class
39
- end
40
-
41
- def fixture(*names)
42
- File.join(SPEC_ROOT, "fixtures", *names)
43
- end
44
-
45
49
  def nameserver(*params)
46
50
  Whois::Record::Nameserver.new(*params)
47
51
  end
@@ -49,5 +53,6 @@ module SpecHelper
49
53
  end
50
54
 
51
55
  RSpec.configure do |config|
56
+ config.include Helper
52
57
  config.include SpecHelper
53
58
  end
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+
3
+ # This file is autogenerated. Do not edit it manually.
4
+ # If you want change the content of this file, edit
5
+ #
6
+ # /spec/fixtures/responses/whois.nic.it/property_status_unassignable.expected
7
+ #
8
+ # and regenerate the tests with the following rake task
9
+ #
10
+ # $ rake genspec:parsers
11
+ #
12
+
13
+ require 'spec_helper'
14
+ require 'whois/record/parser/whois.nic.it.rb'
15
+
16
+ describe Whois::Record::Parser::WhoisNicIt, "property_status_unassignable.expected" do
17
+
18
+ before(:each) do
19
+ file = fixture("responses", "whois.nic.it/property_status_unassignable.txt")
20
+ part = Whois::Record::Part.new(:body => File.read(file))
21
+ @parser = klass.new(part)
22
+ end
23
+
24
+ context "#status" do
25
+ it do
26
+ @parser.status.should == :reserved
27
+ end
28
+ end
29
+ context "#available?" do
30
+ it do
31
+ @parser.available?.should == false
32
+ end
33
+ end
34
+ context "#registered?" do
35
+ it do
36
+ @parser.registered?.should == false
37
+ end
38
+ end
39
+ end
@@ -69,7 +69,7 @@ describe Whois::Record::Parser::WhoisRipnNet, "status_registered.expected" do
69
69
  context "#admin_contacts" do
70
70
  it do
71
71
  @parser.admin_contacts.should be_a(Array)
72
- @parser.admin_contacts.should have(1).items
72
+ @parser.admin_contacts.should have(2).items
73
73
  @parser.admin_contacts[0].should be_a(_contact)
74
74
  @parser.admin_contacts[0].type.should == Whois::Record::Contact::TYPE_ADMIN
75
75
  @parser.admin_contacts[0].id.should == nil
@@ -78,6 +78,13 @@ describe Whois::Record::Parser::WhoisRipnNet, "status_registered.expected" do
78
78
  @parser.admin_contacts[0].phone.should == "+1 650 330 0100"
79
79
  @parser.admin_contacts[0].fax.should == "+1 650 618 8571"
80
80
  @parser.admin_contacts[0].email.should == "dns-admin@google.com"
81
+ @parser.admin_contacts[1].type.should == Whois::Record::Contact::TYPE_ADMIN
82
+ @parser.admin_contacts[1].id.should == nil
83
+ @parser.admin_contacts[1].name.should == nil
84
+ @parser.admin_contacts[1].organization.should == "Google Inc"
85
+ @parser.admin_contacts[1].phone.should == "+1 650 330 0100"
86
+ @parser.admin_contacts[1].fax.should == "+1 650 618 8571"
87
+ @parser.admin_contacts[1].email.should == "ccops@markmonitor.com"
81
88
  end
82
89
  end
83
90
  context "#technical_contacts" do