Class: Chkex::DomainInfo
- Inherits:
-
Object
- Object
- Chkex::DomainInfo
- Defined in:
- lib/chkex/domain_info.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#expires_on ⇒ Object
Returns the value of attribute expires_on.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ DomainInfo
constructor
A new instance of DomainInfo.
- #query ⇒ Object
Constructor Details
#initialize(url) ⇒ DomainInfo
Returns a new instance of DomainInfo.
5 6 7 8 9 10 11 |
# File 'lib/chkex/domain_info.rb', line 5 def initialize(url) @url = url @error = nil @expires_on = nil query end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/chkex/domain_info.rb', line 3 def error @error end |
#expires_on ⇒ Object
Returns the value of attribute expires_on.
3 4 5 |
# File 'lib/chkex/domain_info.rb', line 3 def expires_on @expires_on end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/chkex/domain_info.rb', line 3 def url @url end |
Instance Method Details
#query ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chkex/domain_info.rb', line 13 def query begin record = Whois.whois(@url) @expires_on = record.parser.expires_on raise Chkex::DomainNotFound unless @expires_on rescue Whois::ServerNotFound @error = :no_whois_server rescue Whois::AttributeNotImplemented @error = :no_expiry rescue Whois::ConnectionError @error = :connection_error rescue Timeout::Error @error = :timeout rescue Chkex::DomainNotFound => e @error = e. rescue NoMethodError @error = :no_method end end |