Sha256: b86209e6b51b4795175d2f0536e16cc2138b0158598c10bf7c8a09dda9dd0825

Contents?: true

Size: 540 Bytes

Versions: 6

Compression:

Stored size: 540 Bytes

Contents

# encoding: utf-8

require 'doggy/duration'

module Doggy
  class CLI::Mute
    def initialize(options, ids)
      @options = options
      @ids     = ids
    end

    def run
      monitors = @ids.map { |id| Doggy::Models::Monitor.find(id) }
      body = {}
      if @options['duration']
        body[:end] = Time.now.utc.to_i + Duration.parse(@options['duration']).to_i
      end
      body[:scope] = @options['scope'] if @options['scope']
      monitors.each { |monitor| monitor.toggle_mute!('mute', JSON.dump(body)) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
doggy-2.0.42 lib/doggy/cli/mute.rb
doggy-2.0.41 lib/doggy/cli/mute.rb
doggy-2.0.40 lib/doggy/cli/mute.rb
doggy-2.0.39 lib/doggy/cli/mute.rb
doggy-2.0.38 lib/doggy/cli/mute.rb
doggy-2.0.37 lib/doggy/cli/mute.rb