Sha256: bba0ff0636ad87a108f218fd3422ecd3fd1e69a5e1973d7c16254ac43f1beca7

Contents?: true

Size: 866 Bytes

Versions: 3

Compression:

Stored size: 866 Bytes

Contents

class Token < ActiveRecord::Base
  belongs_to :user
  validates_presence_of :key, :secret
  
  def client
    self.class.client
  end
  
  def consumer
    self.class.consumer
  end
  
  def service_name
    self.class.service_name
  end
  
  def settings
    self.class.settings
  end
  
  def get(path)
    
  end
  
  class << self
    def service_name
      @service_name ||= self.to_s.underscore.scan(/^(.*?)(_token)?$/)[0][0].to_sym
    end
    
    def client
      raise "implement client in subclass"
    end
    
    def consumer
      raise "implement consumer in subclass"
    end
    
    def settings(site, hash = {})
      @settings = hash.merge(:site => site)
    end
    
    def config
      @settings ||= {}
    end
    
    protected
    
    def credentials
      @credentials ||= AuthlogicConnect.credentials(service_name)
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authlogic-connect-0.0.3.4 lib/authlogic_connect/token.rb
authlogic-connect-0.0.3.3 lib/authlogic_connect/token.rb
authlogic-connect-0.0.3.2 lib/authlogic_connect/token.rb