Sha256: f70d7c8095e56eb6e4139cd900feee13f976c3a48de558b8cf74f52f48f5977f

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Xcal
  module Parktronic
    module Routes

      module EventHistoryItems

        # Fetches event history items by *host* and *service*
        #
        # ==== Parameters
        # * +host_impacted+ event host
        # * +service_impacted+ event service
        # * +page+ page number, defaults to 1
        # * +per_page+ per page value, defaults to 100
        #
        # ==== Examples
        #   api.get_paged_event_history_items
        #   api.events_history(host_impacted: 'google.com', service_impacted: 'http')
        def get_paged_event_history_items(args = {})
          args.merge!(access_token: access_token)
          response = http.get("/#{api_version}/events_history?#{URI.encode_www_form(args)}")

          generic_response = Xcal::Parktronic::GenericResponse.new(response.body)
          if response.code == '200' && generic_response.has_key?(:event_history_items)
            generic_response.event_history_items.map { |history| Xcal::Parktronic::GenericResponse.new(history.event_history_item, self) }
          else
            generic_response
          end

          # TODO Add caching
        end
        alias :events_history :get_paged_event_history_items
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcal-parktronic-1.0.0 lib/xcal/parktronic/routes/event_history_items.rb