Class: Hexillion::Client

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

Instance Method Summary collapse

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(options)
  response = RestClient.post "https://hexillion.com/rf/xml/1.0/auth/", :username => options[:username], :password => options[:password]
  doc = Nokogiri::XML(response)
  begin
    @session_key = doc.at_css('SessionKey').content
  rescue
    raise "Authentication failed"
  end
end

Instance Method Details

#whois(domain) ⇒ Object

Query the API for a given domain

Examples:

client.whois('flippa.com') # => { ... }


24
25
26
27
# File 'lib/hexillion.rb', line 24

def whois(domain)
  response = RestClient.get "http://hexillion.com/rf/xml/1.0/whois/", :params => {:sessionkey => @session_key, :query => domain}
  parse_xml(response.body)
end