Sha256: 6773af6f854d21ba5e7dd7b9e755908782fbcc984ada369ca8ef59e40967c059

Contents?: true

Size: 480 Bytes

Versions: 4

Compression:

Stored size: 480 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
      monitors.each { |monitor| monitor.toggle_mute!('mute', JSON.dump(body)) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doggy-2.0.36 lib/doggy/cli/mute.rb
doggy-2.0.35 lib/doggy/cli/mute.rb
doggy-2.0.34 lib/doggy/cli/mute.rb
doggy-2.0.33 lib/doggy/cli/mute.rb