Class: OAuth2::Client
- Inherits:
-
Object
- Object
- OAuth2::Client
- Defined in:
- lib/oauth20/client.rb
Instance Attribute Summary collapse
-
#client_type ⇒ Object
readonly
Returns the value of attribute client_type.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#redirect_uri ⇒ Object
readonly
Returns the value of attribute redirect_uri.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Class Method Summary collapse
Instance Method Summary collapse
- #create_access_token(user) ⇒ Object
-
#initialize(name, options = {}) ⇒ Client
constructor
A new instance of Client.
- #save ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 |
# File 'lib/oauth20/client.rb', line 5 def initialize(name, = {}) @name = name @client_type = 'confidential' @key = [:key] || OAuth2::Utils.generate_key @secret = [:secret] || OAuth2::Utils.generate_key @redirect_uri = [:redirect_uri] || nil end |
Instance Attribute Details
#client_type ⇒ Object (readonly)
Returns the value of attribute client_type.
3 4 5 |
# File 'lib/oauth20/client.rb', line 3 def client_type @client_type end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/oauth20/client.rb', line 3 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/oauth20/client.rb', line 3 def name @name end |
#redirect_uri ⇒ Object (readonly)
Returns the value of attribute redirect_uri.
3 4 5 |
# File 'lib/oauth20/client.rb', line 3 def redirect_uri @redirect_uri end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
3 4 5 |
# File 'lib/oauth20/client.rb', line 3 def secret @secret end |
Class Method Details
Instance Method Details
#create_access_token(user) ⇒ Object
13 14 15 |
# File 'lib/oauth20/client.rb', line 13 def create_access_token(user) OAuth2::AccessToken.new({:client_key => key, :user_id => user.id}) end |