Class: Doggy::CLI::Unmute
- Inherits:
-
Object
- Object
- Doggy::CLI::Unmute
- Defined in:
- lib/doggy/cli/unmute.rb
Instance Method Summary collapse
-
#initialize(options, ids) ⇒ Unmute
constructor
A new instance of Unmute.
- #run ⇒ Object
Constructor Details
#initialize(options, ids) ⇒ Unmute
Returns a new instance of Unmute.
5 6 7 8 |
# File 'lib/doggy/cli/unmute.rb', line 5 def initialize(, ids) @options = @ids = ids end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/doggy/cli/unmute.rb', line 10 def run monitors = @ids.map { |id| Doggy::Models::Monitor.find(id) } body = {} body[:all_scopes] = true if @options['all_scopes'] body[:scope] = @options['scope'] if @options['scope'] monitors.each { |monitor| monitor.toggle_mute!('unmute', JSON.dump(body)) } end |