class Giraffi::Client
Warpper for the Giraffi
RESTful API
Public Class Methods
new(attrs={})
click to toggle source
Initializes a new API object
@param attrs [Hash] The options allows you to access the Giraffi
RESTful API @return [Giraffi::Client]
# File lib/giraffi/client.rb, line 58 def initialize(attrs={}) attrs = Giraffi.options.merge(attrs) Config::VALID_OPTIONS_KEYS.each do |key| instance_variable_set("@#{key}".to_sym, attrs[key]) end end
Public Instance Methods
bad_response(response)
click to toggle source
Examines a bad response and raise an appropriate error
@param response [HTTParty::Response]
# File lib/giraffi/client.rb, line 47 def bad_response(response) if response.class == HTTParty::Response raise ResponseError, response end raise StandardError, "Unknown error" end
to_uri(key)
click to toggle source
Returns the URL related to the given key
@param options [Symbol] The keyword related to the real URI @return [String] URI or nil when no matching value
# File lib/giraffi/client.rb, line 69 def to_uri(key) {papi: endpoint,okapi: monitoringdata_endpoint,lapi: applogs_endpoint}[key] || nil end