Class: Stellwerk::Configuration
- Inherits:
-
Object
- Object
- Stellwerk::Configuration
- Defined in:
- lib/stellwerk/configuration.rb
Overview
Configuration class for Stellwerk SDK settings
Constant Summary collapse
- DEFAULT_API_URL =
Default API URL
"https://stellwerk.io"- DEFAULT_SYNC_INTERVAL =
Default sync interval (60 seconds)
60- DEFAULT_OFFLINE_GRACE_PERIOD =
Default offline grace period (24 hours)
86_400- DEFAULT_OFFLINE_GRACE_EXECUTIONS =
Default offline grace executions
100
Instance Attribute Summary collapse
-
#api_key ⇒ String?
API key for license validation and metering.
-
#api_url ⇒ String
Base URL for the Stellwerk API.
-
#logger ⇒ Logger
Logger instance.
-
#offline_grace_executions ⇒ Integer
Maximum executions allowed during offline grace period.
-
#offline_grace_period ⇒ Integer
Maximum seconds to allow offline operation when server is unreachable.
-
#sync_interval ⇒ Integer
Interval in seconds between batch metering reports.
-
#verify_ssl ⇒ Boolean
Whether to verify SSL certificates (disable for development only).
Instance Method Summary collapse
-
#api_key? ⇒ Boolean
Check if an API key is configured.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Reset configuration to defaults.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
53 54 55 56 57 58 59 60 61 |
# File 'lib/stellwerk/configuration.rb', line 53 def initialize @api_key = nil @api_url = DEFAULT_API_URL @sync_interval = DEFAULT_SYNC_INTERVAL @offline_grace_period = DEFAULT_OFFLINE_GRACE_PERIOD @offline_grace_executions = DEFAULT_OFFLINE_GRACE_EXECUTIONS @logger = nil @verify_ssl = true end |
Instance Attribute Details
#api_key ⇒ String?
API key for license validation and metering
15 16 17 |
# File 'lib/stellwerk/configuration.rb', line 15 def api_key @api_key end |
#api_url ⇒ String
Base URL for the Stellwerk API
19 20 21 |
# File 'lib/stellwerk/configuration.rb', line 19 def api_url @api_url end |
#logger ⇒ Logger
Logger instance
35 36 37 |
# File 'lib/stellwerk/configuration.rb', line 35 def logger @logger end |
#offline_grace_executions ⇒ Integer
Maximum executions allowed during offline grace period
31 32 33 |
# File 'lib/stellwerk/configuration.rb', line 31 def offline_grace_executions @offline_grace_executions end |
#offline_grace_period ⇒ Integer
Maximum seconds to allow offline operation when server is unreachable
27 28 29 |
# File 'lib/stellwerk/configuration.rb', line 27 def offline_grace_period @offline_grace_period end |
#sync_interval ⇒ Integer
Interval in seconds between batch metering reports
23 24 25 |
# File 'lib/stellwerk/configuration.rb', line 23 def sync_interval @sync_interval end |
#verify_ssl ⇒ Boolean
Whether to verify SSL certificates (disable for development only)
39 40 41 |
# File 'lib/stellwerk/configuration.rb', line 39 def verify_ssl @verify_ssl end |
Instance Method Details
#api_key? ⇒ Boolean
Check if an API key is configured
65 66 67 |
# File 'lib/stellwerk/configuration.rb', line 65 def api_key? !@api_key.nil? && !@api_key.empty? end |
#reset! ⇒ Object
Reset configuration to defaults
70 71 72 73 74 75 76 77 78 |
# File 'lib/stellwerk/configuration.rb', line 70 def reset! @api_key = nil @api_url = DEFAULT_API_URL @sync_interval = DEFAULT_SYNC_INTERVAL @offline_grace_period = DEFAULT_OFFLINE_GRACE_PERIOD @offline_grace_executions = DEFAULT_OFFLINE_GRACE_EXECUTIONS @logger = nil @verify_ssl = true end |