Class: TelegramWorkflow::Configuration
- Inherits:
-
Object
- Object
- TelegramWorkflow::Configuration
- Defined in:
- lib/telegram_workflow/config.rb
Constant Summary collapse
- REQUIRED_PARAMS =
%i(session_store start_action api_token)
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#client ⇒ Object
Returns the value of attribute client.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#session_store ⇒ Object
Returns the value of attribute session_store.
-
#start_action ⇒ Object
Returns the value of attribute start_action.
-
#webhook_params ⇒ Object
Returns the value of attribute webhook_params.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #tagged_logger? ⇒ Boolean
- #verify! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/telegram_workflow/config.rb', line 29 def initialize @client = TelegramWorkflow::Client @webhook_params = {} if defined?(Rails) @session_store = Rails.cache @logger = Rails.logger else @session_store = TelegramWorkflow::Stores::InMemory.new @logger = Logger.new(STDOUT) end end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def api_token @api_token end |
#client ⇒ Object
Returns the value of attribute client.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def client @client end |
#logger ⇒ Object
Returns the value of attribute logger.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def logger @logger end |
#session_store ⇒ Object
Returns the value of attribute session_store.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def session_store @session_store end |
#start_action ⇒ Object
Returns the value of attribute start_action.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def start_action @start_action end |
#webhook_params ⇒ Object
Returns the value of attribute webhook_params.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def webhook_params @webhook_params end |
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
24 25 26 |
# File 'lib/telegram_workflow/config.rb', line 24 def webhook_url @webhook_url end |
Instance Method Details
#tagged_logger? ⇒ Boolean
42 43 44 |
# File 'lib/telegram_workflow/config.rb', line 42 def tagged_logger? @tagged_logger ||= @logger.respond_to?(:tagged) end |
#verify! ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/telegram_workflow/config.rb', line 46 def verify! blank_params = REQUIRED_PARAMS.select { |p| send(p).nil? } if blank_params.any? raise TelegramWorkflow::Errors::MissingConfiguration, blank_params end end |