Sha256: 35e64ea3b85cdf37baf420503dd4cbdf9e1a76b8c1c842e91bef7424b32e816a

Contents?: true

Size: 848 Bytes

Versions: 3

Compression:

Stored size: 848 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 ||= {}
      @settings.dup
    end
    
    protected
    
    def credentials
      @credentials ||= AuthlogicConnect.credentials(service_name)
    end
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
lsdr-authlogic-connect-0.0.3.9 lib/authlogic_connect/token.rb
authlogic-connect-0.0.3.9 lib/authlogic_connect/token.rb
authlogic-connect-0.0.3.8 lib/authlogic_connect/token.rb