Class: Honeybadger::CLI::Notify Private
- Inherits:
-
Object
- Object
- Honeybadger::CLI::Notify
- Extended by:
- Forwardable
- Includes:
- Helpers::BackendCmd
- Defined in:
- lib/honeybadger/cli/notify.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(options, args, config) ⇒ Notify
constructor
private
A new instance of Notify.
- #run ⇒ Object private
Methods included from Helpers::BackendCmd
Constructor Details
#initialize(options, args, config) ⇒ Notify
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Notify.
14 15 16 17 18 19 |
# File 'lib/honeybadger/cli/notify.rb', line 14 def initialize(, args, config) @options = @args = args @config = config @shell = ::Thor::Base.shell.new end |
Instance Method Details
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/honeybadger/cli/notify.rb', line 21 def run payload = { api_key: config.get(:api_key), notifier: NOTIFIER, error: { class: ['class'], message: ['message'] }, request: {}, server: { project_root: Dir.pwd, environment_name: config.get(:env), time: Time.now, stats: Util::Stats.all } } payload[:error][:fingerprint] = Digest::SHA1.hexdigest(['fingerprint']) if option?('fingerprint') payload[:error][:tags] = ['tags'].to_s.strip.split(',').map(&:strip) if option?('tags') payload[:request][:component] = ['component'] if option?('component') payload[:request][:action] = ['action'] if option?('action') payload[:request][:url] = ['url'] if option?('url') payload.delete(:request) if payload[:request].empty? response = config.backend.notify(:notices, payload) if response.success? say("Error notification complete.", :green) else say((response), :red) exit(1) end end |