Sha256: bf3a1db149bea31cbb222fdfc78148f962346a4eee36a7e5f8d1473ade9ac7cf
Contents?: true
Size: 629 Bytes
Versions: 11
Compression:
Stored size: 629 Bytes
Contents
# frozen_string_literal: true require 'companies_house_hub/errors' module CompaniesHouseHub class BaseModel def self.get(path, params) result = CompaniesHouseHub.connection.get(path, params) raise APIKeyError, result.body[:error] if result.status == 401 result end def get(path, params) self.class.get(path.strip, params) end def self.format_url(url, params) formatted = url.dup.strip params.each { |key, value| formatted.sub!(":#{key}", value) } formatted end def format_url(url, params) self.class.format_url(url, params) end end end
Version data entries
11 entries across 11 versions & 1 rubygems