Sha256: 785b2295ec9379edd80f7521b9831a6821669c87f28e4e778fe520ae1ca7cc3b

Contents?: true

Size: 963 Bytes

Versions: 10

Compression:

Stored size: 963 Bytes

Contents

class AccessToken < 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 config
    self.class.config
  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
    
    def api_version(value = nil)
      config[:api]
    end
    
    protected
    
    def credentials
      @credentials ||= AuthlogicConnect.credentials(service_name)
    end
  end
  
end

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
robdimarco-authlogic-connect-0.0.6 lib/authlogic_connect/access_token.rb
anideo-authlogic-connect-0.0.6 lib/authlogic_connect/access_token.rb
jspooner-authlogic-connect-0.0.20 lib/authlogic_connect/access_token.rb
jspooner-authlogic-connect-0.0.19 lib/authlogic_connect/access_token.rb
foreverman-authlogic-connect-0.0.4 lib/authlogic_connect/access_token.rb
foreverman-authlogic-connect-0.0.3 lib/authlogic_connect/access_token.rb
foreverman-authlogic-connect-0.0.2 lib/authlogic_connect/access_token.rb
foreverman-authlogic-connect-0.0.1 lib/authlogic_connect/access_token.rb
foreverman-authlogic-connect-0.0.6 lib/authlogic_connect/access_token.rb
authlogic-connect-0.0.6 lib/authlogic_connect/access_token.rb