class Freno::Client::Result
Constants
- ADDITIONAL_STATUS_CODE_MEANINGS
these are included to add resiliency to freno-client
- CODE_MEANINGS
- FRENO_STATUS_CODE_MEANINGS
github.com/github/freno/blob/master/doc/http.md#status-codes
- MEANING_CODES
Attributes
code[R]
meaning[R]
raw_body[R]
Public Class Methods
from_faraday_response(response)
click to toggle source
# File lib/freno/client/result.rb, line 24 def self.from_faraday_response(response) new(response.status, response.body) end
from_meaning(meaning)
click to toggle source
# File lib/freno/client/result.rb, line 28 def self.from_meaning(meaning) new(MEANING_CODES[meaning] || 0) end
new(code, body = nil)
click to toggle source
# File lib/freno/client/result.rb, line 34 def initialize(code, body = nil) @code = code @meaning = CODE_MEANINGS[code] || :unknown @raw_body = body end
Public Instance Methods
==(other)
click to toggle source
# File lib/freno/client/result.rb, line 56 def ==(other) return meaning == other if other.is_a? Symbol code == other end
body()
click to toggle source
# File lib/freno/client/result.rb, line 52 def body @body ||= JSON.parse(raw_body) if raw_body end
failed?()
click to toggle source
# File lib/freno/client/result.rb, line 44 def failed? !ok? end
ok?()
click to toggle source
# File lib/freno/client/result.rb, line 40 def ok? meaning == :ok end
unkown?()
click to toggle source
# File lib/freno/client/result.rb, line 48 def unkown? meaning == :unkown end