Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

companies_house_client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

companies_house_client

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CompaniesHouseClient

A wrapper around the Companies House Rest API.

There is another gem which does this, open-companies-house but it doesn't include authentication.

Installation

Install with Bundler like this:

gem 'companies_house_client'

Or manually:

gem install companies_house_client

Setup

Set up CompaniesHouseClient in a block:

CompaniesHouseClient.configure do |config|
    config.api_token #your token from https://developer.companieshouse.gov.uk/developer/applications
    config.ssl_settings #this gem uses Faraday; you need to point it at the appropriate CA bundle for your platform
end

SSL Setup

SSL is a bit of a faff, because you need a CA bundle for Faraday.

The configuration setting ssl_settings is a hash. You need to pass ca_path into it, with the appropriate location for your bundle.

Use

Getting a company by Company Number

Note that the leading zero in a company number is important so you have to pass find() a string.

c = CompaniesHouseClient::Company.find("company number")
c #returns a company.

Searching for a company by name

You can search for a company like this:

companies = CompaniesHouseClient::Company.search("your search", per_page: 10, page: 2)
companies #returns a collection of Companies which match your search.

per_page and page are optional.

Company Officers

Companies have many officers. You can retrieve them like this:

c = CompaniesHouseClient::Company.find("company number")
c.officers #returns a collection of Officer objects.

If you just want a list of officers for a given company, you can save a request to the /company endpoint like this:

CompaniesHouseClient::Officer.all(company_id: "company number") #will return a collection directly from the officers endpoint

Filing History

You can get a list of the company's filing history entries like this:

c = CompaniesHouseClient::Company.find("company number")
c.filing_histories #returns a collection of FilingHistory objects - note plural on the relation name

To do

  • There are Appointments and Charges endpoints set up, and they're documented in the API docs, but they return a 404 for all companies. No idea why.
  • Some tests would be nice.
  • There an issue with the Her where it expects the child resource to have a reference to a parent, which this API doesn't. So you get (<unknown path, missing company_id>) in the responses for child objects. There is probably a solution.

Licence

This gem is MIT licenced. Have fun!

FAQs

Package last updated on 03 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc