Sha256: e1981e805591dd7c3c32e28bebdd2d1f342220d9781528e722db54acc034fcf3
Contents?: true
Size: 944 Bytes
Versions: 10
Compression:
Stored size: 944 Bytes
Contents
# frozen_string_literal: true require 'faraday' require 'faraday_middleware' require 'companies_house_hub/configuration' require 'companies_house_hub/base_model' require 'companies_house_hub/errors' require 'companies_house_hub/models/company' module CompaniesHouseHub API_URL = 'https://api.companieshouse.gov.uk' module_function def configuration @configuration ||= Configuration.new end def connection @connection ||= Faraday.new(url: API_URL) do |conn| conn.basic_auth(configuration.api_key, '') conn.use FaradayMiddleware::ParseJson conn.response :json, parser_options: { symbolize_names: true } conn.response :logger if configuration.debug? conn.adapter Faraday.default_adapter end end def configure yield configuration end def root File.expand_path('../', __dir__) end def load_yml(name) YAML.load_file(File.join(root, 'data', "#{name}.yml")) end end
Version data entries
10 entries across 10 versions & 1 rubygems