Class: Upcheck::Adapters::Statuspage

Inherits:
Object
  • Object
show all
Defined in:
lib/upcheck/adapters/statuspage.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url, http_client: HTTPClient.new) ⇒ Statuspage

Returns a new instance of Statuspage.



6
7
8
9
# File 'lib/upcheck/adapters/statuspage.rb', line 6

def initialize(base_url, http_client: HTTPClient.new)
  @base_url = base_url.to_s.delete_suffix("/")
  @http_client = http_client
end

Instance Method Details

#componentsObject



14
15
16
# File 'lib/upcheck/adapters/statuspage.rb', line 14

def components
  @components ||= Component.build_all(http_get("components.json")["components"])
end

#descriptionObject



12
# File 'lib/upcheck/adapters/statuspage.rb', line 12

def description = status_payload.fetch("description")

#incidentsObject



18
19
20
# File 'lib/upcheck/adapters/statuspage.rb', line 18

def incidents
  @incidents ||= fetch_incidents("incidents/unresolved.json", "incidents")
end

#scheduled_maintenancesObject



22
23
24
# File 'lib/upcheck/adapters/statuspage.rb', line 22

def scheduled_maintenances
  @scheduled_maintenances ||= fetch_incidents("scheduled-maintenances/active.json", "scheduled_maintenances")
end

#statusObject



11
# File 'lib/upcheck/adapters/statuspage.rb', line 11

def status = status_payload.fetch("indicator")