Class: Fastlane::Plugin::GitHubStatus::Message
- Inherits:
-
Object
- Object
- Fastlane::Plugin::GitHubStatus::Message
- Defined in:
- lib/fastlane/plugin/github_status/message.rb
Overview
Immutable module object representing the last status message provided by GitHub
Constant Summary collapse
- STATUS_RANKING =
['good', 'minor', 'major'].freeze
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
A more descriptive message describing the current situation.
-
#created_on ⇒ Object
readonly
Time object representing when this status message was created by GitHub.
-
#status ⇒ Object
readonly
String representing one of three possible statuses: * ‘good’ - Everything is OK * ‘minor’ - GitHub is experiencing minor problems * ‘major’ - GitHub is experiencing major problems.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data_hash) ⇒ Message
constructor
Expects to be called with a hash of the JSON data returned from the GitHub status API endpoint.
- #status_at_least?(other_status) ⇒ Boolean
Constructor Details
#initialize(data_hash) ⇒ Message
Expects to be called with a hash of the JSON data returned from the GitHub status API endpoint
'status' => 'good',
'body' => 'Everything operating normally.',
'created_on' => '2016-06-01T16:40:35Z'
32 33 34 35 36 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 32 def initialize(data_hash) @status = ENV['GITHUB_STATUS_TEST_STATUS'] || data_hash['status'] @body = data_hash['body'] @created_on = Time.parse(data_hash['created_on']) end |
Instance Attribute Details
#body ⇒ Object (readonly)
A more descriptive message describing the current situation
16 17 18 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 16 def body @body end |
#created_on ⇒ Object (readonly)
Time object representing when this status message was created by GitHub
20 21 22 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 20 def created_on @created_on end |
#status ⇒ Object (readonly)
String representing one of three possible statuses:
-
‘good’ - Everything is OK
-
‘minor’ - GitHub is experiencing minor problems
-
‘major’ - GitHub is experiencing major problems
13 14 15 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 13 def status @status end |
Class Method Details
.valid_status?(status) ⇒ Boolean
42 43 44 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 42 def self.valid_status?(status) STATUS_RANKING.include?(status) end |
Instance Method Details
#status_at_least?(other_status) ⇒ Boolean
38 39 40 |
# File 'lib/fastlane/plugin/github_status/message.rb', line 38 def status_at_least?(other_status) self.class.valid_status?(other_status) && (status_ranking(status) >= status_ranking(other_status)) end |