A simple ABN search library for validating and obtaining ABN details from the Australian Business Register.
PLEASE NOTE: You will need a GUID to be able to use the ABR business lookup API. You can obtain one at the following link; www.abr.business.gov.au/Register.aspx
Simply add the following line to your Gemfile and run bundle install.
gem 'abn_search'
require 'abn_search' abn = ABNSearch.new("34355893198", "YOUR_GUID_HERE") => #<ABNSearch:0x0000010109bc38 @errors=[], @abn="34355893198", @WS_URL="http://abr.business.gov.au/ABRXMLSearch/AbrXmlSearch.asmx/ABRSearchByABN?", @ABN_LOOKUP_GUID="ac60a98a-fe5e-4a4a-9999-bcf30a599999", @name="sony", @entity_type="IND Individual/Sole Trader"> puts abn.name => "sony" puts abn.entity_type => "IND Individual/Sole Trader" abn.valid? => true
require 'abn_search' # No authentication for proxy abn = ABNSearch.new("34355893198", "YOUR_GUID_HERE", :proxy => "http://proxy_address:9999") # HTTP Basic authenticatino for proxy abn = ABNSearch.new("34355893198", "YOUR_GUID_HERE", :proxy => "http://proxy_address:9999", :proxy_username => "user", :proxy_password => "password")
If an ABN is missing, invalid or expired - check the errors attribute.
a.errors => ["Business ABN 89107860122 has expired."]
-
Australian Business Register: www.abr.business.gov.au/
-
GUID Registration link: www.abr.business.gov.au/Register.aspx