Sha256: 3a1f74f9eb038d13af3ad2683d87f2f4e8bbbb9765914c66fe8dcbecebc89ef9

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

class Token < ActiveRecord::Base
  belongs_to :user
  
  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

1 entries across 1 versions & 1 rubygems

Version Path
authlogic-connect-0.0.3.6 lib/authlogic_connect/token.rb