Class: CompaniesHouse::CompanyInformation

Inherits:
Base
  • Object
show all
Defined in:
lib/companies_house/company_information.rb

Constant Summary

Constants inherited from Base

Base::API_URL

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Constructor Details

#initializeCompanyInformation

Returns a new instance of CompanyInformation.



5
6
7
# File 'lib/companies_house/company_information.rb', line 5

def initialize
  super
end

Instance Method Details

#company_profile(company_number) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/companies_house/company_information.rb', line 9

def company_profile(company_number)
  # GET /company/company_number
  url = "company/#{company_number}"
  response = @@conn.get url
  result = JSON.parse(response.body, object_class: OpenStruct)
  if result.respond_to?(:errors)
    if result.errors[0][:error] == "company-profile-not-found"
      raise CompanyNotFoundError.new("A company with that registration number could not be found")
    end
  else
    return result
  end
end