Class: RemoteNotifier::Base
- Inherits:
-
Object
- Object
- RemoteNotifier::Base
- Defined in:
- lib/remote_notifier/base.rb
Instance Attribute Summary collapse
-
#remote ⇒ Object
Returns the value of attribute remote.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(app, options = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 |
# File 'lib/remote_notifier/base.rb', line 7 def initialize(app, = {}) @app = app @remote = [:remote] @token = [:token] @secret = [:secret] raise "Please provide :remote, :token and :secret when defining middleware" unless @remote && @token && @secret @remote += "/api/v1/" end |
Instance Attribute Details
#remote ⇒ Object
Returns the value of attribute remote.
5 6 7 |
# File 'lib/remote_notifier/base.rb', line 5 def remote @remote end |
#secret ⇒ Object
Returns the value of attribute secret.
5 6 7 |
# File 'lib/remote_notifier/base.rb', line 5 def secret @secret end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/remote_notifier/base.rb', line 5 def token @token end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/remote_notifier/base.rb', line 16 def call(env) begin @app.call(env) rescue Exception => exception RemoteNotifier::Notification.create(:backtrace => exception.backtrace.join("\n"), :msg_class => exception.class.to_s, :message => exception., :object => self) raise exception end end |