class Fastlane::Plugin::GitHubStatus::Message
Immutable module object representing the last status message provided by GitHub
Constants
- STATUS_RANKING
Attributes
body[R]
A more descriptive message describing the current situation
created_on[R]
Time object representing when this status message was created by GitHub
status[R]
String representing one of three possible statuses:
-
‘good’ - Everything is OK
-
‘minor’ - GitHub is experiencing minor problems
-
‘major’ - GitHub is experiencing major problems
Public Class Methods
new(data_hash)
click to toggle source
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'
}
# 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
valid_status?(status)
click to toggle source
# File lib/fastlane/plugin/github_status/message.rb, line 42 def self.valid_status?(status) STATUS_RANKING.include?(status) end
Public Instance Methods
status_at_least?(other_status)
click to toggle source
# 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
Private Instance Methods
status_ranking(status)
click to toggle source
# File lib/fastlane/plugin/github_status/message.rb, line 48 def status_ranking(status) STATUS_RANKING.find_index(status) end