Class: Zaikio::OAuthClient::Configuration
- Inherits:
-
Object
- Object
- Zaikio::OAuthClient::Configuration
- Defined in:
- lib/zaikio/oauth_client/configuration.rb
Constant Summary collapse
- HOSTS =
{ development: "http://hub.zaikio.test", test: "http://hub.zaikio.test", staging: "https://hub.staging.zaikio.com", sandbox: "https://hub.sandbox.zaikio.com", production: "https://hub.zaikio.com" }.freeze
Instance Attribute Summary collapse
-
#around_auth_block ⇒ Object
readonly
Returns the value of attribute around_auth_block.
-
#client_configurations ⇒ Object
readonly
Returns the value of attribute client_configurations.
-
#connections_controller_name ⇒ Object
Returns the value of attribute connections_controller_name.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#host ⇒ Object
Returns the value of attribute host.
-
#sessions_controller_name ⇒ Object
Returns the value of attribute sessions_controller_name.
-
#subscriptions_controller_name ⇒ Object
Returns the value of attribute subscriptions_controller_name.
Instance Method Summary collapse
- #all_client_names ⇒ Object
- #around_auth(&block) ⇒ Object
- #find!(name) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logger ⇒ Object
- #logger=(logger) ⇒ Object
- #register_client(name) {|| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 19 def initialize @client_configurations = {} @around_auth_block = nil @sessions_controller_name = "sessions" @connections_controller_name = "connections" @subscriptions_controller_name = "subscriptions" Zaikio::AccessToken.logger = logger end |
Instance Attribute Details
#around_auth_block ⇒ Object (readonly)
Returns the value of attribute around_auth_block.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def around_auth_block @around_auth_block end |
#client_configurations ⇒ Object (readonly)
Returns the value of attribute client_configurations.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def client_configurations @client_configurations end |
#connections_controller_name ⇒ Object
Returns the value of attribute connections_controller_name.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def connections_controller_name @connections_controller_name end |
#environment ⇒ Object
Returns the value of attribute environment.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def environment @environment end |
#host ⇒ Object
Returns the value of attribute host.
15 16 17 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 15 def host @host end |
#sessions_controller_name ⇒ Object
Returns the value of attribute sessions_controller_name.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def sessions_controller_name @sessions_controller_name end |
#subscriptions_controller_name ⇒ Object
Returns the value of attribute subscriptions_controller_name.
16 17 18 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 16 def subscriptions_controller_name @subscriptions_controller_name end |
Instance Method Details
#all_client_names ⇒ Object
46 47 48 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 46 def all_client_names client_configurations.keys end |
#around_auth(&block) ⇒ Object
55 56 57 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 55 def around_auth(&block) @around_auth_block = block end |
#find!(name) ⇒ Object
42 43 44 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 42 def find!(name) @client_configurations[name.to_s] or raise ActiveRecord::RecordNotFound end |
#logger ⇒ Object
28 29 30 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 28 def logger @logger ||= ActiveSupport::Logger.new($stdout) end |
#logger=(logger) ⇒ Object
32 33 34 35 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 32 def logger=(logger) @logger = logger Zaikio::AccessToken.logger = @logger end |
#register_client(name) {|| ... } ⇒ Object
37 38 39 40 |
# File 'lib/zaikio/oauth_client/configuration.rb', line 37 def register_client(name) @client_configurations[name.to_s] ||= ClientConfiguration.new(name.to_s) yield(@client_configurations[name.to_s]) end |