Sha256: d3c365fdc65b87bbb06dde2d28b1efb2719f33bb10281ec121b7455b352b81b1
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 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, params) end def self.format_url(url, params) formatted = url.dup 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
companies_house_hub-0.1.1 | lib/companies_house_hub/base_model.rb |
companies_house_hub-0.1.0 | lib/companies_house_hub/base_model.rb |