Sha256: 60bc72e5e12afc3b1e755cd9f00200718f212ba19589aba32b4a5039fdc1aced

Contents?: true

Size: 482 Bytes

Versions: 14

Compression:

Stored size: 482 Bytes

Contents

module Doorkeeper
  module Models
    module Expirable
      def expired?
        expires_in && Time.now > expired_time
      end

      def expired_time
        created_at + expires_in.seconds
      end

      def expires_in_seconds
        return nil if expires_in.nil?
        expires = (created_at + expires_in.seconds) - Time.now
        expires_sec = expires.seconds.round(0)
        expires_sec > 0 ? expires_sec : 0  
      end
      private :expired_time
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
doorkeeper-1.1.0 lib/doorkeeper/models/expirable.rb
doorkeeper-1.0.0 lib/doorkeeper/models/expirable.rb
doorkeeper-1.0.0.rc2 lib/doorkeeper/models/expirable.rb
doorkeeper-1.0.0.rc1 lib/doorkeeper/models/expirable.rb
doorkeeper-0.7.4 lib/doorkeeper/models/expirable.rb
doorkeeper-0.7.3 lib/doorkeeper/models/expirable.rb
doorkeeper-0.7.2 lib/doorkeeper/models/expirable.rb
doorkeeper-0.7.1 lib/doorkeeper/models/expirable.rb
doorkeeper-0.7.0 lib/doorkeeper/models/expirable.rb
doorkeeper-0.6.7 lib/doorkeeper/models/expirable.rb
doorkeeper-0.6.6 lib/doorkeeper/models/expirable.rb
doorkeeper-0.6.5 lib/doorkeeper/models/expirable.rb
doorkeeper-0.6.4 lib/doorkeeper/models/expirable.rb
doorkeeper-0.6.3 lib/doorkeeper/models/expirable.rb