class Object

Public Instance Methods

base_uri() click to toggle source
# File lib/multiforecast/shared_context.rb, line 15
def base_uri
  'http://localhost:5125'
end
complex_example() click to toggle source
# File lib/multiforecast/shared_context/mock.rb, line 114
def complex_example
  {"base_uri"=>"http://localhost:5125",
   "path"=>"app name/host name/complex graph test",
   "service_name"=>"multiforecast",
   "section_name"=>"app%20name%2Fhost%20name",
   "graph_name"=>"complex graph test",
   "number"=>0,
   "complex"=>true,
   "created_at"=>"2013/05/20 15:08:28",
   "id"=>1,
   "data"=>
  [{"gmode"=>"gauge", "stack"=>false, "type"=>"AREA", "graph_id"=>218},
   {"gmode"=>"gauge", "stack"=>true, "type"=>"AREA", "graph_id"=>217}],
  "sumup"=>false,
  "description"=>"complex graph test",
  "sort"=>10,
  "updated_at"=>"2013/05/20 15:08:28"}
end
e(str) click to toggle source
# File lib/multiforecast/shared_context.rb, line 7
def e(str)
  CGI.escape(str).gsub('+', '%20') if str
end
gfpath(path) click to toggle source
# File lib/multiforecast/shared_context.rb, line 11
def gfpath(path)
  "#{e service_name(path)}/#{e section_name(path)}/#{e graph_name(path)}"
end
graph_example() click to toggle source
# File lib/multiforecast/shared_context/mock.rb, line 30
def graph_example
  {
    "base_uri"=>"http://localhost:5125",
    "path"=>"app name/host name/<1sec count",
    "number"=>0,
    "llimit"=>-1000000000,
    "mode"=>"gauge",
    "stype"=>"AREA",
    "adjustval"=>"1",
    "meta"=>"",
    "service_name"=>"multiforecast",
    "gmode"=>"gauge",
    "color"=>"#cc6633",
    "created_at"=>"2013/02/02 00:41:11",
    "section_name"=>"app%20name%2Fhost%20name",
    "ulimit"=>1000000000,
    "id"=>1,
    "graph_name"=>"<1sec count",
    "description"=>"",
    "sulimit"=>100000,
    "unit"=>"",
    "sort"=>0,
    "updated_at"=>"2013/02/02 02:32:10",
    "adjust"=>"*",
    "type"=>"AREA",
    "sllimit"=>-100000,
    "md5"=>"3c59dc048e8850243be8079a5c74d079"
  }
end
list_complex_example() click to toggle source
# File lib/multiforecast/shared_context/mock.rb, line 95
def list_complex_example
  [
    {"base_uri"=>"http://localhost:5125",
     "path"=>"app name/host name/complex graph test",
     "service_name"=>"multiforecast",
     "section_name"=>"app%20name%2Fhost%20name",
     "graph_name"=>"<1sec count",
     "id"=>1},
  ]
end
list_graph_example() click to toggle source
# File lib/multiforecast/shared_context/mock.rb, line 5
def list_graph_example
  [
    {"base_uri"=>'http://localhost:5125',
     "path"=>"app name/host name/<1sec count",
     "service_name"=>"multiforecast",
     "section_name"=>"app%20name%2Fhost%20name",
     "graph_name"=>"<1sec count",
     "id"=>1},
    {"base_uri"=>'http://localhost:5125',
     "path"=>"app name/host name/<2sec count",
     "service_name"=>"multiforecast",
     "section_name"=>"app+name%2Fhost+name",
     "graph_name"=>"<2sec count",
      "id"=>2},
  ]
end
multiforecast(opts = {}) click to toggle source
# File lib/multiforecast/shared_context.rb, line 19
def multiforecast(opts = {})
  opts['mapping'] ||= { '' => base_uri }
  MultiForecast::Client.new(opts)
end