Class: Doorkeeper::Application
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Doorkeeper::Application
- Includes:
- OAuth::Helpers, MongoMapper::Document, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/doorkeeper/models/application.rb,
lib/doorkeeper/models/mongoid2/application.rb,
lib/doorkeeper/models/mongoid3/application.rb,
lib/doorkeeper/models/couchbase/application.rb,
lib/doorkeeper/models/mongo_mapper/application.rb,
lib/doorkeeper/models/active_record/application.rb
Class Method Summary collapse
- .authenticate(uid, secret) ⇒ Object
- .authorized_for(resource_owner) ⇒ Object
- .by_uid(uid) ⇒ Object
- .column_names_with_table ⇒ Object
- .create_indexes ⇒ Object
- .find_all ⇒ Object
- .model_name ⇒ Object
Instance Method Summary collapse
Class Method Details
.authenticate(uid, secret) ⇒ Object
15 16 17 |
# File 'lib/doorkeeper/models/application.rb', line 15 def self.authenticate(uid, secret) self.where(:uid => uid, :secret => secret).first end |
.authorized_for(resource_owner) ⇒ Object
17 18 19 20 |
# File 'lib/doorkeeper/models/mongoid2/application.rb', line 17 def self.(resource_owner) ids = AccessToken.where(:resource_owner_id => resource_owner.id, :revoked_at => nil).map(&:application_id) find(ids) end |
.by_uid(uid) ⇒ Object
19 20 21 |
# File 'lib/doorkeeper/models/application.rb', line 19 def self.by_uid(uid) find_by_id(uid) end |
.column_names_with_table ⇒ Object
8 9 10 |
# File 'lib/doorkeeper/models/active_record/application.rb', line 8 def self.column_names_with_table self.column_names.map { |c| "#{self.table_name}.#{c}" } end |
.create_indexes ⇒ Object
26 27 28 |
# File 'lib/doorkeeper/models/mongo_mapper/application.rb', line 26 def self.create_indexes ensure_index :uid, :unique => true end |
.find_all ⇒ Object
21 22 23 |
# File 'lib/doorkeeper/models/couchbase/application.rb', line 21 def self.find_all show_all({:key => nil, :include_docs => true, :stale => false}) end |
.model_name ⇒ Object
11 12 13 |
# File 'lib/doorkeeper/models/application.rb', line 11 def self.model_name ActiveModel::Name.new(self, Doorkeeper, 'Application') end |
Instance Method Details
#scopes=(value) ⇒ Object
17 18 19 |
# File 'lib/doorkeeper/models/mongo_mapper/application.rb', line 17 def scopes=(value) write_attribute :scopes, value if value.present? end |