class TelegramWorkflow::Configuration

Constants

REQUIRED_PARAMS

Attributes

api_token[RW]
client[RW]
logger[RW]
session_store[RW]
start_action[RW]
webhook_params[RW]
webhook_url[RW]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

verify!() click to toggle source
# File lib/telegram_workflow/config.rb, line 42
def verify!
  blank_params = REQUIRED_PARAMS.select { |p| send(p).nil? }

  if blank_params.any?
    raise TelegramWorkflow::Errors::MissingConfiguration, blank_params
  end
end