Class: OopsieExceptions::Configuration
- Inherits:
-
Object
- Object
- OopsieExceptions::Configuration
- Defined in:
- lib/oopsie_exceptions/configuration.rb
Defined Under Namespace
Classes: Webhook
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#async_delivery ⇒ Object
Returns the value of attribute async_delivery.
-
#backtrace_cleaner ⇒ Object
Returns the value of attribute backtrace_cleaner.
-
#before_notify ⇒ Object
Returns the value of attribute before_notify.
-
#capture_request_body ⇒ Object
Returns the value of attribute capture_request_body.
-
#context_builder ⇒ Object
Returns the value of attribute context_builder.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#filter_headers ⇒ Object
Returns the value of attribute filter_headers.
-
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters.
-
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#webhook_urls ⇒ Object
Returns the value of attribute webhook_urls.
Instance Method Summary collapse
- #add_webhook(url, headers: {}, name: nil) ⇒ Object
- #ignore_exception(*class_names) ⇒ Object
- #ignored?(exception) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/oopsie_exceptions/configuration.rb', line 12 def initialize @webhook_urls = [] @app_name = defined?(Rails) ? (Rails.application.class.module_parent_name rescue "App") : "App" @environment = defined?(Rails) ? (Rails.env rescue "development") : (ENV["RACK_ENV"] || "development") @ignored_exceptions = default_ignored_exceptions @context_builder = nil @logger = defined?(Rails.logger) && Rails.logger ? Rails.logger : nil @filter_parameters = %w[password password_confirmation secret token api_key] @filter_headers = %w[Authorization Cookie Set-Cookie] @capture_request_body = false @async_delivery = true @timeout = 10 @open_timeout = 5 @backtrace_cleaner = nil @before_notify = nil @enabled = true end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def app_name @app_name end |
#async_delivery ⇒ Object
Returns the value of attribute async_delivery.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def async_delivery @async_delivery end |
#backtrace_cleaner ⇒ Object
Returns the value of attribute backtrace_cleaner.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def backtrace_cleaner @backtrace_cleaner end |
#before_notify ⇒ Object
Returns the value of attribute before_notify.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def before_notify @before_notify end |
#capture_request_body ⇒ Object
Returns the value of attribute capture_request_body.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def capture_request_body @capture_request_body end |
#context_builder ⇒ Object
Returns the value of attribute context_builder.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def context_builder @context_builder end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def enabled @enabled end |
#environment ⇒ Object
Returns the value of attribute environment.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def environment @environment end |
#filter_headers ⇒ Object
Returns the value of attribute filter_headers.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def filter_headers @filter_headers end |
#filter_parameters ⇒ Object
Returns the value of attribute filter_parameters.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def filter_parameters @filter_parameters end |
#ignored_exceptions ⇒ Object
Returns the value of attribute ignored_exceptions.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def ignored_exceptions @ignored_exceptions end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def open_timeout @open_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def timeout @timeout end |
#webhook_urls ⇒ Object
Returns the value of attribute webhook_urls.
5 6 7 |
# File 'lib/oopsie_exceptions/configuration.rb', line 5 def webhook_urls @webhook_urls end |
Instance Method Details
#add_webhook(url, headers: {}, name: nil) ⇒ Object
30 31 32 |
# File 'lib/oopsie_exceptions/configuration.rb', line 30 def add_webhook(url, headers: {}, name: nil) @webhook_urls << Webhook.new(url: url, headers: headers, name: name || url) end |
#ignore_exception(*class_names) ⇒ Object
34 35 36 |
# File 'lib/oopsie_exceptions/configuration.rb', line 34 def ignore_exception(*class_names) @ignored_exceptions.concat(class_names.map(&:to_s)) end |
#ignored?(exception) ⇒ Boolean
38 39 40 |
# File 'lib/oopsie_exceptions/configuration.rb', line 38 def ignored?(exception) @ignored_exceptions.include?(exception.class.name) end |