Class: RestClient::Jogger::RequestComplete
- Inherits:
-
Object
- Object
- RestClient::Jogger::RequestComplete
- Includes:
- ActiveModel::Model
- Defined in:
- lib/rest_client/jogger/request_complete.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#notifier ⇒ Object
Returns the value of attribute notifier.
Instance Method Summary collapse
- #call(name, start, finish, id, payload) ⇒ Object
-
#initialize(args = {}) ⇒ RequestComplete
constructor
A new instance of RequestComplete.
Constructor Details
#initialize(args = {}) ⇒ RequestComplete
Returns a new instance of RequestComplete.
7 8 9 10 |
# File 'lib/rest_client/jogger/request_complete.rb', line 7 def initialize(args = {}) self.logger = args.fetch :logger super end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/rest_client/jogger/request_complete.rb', line 5 def logger @logger end |
#notifier ⇒ Object
Returns the value of attribute notifier.
5 6 7 |
# File 'lib/rest_client/jogger/request_complete.rb', line 5 def notifier @notifier end |
Instance Method Details
#call(name, start, finish, id, payload) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rest_client/jogger/request_complete.rb', line 16 def call(name, start, finish, id, payload) = ::JSON.dump(payload.merge(event_name: name, event_id: id, timestamp: start)) name =~ /error/ ? logger.error() : logger.debug() rescue StandardError => e notifier.error e, payload: payload end |