Class: CheckDomain::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/checkdomain/domain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {:name => nil}) ⇒ Domain

Returns a new instance of Domain.



7
8
9
# File 'lib/checkdomain/domain.rb', line 7

def initialize(options = {:name => nil})
  self.name = options[:name]
end

Instance Attribute Details

#availableObject

Returns the value of attribute available.



4
5
6
# File 'lib/checkdomain/domain.rb', line 4

def available
  @available
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/checkdomain/domain.rb', line 5

def message
  @message
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/checkdomain/domain.rb', line 3

def name
  @name
end

Instance Method Details

#availability!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/checkdomain/domain.rb', line 11

def availability!
  if !(self.name =~ REGEX_DOMAIN) then
    is_invalid
  else
    if (nx_domain? || opendns_nxdomain?)
      if whois_match? then
        is_taken
      else
        is_available
      end
    else
      is_taken
    end
  end
end