Class: Pheme::Configuration
- Inherits:
-
Object
- Object
- Pheme::Configuration
- Defined in:
- lib/pheme/configuration.rb
Constant Summary collapse
- ATTRIBUTES =
%i[sns_client sqs_client logger].freeze
- OPTIONAL_ATTRIBUTES =
%i[error_reporting_func].freeze
- DEPRECATED_ATTRIBUTES =
%i[rollbar].freeze
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 |
# File 'lib/pheme/configuration.rb', line 25 def initialize @logger ||= Logger.new($stdout) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor @logger = ActiveSupport::TaggedLogging.new(@logger) unless @logger.respond_to?(:tagged) end |
Instance Method Details
#validate! ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pheme/configuration.rb', line 30 def validate! ATTRIBUTES.each do |attribute| raise "Invalid or missing configuration for #{attribute}" if send(attribute).blank? end raise "sns_client must be a Aws::SNS::Client" unless sns_client.is_a?(Aws::SNS::Client) raise "sns_client must be a Aws::SQS::Client" unless sqs_client.is_a?(Aws::SQS::Client) if respond_to?(:rollbar) @logger.warn("config.rollbar is deprecated. Please use config.error_reporting_func instead.") end end |