Sha256: 56f459099b3146521c4b9349b4039dc723476ad6b0a6c5e3db105f7aa7782971

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

module OauthProviderEngine
  class Application < OauthProviderEngine::Base
    has_many :access_tokens, :class_name => "::OauthProviderEngine::AccessToken", :dependent => :destroy
    has_many :request_tokens, :class_name => "::OauthProviderEngine::RequestToken", :dependent => :destroy

    before_validation :generate_keys

    validates_presence_of :name, :url, :key, :secret
    attr_accessible :name, :url

    validate do
      errors.add(:url, "is invalid") unless URI.parse(url)
    end

    protected

    def generate_keys
      self.key ||= OauthProviderEngine.generate_key
      self.secret ||= OauthProviderEngine.generate_key
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oauth_provider_engine-0.0.5 app/models/oauth_provider_engine/application.rb
oauth_provider_engine-0.0.4 app/models/oauth_provider_engine/application.rb
oauth_provider_engine-0.0.3 app/models/oauth_provider_engine/application.rb