Class: Authinator::Provider
- Inherits:
-
Object
- Object
- Authinator::Provider
- Defined in:
- lib/authinator/provider.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#site ⇒ Object
Returns the value of attribute site.
-
#token_url ⇒ Object
Returns the value of attribute token_url.
-
#user_info_url ⇒ Object
Returns the value of attribute user_info_url.
Instance Method Summary collapse
- #add_secrets(options = {}) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(name, options = {}) ⇒ Provider
constructor
A new instance of Provider.
- #secrets ⇒ Object
- #to_hash ⇒ Object (also: #inspect)
Constructor Details
#initialize(name, options = {}) ⇒ Provider
Returns a new instance of Provider.
11 12 13 14 15 16 17 18 19 |
# File 'lib/authinator/provider.rb', line 11 def initialize(name, = {}) @name = name @client_id = .delete :client_id @client_secret = .delete :client_secret @site = .delete :site @token_url = .delete :token_url @api_key = .delete :api_key @user_info_url = .delete :user_info_url end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def api_key @api_key end |
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def client_secret @client_secret end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/authinator/provider.rb', line 3 def name @name end |
#site ⇒ Object
Returns the value of attribute site.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def site @site end |
#token_url ⇒ Object
Returns the value of attribute token_url.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def token_url @token_url end |
#user_info_url ⇒ Object
Returns the value of attribute user_info_url.
4 5 6 |
# File 'lib/authinator/provider.rb', line 4 def user_info_url @user_info_url end |
Instance Method Details
#add_secrets(options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/authinator/provider.rb', line 21 def add_secrets( = {}) @client_id = .delete :client_id if [:client_id] @client_secret = .delete :client_secret if [:client_secret] @api_key = .delete :api_key if [:api_key] end |
#empty? ⇒ Boolean
48 49 50 |
# File 'lib/authinator/provider.rb', line 48 def empty? to_hash.empty? end |
#secrets ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/authinator/provider.rb', line 27 def secrets sec = {} sec[:client_id] = @client_id if @client_id sec[:client_secret] = @client_secret if @client_secret sec[:api_key] = @api_key if @api_key sec end |
#to_hash ⇒ Object Also known as: inspect
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/authinator/provider.rb', line 36 def to_hash { name: @name, client_id: @client_id, client_secret: @client_secret, site: @site, token_url: @token_url, api_key: @api_key, user_info_url: @user_info_url, } end |