Sha256: 0f5900157b5e232e4380bb90190934fce8402cc5c960ab5643bc328dcdc23aaa
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require 'active_model/serialization' require 'active_model/serializers/xml' # for Hash.to_xml require 'active_support/inflector' require 'active_support/inflector/inflections' require 'active_support/core_ext/hash/slice' # for Hash.slice require 'json' require 'yaml' require 'sinatra' require 'sinatra/namespace' require 'sinatra/reloader' $: << File.dirname(__FILE__) << File.dirname(File.dirname(__FILE__)) require 'config/defaults' require "app/get/config" require "app/get/objects" require "app/get/status" require "nagira/hostgroup" # # environment file must go after default, some settings override # defaults. # require 'config/environment' require 'nagira/nagios' class Nagira < Sinatra::Base VERSION = File.read(File.expand_path(File.dirname(__FILE__)) + '/../version.txt').strip GITHUB = "http://dmytro.github.com/nagira/" register Sinatra::Namespace ## # When this prefix added to routes convert output to ActiveResource # compatible format (basically Array instead of Hash). # AR_PREFIX = "/ar" # Get all routes that Nagira provides. def api api = { } param_regex = Regexp.new '\(\[\^\\\\\/\?\#\]\+\)' Nagira.routes.keys.each do |method| api[method] ||= [] Nagira.routes[method].each do |r| path = r[0].inspect[3..-3] r[1].each do |parm| path.sub!(param_regex,":#{parm}") end path.gsub!('\\','') api[method] << path unless path.empty? end end api end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nagira-0.4.0 | lib/nagira.rb |