Class: HasHelpers::Cards::Config
- Inherits:
-
Object
- Object
- HasHelpers::Cards::Config
- Defined in:
- lib/has_helpers/cards/config.rb
Constant Summary collapse
- MODES =
%i[server client].freeze
Instance Attribute Summary collapse
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#cache_stale_grace ⇒ Object
Returns the value of attribute cache_stale_grace.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#path ⇒ Object
Returns the value of attribute path.
-
#redis ⇒ Object
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 |
# File 'lib/has_helpers/cards/config.rb', line 17 def initialize @path = "/internal_graphql" @cache_ttl = 5.minutes @cache_stale_grace = 1.hour end |
Instance Attribute Details
#audience ⇒ Object
Returns the value of attribute audience.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def audience @audience end |
#base_url ⇒ Object
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def base_url @base_url end |
#cache_stale_grace ⇒ Object
Returns the value of attribute cache_stale_grace.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def cache_stale_grace @cache_stale_grace end |
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def cache_ttl @cache_ttl end |
#issuer ⇒ Object
Returns the value of attribute issuer.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def issuer @issuer end |
#mode ⇒ Object
Returns the value of attribute mode.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def mode @mode end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def path @path end |
#redis ⇒ Object
Returns the value of attribute redis.
8 9 10 |
# File 'lib/has_helpers/cards/config.rb', line 8 def redis @redis end |
Instance Method Details
#validate! ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/has_helpers/cards/config.rb', line 23 def validate! self.mode = mode&.to_sym raise ConfigurationError, "mode is required" if mode.blank? raise ConfigurationError, "mode must be :server or :client" unless MODES.include?(mode) raise ConfigurationError, "issuer is required" if issuer.blank? validate_client! if mode == :client self end |