Class: Stall::OmniauthProvider
- Inherits:
-
Object
- Object
- Stall::OmniauthProvider
- Defined in:
- lib/stall/omniauth_provider.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #app_id ⇒ Object
- #constant_name ⇒ Object
- #display_name ⇒ Object
- #icon ⇒ Object
-
#initialize(name, config = nil) ⇒ OmniauthProvider
constructor
A new instance of OmniauthProvider.
- #secret_key ⇒ Object
Constructor Details
#initialize(name, config = nil) ⇒ OmniauthProvider
Returns a new instance of OmniauthProvider.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/stall/omniauth_provider.rb', line 8 def initialize(name, config = nil) @name = name.to_s config ||= {} @icon = config.delete(:icon) @display_name = config.delete(:display_name) @app_id = config.delete(:app_id) @secret_key = config.delete(:secret_key) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/stall/omniauth_provider.rb', line 6 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/stall/omniauth_provider.rb', line 6 def name @name end |
Instance Method Details
#app_id ⇒ Object
29 30 31 |
# File 'lib/stall/omniauth_provider.rb', line 29 def app_id @app_id ||= ENV["#{ constant_name }_APP_ID"] end |
#constant_name ⇒ Object
37 38 39 |
# File 'lib/stall/omniauth_provider.rb', line 37 def constant_name @constant_name ||= name.to_s.upcase end |
#display_name ⇒ Object
25 26 27 |
# File 'lib/stall/omniauth_provider.rb', line 25 def display_name @display_name ||= name.humanize end |
#icon ⇒ Object
21 22 23 |
# File 'lib/stall/omniauth_provider.rb', line 21 def icon @icon ||= name end |
#secret_key ⇒ Object
33 34 35 |
# File 'lib/stall/omniauth_provider.rb', line 33 def secret_key @secret_key ||= ENV["#{ constant_name }_SECRET_KEY"] end |