Sha256: d7adf27e0e1c47b522babe2367f48693811b0b11b753433498f7973ed421b3fb

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 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 = get_response("/#{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
        end
        alias :events_history :get_paged_event_history_items
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xcal-parktronic-1.3.0 lib/xcal/parktronic/routes/event_history_items.rb
xcal-parktronic-1.2.0 lib/xcal/parktronic/routes/event_history_items.rb
xcal-parktronic-1.1.1 lib/xcal/parktronic/routes/event_history_items.rb
xcal-parktronic-1.0.2 lib/xcal/parktronic/routes/event_history_items.rb
xcal-parktronic-1.0.1 lib/xcal/parktronic/routes/event_history_items.rb