module CacheBar

Public Class Methods

register_api_to_cache(host, options) click to toggle source
# File lib/cachebar.rb, line 18
def self.register_api_to_cache(host, options)
  raise ArgumentError, "You must provide a host that you are caching API responses for." if host.blank?

  missing_options = ([:expire_in, :key_name] - options.keys)
  if missing_options.present?
    raise(ArgumentError, "Missing some required options: #{missing_options.join(", ")}")
  end

  HTTParty::HTTPCache.apis[host] = options
end