Method: Rack::OAuth2::Server::AccessToken.for_client

Defined in:
lib/rack/oauth2/models/access_token.rb

.for_client(client_id, offset = 0, limit = 100) ⇒ Object

Returns all access tokens for a given client, Use limit and offset to return a subset of tokens, sorted by creation date.


55
56
57
58
59
# File 'lib/rack/oauth2/models/access_token.rb', line 55

def for_client(client_id, offset = 0, limit = 100)
  client_id = BSON::ObjectId(client_id.to_s)
  collection.find({ :client_id=>client_id }, { :sort=>[[:created_at, Mongo::ASCENDING]], :skip=>offset, :limit=>limit }).
    map { |token| Server.new_instance self, token }
end