Module: Xcal::Parktronic::Routes::Outages

Included in:
Xcal::Parktronic::Routes
Defined in:
lib/xcal/parktronic/routes/outages.rb

Instance Method Summary collapse

Instance Method Details

#get_paged_outages(args = {}) ⇒ Object Also known as: 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


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/xcal/parktronic/routes/outages.rb', line 16

def get_paged_outages(args = {})
  args.merge!(access_token: access_token)
  response = get_response("/#{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
end