Sha256: ec858792d64b2cdc0947f0faeae12738356e0a6499cfcd600040653a900a77c4

Contents?: true

Size: 537 Bytes

Versions: 4

Compression:

Stored size: 537 Bytes

Contents

module Tweetable
  class Authorization < Persistable
    attribute :oauth_access_token
    attribute :oauth_access_secret
    
    index :oauth_access_token
    
    def user_id
      return if self.oauth_access_token.nil?
      self.oauth_access_token.split('-')[0] # tokens start with ID as in: 13705052-bz9IrOTwWbLgWHQDKkGnVd815ybTujc0QeXMlh7ZJ
    end
    
    protected
    
    def validate
      assert_present :oauth_access_token
      assert_present :oauth_access_secret
      assert_unique :oauth_access_token
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tweetable-0.1.14 lib/tweetable/authorization.rb
tweetable-0.1.13 lib/tweetable/authorization.rb
tweetable-0.1.11 lib/tweetable/authorization.rb
tweetable-0.1.10 lib/tweetable/authorization.rb