Sha256: fecab516d7104601708045a8badb48509210ffb92574906222d2fa94d72afa0a
Contents?: true
Size: 677 Bytes
Versions: 1
Compression:
Stored size: 677 Bytes
Contents
class Visa::Request delegate :tokenable, to: :token def initialize(environment) @environment = environment end def touch token.touch :last_requested_at end def valid? token.present? && not_too_old? end private attr_reader :environment def credentials string = request.params['access_token'] || request.headers[Visa.request_header] [string[0..15], string[16..57]] end def not_too_old? time = token.last_requested_at time.nil? || (time > Visa.timeout.ago) end def request @request ||= Rack::Request.new environment end def token @token ||= Visa::Token.find_by_credentials *credentials end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
visa-0.0.1 | lib/visa/request.rb |