Class: Hexillion::Client
- Inherits:
-
Object
- Object
- Hexillion::Client
- Defined in:
- lib/hexillion.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#whois(domain, extra_params = {}) ⇒ Object
Query the API for a given domain.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 14 15 |
# File 'lib/hexillion.rb', line 7 def initialize() response = RestClient.post "https://hexillion.com/rf/xml/1.0/auth/", :username => [:username], :password => [:password] doc = Nokogiri::XML(response) begin @session_key = doc.at_css('SessionKey').content rescue raise "Authentication failed" end end |
Instance Method Details
#whois(domain, extra_params = {}) ⇒ Object
Query the API for a given domain
24 25 26 27 28 29 30 |
# File 'lib/hexillion.rb', line 24 def whois(domain, extra_params = {}) base_params = {:sessionkey => @session_key, :query => domain} params = base_params.merge(extra_params) response = RestClient.get "http://hexillion.com/rf/xml/1.0/whois/", :params => params parse_xml(response.body) end |