Class: Rack::OAuth2::Client::Grant
- Inherits:
-
Object
- Object
- Rack::OAuth2::Client::Grant
- Includes:
- AttrOptional, AttrRequired
- Defined in:
- lib/rack/oauth2/client/grant.rb,
lib/rack/oauth2/client/grant/password.rb,
lib/rack/oauth2/client/grant/refresh_token.rb,
lib/rack/oauth2/client/grant/facebook_token.rb,
lib/rack/oauth2/client/grant/authorization_code.rb,
lib/rack/oauth2/client/grant/client_credentials.rb
Direct Known Subclasses
AuthorizationCode, ClientCredentials, FacebookToken, Password, RefreshToken
Defined Under Namespace
Classes: AuthorizationCode, ClientCredentials, FacebookToken, Password, RefreshToken
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Grant
constructor
A new instance of Grant.
Constructor Details
#initialize(attributes = {}) ⇒ Grant
Returns a new instance of Grant.
7 8 9 10 11 12 |
# File 'lib/rack/oauth2/client/grant.rb', line 7 def initialize(attributes = {}) (required_attributes + optional_attributes).each do |key| self.send "#{key}=", attributes[key] end attr_missing! end |
Instance Method Details
#as_json(options = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rack/oauth2/client/grant.rb', line 14 def as_json( = {}) (required_attributes + optional_attributes).inject({ :grant_type => self.class.name.demodulize.underscore.to_sym }) do |hash, key| hash.merge! key => self.send(key) end end |