Sha256: d12d6a52d2e88916f30ce692007efdf0f21b4e7f8e451d749a404a243e29199f

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

Contents

module Xcal
  module Parktronic
    module Routes

      module Outages

        # Fetches outages
        #
        # ==== Parameters
        # * +page+ page number, defaults to 1
        # * +per_page+ per page value, defaults to 100
        #
        # ==== Examples
        #   api.get_paged_outages
        #   api.outages
        def get_paged_outages(args = {})
          args.merge!(access_token: access_token)
          response = http.get("/#{api_version}/outages?#{URI.encode_www_form(args)}")

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

          # TODO Add caching
        end
        alias :outages :get_paged_outages
      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/outages.rb