CompaniesHouse
The CompaniesHouse gem provides a wrapper around the Companies House API. Two methods are currently provided. One to search the Companies House database against a given string. The second to retrieve company information given a company number.
Installation
Add this line to your application's Gemfile:
gem 'companies_house_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install companies_house_api
Usage
An API key is required which can be obtained by registering with Companies House.
Configure the gem using a block in an initializer:
CompaniesHouse.configure do |config|
config.api_key = "your_api_key_here"
end
Planning ahead for future development, there are two classes, Search
and Company Information
.
To search for company information, configure as above and then instantiate a new instance of the Search
class.
ch = CompaniesHouse::Search.new
ch.search_companies("captured sparks")
This returns a plain ruby object with two attributes: a count of how many results are returned for the search and an array of those results.
To retrieve company information:
ch = CompaniesHouse::CompanyInformation.new
ch.company_profile("07577596")
ch.registered_office_address("07577596")
Again, these return plain ruby objects with attributes as shown in the API documentation for the named methods.
Contributing
- Fork it ( https://github.com/[my-github-username]/companies_house_api/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request