Sha256: a66ef96b08b9dbb2bbf4eee170faebaf089e3c7508f24a32dec438b8a0e75767

Contents?: true

Size: 1018 Bytes

Versions: 3

Compression:

Stored size: 1018 Bytes

Contents

require 'httparty'
require 'json'
require 'uri'

require 'flapjack-diner/version'
require 'flapjack-diner/argument_validator'

module Flapjack
  module Diner
    module Resources
      module Reports
        %w(entities checks).each do |data_type|
          define_method("status_report_#{data_type}") do |*ids|
            perform_get('status_reports', "/status_report/#{data_type}", ids)
          end

          %w(scheduled_maintenance unscheduled_maintenance
             downtime outage).each do |report_type|
            define_method("#{report_type}_report_#{data_type}") do |*args|
              ids, params = unwrap_ids(*args), unwrap_params(*args)
              validate_params(params) do
                validate :query => [:start_time, :end_time], :as => :time
              end
              perform_get("#{report_type}_reports",
                          "/#{report_type}_report/#{data_type}",
                          ids, params)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flapjack-diner-1.4.0 lib/flapjack-diner/resources/reports.rb
flapjack-diner-1.3.0 lib/flapjack-diner/resources/reports.rb
flapjack-diner-1.2.0 lib/flapjack-diner/resources/reports.rb