Project

abn_search

0.02
No release in over 3 years
Low commit activity in last 3 years
A simple ABN search library for validating and obtaining ABN details from the Australian Business Register.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

abn_search CircleCI Coverage Status

A simple ABN search library for validating and obtaining ABN details from the Australian Business Register.

Setup

Dependencies

  • Ruby 2.0 +

  • bundler

ABR GUID

You will need a GUID to be able to use the ABR business lookup API. You can obtain one at the following link; http://abr.business.gov.au/Documentation/UserGuideWebRegistration.aspx

Rails Installation

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

gem 'abn_search'

Tests

You can run the test suite with

bundle exec rake

or

bundle exec rake rspec

Please ensure that you write tests for any commits, and that tests pass locally before you submit a PR.

Usage

To start IRB with the gem

bundle exec rake console

Set up a client

client = Abn::Client.new("YOUR_GUID_HERE")

Search by ABN Number

result = client.search("59001215354")
# => {:acn=>"001215354", ":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 ACN Number

result = client.search_by_acn("001215354")
# => {:acn=>"001215354", ":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"}

Search by name

results = client.search_by_name("Sony", ['NSW'], '2000')
results.each do |result|
  puts result[:name]
end

Errors

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

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

External Resources