Sha256: 9fdd0e9ed1d037fb02c2f4251f11624a6c9733089e76a8b5a1dfa068bff00ad9
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
#can be included in for example a Rails controller to enable easily #authenticating requests module Shutl module Auth module AuthenticatedRequest def self.included base end def access_token authenticator.access_token end def authenticated_request &blk authenticator.authenticated_request &blk end def request_access_token authenticator.request_access_token end protected def authenticator @authenticator ||= Authenticator.new client_id: Shutl::Auth.client_id, client_secret: Shutl::Auth.client_secret , url: Shutl::Auth.url end end class Cache def initialize @cache = {} end def read(key) @cache[key] end def write(key, value) @cache[key] = value end end def self.cache @cache ||= build_cache end private def self.build_cache if Kernel.const_defined?(:Rails) ::Rails.cache else Cache.new end end end end
Version data entries
4 entries across 4 versions & 1 rubygems