class Bark::Status

The Status class hits the Status Monit API endpoint

Public Class Methods

new(client) click to toggle source
# File lib/bark/status.rb, line 5
def initialize(client)
  @client = client
end

Public Instance Methods

current() click to toggle source

Retrieves the current status of Monit. Note: This is the top level API object

@return [String] ‘“localhost”`

# File lib/bark/status.rb, line 12
def current
  response = @client.get('_status', format: 'xml')
  validate response
end

Private Instance Methods

validate(response) click to toggle source
# File lib/bark/status.rb, line 19
def validate(response)
  if response.status_type == :success
    document = Hash.from_xml(response.body)
  else
    fail StandardError, 'An unknown error occurred.'
  end
  document
end