Class: Stall::OmniauthProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/stall/omniauth_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/stall/omniauth_provider.rb', line 6

def config
  @config
end

#nameObject (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_idObject



29
30
31
# File 'lib/stall/omniauth_provider.rb', line 29

def app_id
  @app_id ||= ENV["#{ constant_name }_APP_ID"]
end

#constant_nameObject



37
38
39
# File 'lib/stall/omniauth_provider.rb', line 37

def constant_name
  @constant_name ||= name.to_s.upcase
end

#display_nameObject



25
26
27
# File 'lib/stall/omniauth_provider.rb', line 25

def display_name
  @display_name ||= name.humanize
end

#iconObject



21
22
23
# File 'lib/stall/omniauth_provider.rb', line 21

def icon
  @icon ||= name
end

#secret_keyObject



33
34
35
# File 'lib/stall/omniauth_provider.rb', line 33

def secret_key
  @secret_key ||= ENV["#{ constant_name }_SECRET_KEY"]
end