Repository is archived
No release in over 3 years
Low commit activity in last 3 years
Ruby wrapper for the Companies House XML Gateway
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 1.21

Runtime

< 0.10, >= 0.8.2
~> 0.5.1
~> 1.4
 Project Readme

This library should be considered unmaintained and deprecated.


Companies House Gateway

Simple Ruby Gem for interacting with the Companies House XML Gateway API. Note that registration and subscription fees may be required to use this API. For a gem to access to the newer JSON-based API (which does not require a subscription) consider the gem companies-house-rest.

Gem Version Build Status

Usage

Installation

You don't need this source code unless you want to modify the gem. If you just want to use it, you should run:

gem install companies-house-gateway

Initialising the gem

Requires your Companies House XML Gateway credentials. If you don't have any, you'll need to get in touch with Companies House.

CompaniesHouseGateway.configure do |config|
  config[:sender_id] = YOUR_SENDER_ID
  config[:password]  = YOUR_PASSWORD
  config[:email]     = YOUR_EMAIL              # Optional
end

Performing checks

Each check type has a convenience method on the top-level module:

CompaniesHouseGateway.name_search(company_name: "GoCardless")
CompaniesHouseGateway.company_details(company_number: "07495895")

The library will raise an error if you're missing any of the required parameters, or including any which can't be used.

Parsing responses

Unless you've set the "raw" argument to true in your config, checks return a hash.

CompaniesHouseGateway.name_search(...)         # => Hash of results

Set the "raw" argument to true if you need the full, unprocessed response (including headers, etc.).

CompaniesHouseGateway.config[:raw] = true
CompaniesHouseGateway.name_search(...)         # => Faraday::Response object

Caching

If you'd like to cache your requests, you can configure the gem:

CompaniesHouseGateway.config[:cache] = Rails.cache
CompaniesHouseGateway.config[:cache_args] = { expires_in: 10.minutes }