Sha256: 05e3a3abda9c07a3c1d25959017a04edfb0be7548a1a8ec6f68c92692a20a69d
Contents?: true
Size: 748 Bytes
Versions: 9
Compression:
Stored size: 748 Bytes
Contents
module Wework module Token class Store attr_accessor :app def initialize(app) @app = app end def access_token refresh_token if expired? end def expired? raise NotImplementedError, "Subclasses must implement a token_expired? method" end def refresh_token result = app.request.get 'gettoken', params: {corpid: app.corp_id, corpsecret: app.app_secret} if defined?(Rails) Rails.logger.warn "[WEWORK] refresh Token(#{app.corp_id}): #{result.inspect}" end result end private def key @key ||= Digest::MD5.hexdigest("#{ACCESS_TOKEN_PREFIX}_#{app.app_id}_#{app.app_secret}") end end end end
Version data entries
9 entries across 9 versions & 1 rubygems