Important: Gem has been updated to support searching the Australian Business Registry (ABR) by name as well as abn. The syntax to call and validate ABN’s has changed!

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'

# Search by ABN Number
abn = ABNSearch.new("YOUR_GUID_HERE")
result = abn.search("59001215354")
=> {:abn=>"59001215354", :entity_type=>"Australian Public Company", :status=>"Active", :main_name=>"SONY AUSTRALIA LIMITED", :trading_name=>"", :legal_name=>"", :other_trading_name=>"", :name=>"SONY AUSTRALIA LIMITED"}

puts result[:entity_type]
=> "Australian Public Company"

puts result[:status]
=> "Active"

puts result[:name]
=> "SONY AUSTRALIA LIMITED"

# Search by name
results = abn.search_by_name("Sony", ['NSW'], '2000')

puts results

Errors

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

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

Notes