Class: Garage::Config
- Inherits:
-
Object
- Object
- Garage::Config
- Defined in:
- lib/garage/config.rb
Defined Under Namespace
Classes: Builder
Constant Summary collapse
- DEFAULT_RESCUE_ERROR =
true
Instance Attribute Summary collapse
-
#auth_server_host ⇒ Object
Returns the value of attribute auth_server_host.
-
#auth_server_timeout ⇒ Object
Returns the value of attribute auth_server_timeout.
-
#auth_server_url ⇒ Object
Returns the value of attribute auth_server_url.
-
#cache_acceess_token_validation ⇒ Object
writeonly
Sets the attribute cache_acceess_token_validation.
- #cast_resource ⇒ Object
- #docs ⇒ Object
-
#rescue_error ⇒ true, false
Set false if you want to rescue errors by yourself.
-
#strategy ⇒ Module
Set authentication strategy module which must satisfy Strategy interface.
- #tracer ⇒ Object
-
#ttl_for_access_token_cache ⇒ Object
Returns the value of attribute ttl_for_access_token_cache.
Instance Method Summary collapse
- #cache_acceess_token_validation? ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
18 19 20 21 |
# File 'lib/garage/config.rb', line 18 def initialize @cache_acceess_token_validation = false @ttl_for_access_token_cache = 5.minutes end |
Instance Attribute Details
#auth_server_host ⇒ Object
Returns the value of attribute auth_server_host.
16 17 18 |
# File 'lib/garage/config.rb', line 16 def auth_server_host @auth_server_host end |
#auth_server_timeout ⇒ Object
Returns the value of attribute auth_server_timeout.
16 17 18 |
# File 'lib/garage/config.rb', line 16 def auth_server_timeout @auth_server_timeout end |
#auth_server_url ⇒ Object
Returns the value of attribute auth_server_url.
16 17 18 |
# File 'lib/garage/config.rb', line 16 def auth_server_url @auth_server_url end |
#cache_acceess_token_validation=(value) ⇒ Object (writeonly)
Sets the attribute cache_acceess_token_validation
15 16 17 |
# File 'lib/garage/config.rb', line 15 def cache_acceess_token_validation=(value) @cache_acceess_token_validation = value end |
#cast_resource ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/garage/config.rb', line 51 def cast_resource @cast_resource ||= proc { |resource, | ||= {} to_resource_args = [[:to_resource_options]].compact if resource.respond_to?(:map) && resource.respond_to?(:to_a) resource.map { |r| r.to_resource(*to_resource_args) } else resource.to_resource(*to_resource_args) end } end |
#docs ⇒ Object
47 48 49 |
# File 'lib/garage/config.rb', line 47 def docs @docs ||= Docs::Config.new end |
#rescue_error ⇒ true, false
Set false if you want to rescue errors by yourself
27 28 29 |
# File 'lib/garage/config.rb', line 27 def rescue_error instance_variable_defined?(:@rescue_error) ? @rescue_error : DEFAULT_RESCUE_ERROR end |
#strategy ⇒ Module
Set authentication strategy module which must satisfy Strategy interface.
35 36 37 |
# File 'lib/garage/config.rb', line 35 def strategy instance_variable_defined?(:@strategy) ? @strategy : Garage::Strategy::NoAuthentication end |
#tracer ⇒ Object
43 44 45 |
# File 'lib/garage/config.rb', line 43 def tracer @tracer ||= Garage::Tracer::NullTracer end |
#ttl_for_access_token_cache ⇒ Object
Returns the value of attribute ttl_for_access_token_cache.
16 17 18 |
# File 'lib/garage/config.rb', line 16 def ttl_for_access_token_cache @ttl_for_access_token_cache end |
Instance Method Details
#cache_acceess_token_validation? ⇒ Boolean
63 64 65 |
# File 'lib/garage/config.rb', line 63 def cache_acceess_token_validation? !!@cache_acceess_token_validation end |