Module: HerokuStatus

Defined in:
lib/heroku_status.rb,
lib/heroku_status/version.rb

Overview

Defined Under Namespace

Modules: Errors

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.current_statushash

Retrieve the current issue status from Heroku

Returns:

  • (hash)


11
12
13
14
15
16
17
18
# File 'lib/heroku_status.rb', line 11

def current_status
  response = Faraday.get("https://status.heroku.com/api/v3/current-status")
  if response.status != 200
    Errors.error(response, "An issue occured while fetching current issue status.")
  else
    JSON.parse(response.body)
  end
end

.issue(issue_id) ⇒ hash

Retrieve the status for a particular issue

Parameters:

  • issue_id (integer)

Returns:

  • (hash)


40
41
42
43
44
45
46
47
# File 'lib/heroku_status.rb', line 40

def issue(issue_id)
  response = Faraday.get("https://status.heroku.com/api/v3/issues/#{issue_id}")
  if response.status != 200
    HerokuStatus::Errors.error(response, "An issue occured while fetching the issue.")
  else
    JSON.parse(response.body)
  end
end

.issues(filters = {}) ⇒ hash

Retrieve a list of issues from Heroku with optional filters

  • string since - 2012-04-24

  • integer limit - 1

Parameters:

  • filters (hash) (defaults to: {})

Returns:

  • (hash)


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/heroku_status.rb', line 25

def issues(filters={})
  filter_since = filters[:since] ? "since=#{filters[:since]}" : ""
  filter_limit = filters[:limit] ? "limit=#{filters[:limit]}" : ""
  
  response = Faraday.get("https://status.heroku.com/api/v3/issues?#{filter_since}&#{filter_limit}")
  if response.status != 200
    HerokuStatus::Errors.error(response, "An issue occured while fetching issues.")
  else
    JSON.parse(response.body)
  end
end