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

Rails 3 Installation

Simply add the following line to your Gemfile and run bundle install.

gem 'abn_search'

Usage

require 'abn_search'

abn = ABNSearch.new("34355893198", "YOUR_GUID_HERE")
=> #<ABNSearch:0x0000010109bc38 @errors=[], @abn="34355893198", @WSDL_URL="http://abr.business.gov.au/ABRXMLSearch/AbrXmlSearch.asmx/ABRSearchByABN?", @ABN_LOOKUP_GUID="ac60a98a-fe5e-4a4a-bfcc-bcf30a51e1a9", @name="sony", @entity_type="IND Individual/Sole Trader"> 

puts abn.name
 => "sony"

puts abn.entity_type
=> "IND Individual/Sole Trader"  

abn.valid?
=> true

Errors

If an ABN is missing, invalid or expired - check the errors attribute.

a.errors
=> ["Business ABN 89107860122 has expired."]

Notes