Module: DefraRuby::CompaniesHouse

Defined in:
lib/defra_ruby/companies_house.rb,
lib/defra_ruby/companies_house/api.rb,
lib/defra_ruby/companies_house/engine.rb,
lib/defra_ruby/companies_house/version.rb,
lib/defra_ruby/companies_house/configuration.rb

Defined Under Namespace

Classes: API, ApiTimeoutError, CompanyNotFoundError, Configuration, Engine, InvalidCompanyNumberError

Constant Summary collapse

VALID_COMPANY_NUMBER_REGEX =
/\A(\d{8,8}$)|([a-zA-Z]{2}\d{6}$)|([a-zA-Z]{2}\d{5}[a-zA-Z]{1}$)\z/i
VERSION =
"1.0.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



14
15
16
# File 'lib/defra_ruby/companies_house.rb', line 14

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



17
18
19
20
# File 'lib/defra_ruby/companies_house.rb', line 17

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.loggerObject

Use DefraRubyGovpay.logger if it exists, else use a simple console logger



23
24
25
# File 'lib/defra_ruby/companies_house.rb', line 23

def self.logger
  @logger ||= defined?(Rails) ? Rails.logger : Logger.new($stdout)
end

.logger=(logger) ⇒ Object



27
28
29
# File 'lib/defra_ruby/companies_house.rb', line 27

def self.logger=(logger)
  @logger = logger
end