Class: ARIN::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arin-whois.rb

Direct Known Subclasses

ASN, Customer, Net, Org, POC, Rdns

Class Method Summary collapse

Class Method Details

.get_resource(rootel, query) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/arin-whois.rb', line 11

def self.get_resource(rootel, query)
  begin
    resource["#{rootel}/#{query}.json"].get
  rescue RestClient::ResourceNotFound
    raise RecordNotFound
  end
end

.parse_and_objectify(rootel, query) ⇒ Object



19
20
21
# File 'lib/arin-whois.rb', line 19

def self.parse_and_objectify(rootel, query)
  Hashie::Mash.new(JSON.parse(get_resource(rootel, query))[rootel])
end

.resourceObject



7
8
9
# File 'lib/arin-whois.rb', line 7

def self.resource
  RestClient::Resource.new 'http://whois.arin.net/rest'
end

.root_element(classname) ⇒ Object



23
24
25
# File 'lib/arin-whois.rb', line 23

def self.root_element(classname)
  classname.split('::').last.downcase
end