Encapsulates credentials required to request access tokens from the Brightbox authorisation servers
@todo Interface to update certain credentials (after password change)
@param [String] client_id @param [String] client_secret @param [Hash] options @option options [String] :username @option options [String] :password
# File lib/fog/brightbox/oauth2.rb, line 48 def initialize(client_id, client_secret, options = {}) @client_id = client_id @client_secret = client_secret @username = options[:username] @password = options[:password] @access_token = options[:access_token] @refresh_token = options[:refresh_token] end
Is an access token available for these credentials?
# File lib/fog/brightbox/oauth2.rb, line 64 def access_token? !!@access_token end
Based on available credentials returns the best strategy
@todo Add a means to dictate which should or shouldn't be used
# File lib/fog/brightbox/oauth2.rb, line 83 def best_grant_strategy if refresh_token? RefreshTokenStrategy.new(self) elsif user_details? UserCredentialsStrategy.new(self) else ClientCredentialsStrategy.new(self) end end
Is a refresh token available for these credentials?
# File lib/fog/brightbox/oauth2.rb, line 69 def refresh_token? !!@refresh_token end
Generated with the Darkfish Rdoc Generator 2.