File: service_status.rb

package info (click to toggle)
ruby-octokit 10.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,092 kB
  • sloc: ruby: 13,339; sh: 99; makefile: 7; javascript: 3
file content (48 lines) | stat: -rw-r--r-- 1,530 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

module Octokit
  class Client
    # Methods for the GitHub Status API
    #
    # @see https://status.github.com/api
    module ServiceStatus
      # Root for status API
      # @private
      SUMMARY_ROOT    = 'https://www.githubstatus.com/api/v2/summary.json'
      STATUS_ROOT     = 'https://www.githubstatus.com/api/v2/status.json'
      COMPONENTS_ROOT = 'https://www.githubstatus.com/api/v2/components.json'

      # Returns a summary with the current status and the last status messages.
      #
      # @return [<Sawyer::Resource>] GitHub status summary
      # @see https://www.githubstatus.com/api#summory
      def github_status_summary
        get(SUMMARY_ROOT)
      end

      # Returns the current system status
      #
      # @return [Sawyer::Resource] GitHub status
      # @see https://www.githubstatus.com/api#status
      def github_status
        get(STATUS_ROOT)
      end

      # Returns the last human communication, status, and timestamp.
      #
      # @return [Sawyer::Resource] GitHub status last message
      # @see https://www.githubstatus.com/api/#components
      def github_status_last_message
        get(COMPONENTS_ROOT).components.first
      end

      # Returns the most recent human communications with status and timestamp.
      #
      # @return [Array<Sawyer::Resource>] GitHub status messages
      # @see https://www.githubstatus.com/api#components
      def github_status_messages
        get(COMPONENTS_ROOT).components
      end
    end
  end
end