Class: ChatSDK::Config
- Inherits:
-
Object
- Object
- ChatSDK::Config
- Defined in:
- lib/chat_sdk/config.rb
Constant Summary collapse
- DEFAULTS =
{ dedupe_ttl: 600, streaming_update_interval: 0.5, on_lock_conflict: :drop, handler_executor: :inline, log_level: :info }.freeze
Instance Attribute Summary collapse
-
#adapters ⇒ Object
readonly
Returns the value of attribute adapters.
-
#dedupe_ttl ⇒ Object
readonly
Returns the value of attribute dedupe_ttl.
-
#handler_executor ⇒ Object
readonly
Returns the value of attribute handler_executor.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#on_lock_conflict ⇒ Object
readonly
Returns the value of attribute on_lock_conflict.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#streaming_update_interval ⇒ Object
readonly
Returns the value of attribute streaming_update_interval.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Instance Method Summary collapse
-
#initialize(user_name:, adapters:, state:, **options) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(user_name:, adapters:, state:, **options) ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chat_sdk/config.rb', line 16 def initialize(user_name:, adapters:, state:, **) raise ConfigurationError, "user_name is required" if user_name.nil? || user_name.empty? raise ConfigurationError, "adapters hash is required" if adapters.nil? || adapters.empty? raise ConfigurationError, "state adapter is required" if state.nil? @user_name = user_name @adapters = adapters @state = state merged = DEFAULTS.merge() @on_lock_conflict = merged[:on_lock_conflict] @dedupe_ttl = merged[:dedupe_ttl] @streaming_update_interval = merged[:streaming_update_interval] @handler_executor = merged[:handler_executor] @log_level = merged[:log_level] validate_lock_conflict! end |
Instance Attribute Details
#adapters ⇒ Object (readonly)
Returns the value of attribute adapters.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def adapters @adapters end |
#dedupe_ttl ⇒ Object (readonly)
Returns the value of attribute dedupe_ttl.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def dedupe_ttl @dedupe_ttl end |
#handler_executor ⇒ Object (readonly)
Returns the value of attribute handler_executor.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def handler_executor @handler_executor end |
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def log_level @log_level end |
#on_lock_conflict ⇒ Object (readonly)
Returns the value of attribute on_lock_conflict.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def on_lock_conflict @on_lock_conflict end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def state @state end |
#streaming_update_interval ⇒ Object (readonly)
Returns the value of attribute streaming_update_interval.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def streaming_update_interval @streaming_update_interval end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
13 14 15 |
# File 'lib/chat_sdk/config.rb', line 13 def user_name @user_name end |