Sha256: d2c56e001a3c0b1ef7be34e56051db84e5e5148f12eea3e0e1101a1fa66190d7
Contents?: true
Size: 672 Bytes
Versions: 4
Compression:
Stored size: 672 Bytes
Contents
require 'booking_locations/version' require 'booking_locations/api' require 'booking_locations/slot' require 'booking_locations/location' require 'active_support/core_ext/module/attribute_accessors' require 'active_support/cache/null_store' module BookingLocations DEFAULT_TTL = 2 * 60 * 60 # 2 hours mattr_writer :api mattr_writer :cache def self.api @@api ||= BookingLocations::Api.new end def self.cache @@cache ||= ActiveSupport::Cache::NullStore.new end def self.find(id, expires = DEFAULT_TTL) cache.fetch(id, expires: expires) do api.get(id) do |response_hash| Location.new(response_hash) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems