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, extra_params = {}) ⇒ Object

Query the API for a given domain

Examples:

client.whois('flippa.com', {optional_param: value, ...}) # => { ... }


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