Module: Songkick::OAuth2::Model::ResourceOwner

Defined in:
lib/songkick/oauth2/model/resource_owner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


6
7
8
9
10
11
# File 'lib/songkick/oauth2/model/resource_owner.rb', line 6

def self.included(klass)
  klass.has_many :oauth2_authorizations,
                 :class_name => Authorization.name,
                 :as => :oauth2_resource_owner,
                 :dependent => :destroy
end

Instance Method Details

#grant_access!(client, options = {}) ⇒ Object


13
14
15
# File 'lib/songkick/oauth2/model/resource_owner.rb', line 13

def grant_access!(client, options = {})
  Authorization.for(self, client, options)
end

#oauth2_authorization_for(client) ⇒ Object


17
18
19
# File 'lib/songkick/oauth2/model/resource_owner.rb', line 17

def oauth2_authorization_for(client)
  oauth2_authorizations.find_by_client_id(client.id)
end