multiforecast-client 0.62.0.2 → 0.62.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1316eee0e12243629951f3a621150271e5df2a3f
4
- data.tar.gz: f4cb9e1be15332f4f7cf51036f2d509ef93926c6
3
+ metadata.gz: fd49406437bfd41b01f10ede5949c037b07d4ada
4
+ data.tar.gz: 985af45511b980ad3c8b1a83a1e5dfbdda396973
5
5
  SHA512:
6
- metadata.gz: 61b291a15bbf7ce71c80783ef984ac3b56cc2a10862a8ccce2ae05034848dabf72bc6926f3bbd9fed495adcf0c8d5f4494636e29f250c0c723256564118ebb6f
7
- data.tar.gz: 0cc4d55285915ff7334b047076c52efa49a3b5dc52d9fcddef604804260da1a5f33ccc9efdcbf37f6da602ad0c1849e100b362fc0d9ccbbcf78181bdffd89e0e
6
+ metadata.gz: 4d0b3e3912b0107dd72e7411246926a518ada6a50398cf9fee152707f8f20d690c07598daaf57f253bb78202a4cffc6684c344a4a850bcc41fd1fc150befb728
7
+ data.tar.gz: bea0308427fe97696bc89c041b76a2614b203a5c658a35bb41260d197659efe6b8e002a90eacc867580948752a5f62b22d08e8cee04597eaef2c6d9d6acadeec
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- # 0.62.0.1 (2013/07/06)
1
+ # 0.62.0.3 (2013/07/11)
2
+
3
+ Fix
4
+
5
+ * Escape a white space to %20, not + to avoid GF (Kossy?) bug
6
+
7
+ # 0.62.0.2 (2013/07/07)
2
8
 
3
9
  First version
4
10
 
data/README.md CHANGED
@@ -51,7 +51,6 @@ $ cat multiforecast.yml
51
51
  ---
52
52
  mapping:
53
53
  '': http://localhost:5125
54
- short_metrics: true
55
54
  ```
56
55
 
57
56
  Post a number and create a graph:
@@ -75,13 +74,13 @@ $ multiforecast help
75
74
  ## INSIDE: How to treat graphs of more than 3 levels
76
75
 
77
76
  Although GrowthForecast can treat only graphs of 3 leveled path, MultiForecast can handle graphs of more than 3 levels.
78
- This feature is achieved by converting a given path to GrowthForecast's `service_name/section_name/graph_name` path as follows:
77
+ This feature is achieved by converting a given path string to `service_name/section_name/graph_name` path of GrowthForecast as follows:
79
78
 
80
79
  service_name = 'multiforecast'
81
80
  section_name = CGI.escape(File.dirname(path)).gsub('+', '%20').gsub('.', '%2E')
82
81
  graph_name = File.basename(path)
83
82
 
84
- As a viewer for these converted path, [Yohoushi](https://github.com/yohoushi/yohoushi) is ready for you.
83
+ As a viewer for such converted graphs, you can use [Yohoushi](https://github.com/yohoushi/yohoushi) visualization tool.
85
84
 
86
85
  ## Contributing
87
86
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.62.0.2
1
+ 0.62.0.3
@@ -275,7 +275,7 @@ module MultiForecast
275
275
  # @example
276
276
  def get_graph_uri(path, params = {})
277
277
  params = preprocess_time_params(params) if params
278
- "#{@base_uris[id(path)]}/graph/#{CGI.escape(service_name(path))}/#{CGI.escape(section_name(path))}/#{CGI.escape(graph_name(path))}?#{query_string(params)}"
278
+ "#{@base_uris[id(path)]}/graph/#{uri_escape(service_name(path))}/#{uri_escape(section_name(path))}/#{uri_escape(graph_name(path))}?#{query_string(params)}"
279
279
  end
280
280
 
281
281
  # Get complex graph image uri
@@ -293,7 +293,7 @@ module MultiForecast
293
293
  # @example
294
294
  def get_complex_uri(path, params = {})
295
295
  params = preprocess_time_params(params) if params
296
- "#{@base_uris[id(path)]}/complex/graph/#{CGI.escape(service_name(path))}/#{CGI.escape(section_name(path))}/#{CGI.escape(graph_name(path))}?#{query_string(params)}"
296
+ "#{@base_uris[id(path)]}/complex/graph/#{uri_escape(service_name(path))}/#{uri_escape(section_name(path))}/#{uri_escape(graph_name(path))}?#{query_string(params)}"
297
297
  end
298
298
 
299
299
  # process the time params (from and to)
@@ -3,6 +3,16 @@ require 'cgi'
3
3
 
4
4
  module MultiForecast
5
5
  module ConversionRule
6
+ def uri_escape(string)
7
+ # + => '%20' is to avoid GF (Kossy?) bug
8
+ # . => '%2E' because a/./b is recognized as a/b as URL
9
+ CGI.escape(string).gsub('+', '%20').gsub('.', '%2E') if string
10
+ end
11
+
12
+ def uri_unescape(string)
13
+ CGI.unescape(string) if string
14
+ end
15
+
6
16
  def service_name(path)
7
17
  return path.split('/')[0] if path.count('/') == 2
8
18
  'multiforecast'
@@ -10,9 +20,7 @@ module MultiForecast
10
20
 
11
21
  def section_name(path)
12
22
  return path.split('/')[1] if path.count('/') == 2
13
- # + => '%20' is to avoid GF (Kossy?) bug
14
- # . => '%2E' because a/./b is recognized as a/b as URL
15
- CGI.escape(File.dirname(path)).gsub('+', '%20').gsub('.', '%2E')
23
+ uri_escape(File.dirname(path))
16
24
  end
17
25
 
18
26
  def graph_name(path)
@@ -21,7 +29,7 @@ module MultiForecast
21
29
 
22
30
  def path(service_name, section_name, graph_name)
23
31
  return "#{service_name}/#{section_name}/#{graph_name}" unless service_name == "multiforecast"
24
- dirname = CGI.unescape(section_name)
32
+ dirname = uri_unescape(section_name)
25
33
  basename = graph_name
26
34
  dirname == "." ? basename : "#{dirname}/#{basename}"
27
35
  end
@@ -5,13 +5,13 @@ base_uri = 'http://localhost:5125'
5
5
  shared_context "stub_list_graph" do
6
6
  def list_graph_example
7
7
  [
8
- {"gfuri"=>'http://localhost:5125',
8
+ {"base_uri"=>'http://localhost:5125',
9
9
  "path"=>"app name/host name/<1sec count",
10
10
  "service_name"=>"multiforecast",
11
11
  "section_name"=>"app%20name%2Fhost%20name",
12
12
  "graph_name"=>"<1sec count",
13
13
  "id"=>1},
14
- {"gfuri"=>'http://localhost:5125',
14
+ {"base_uri"=>'http://localhost:5125',
15
15
  "path"=>"app name/host name/<2sec count",
16
16
  "service_name"=>"multiforecast",
17
17
  "section_name"=>"app+name%2Fhost+name",
@@ -30,7 +30,7 @@ end
30
30
  shared_context "stub_get_graph" do
31
31
  def graph_example
32
32
  {
33
- "gfuri"=>"http://localhost:5125",
33
+ "base_uri"=>"http://localhost:5125",
34
34
  "path"=>"app name/host name/<1sec count",
35
35
  "number"=>0,
36
36
  "llimit"=>-1000000000,
@@ -95,7 +95,7 @@ end
95
95
  shared_context "stub_list_complex" do
96
96
  def list_complex_example
97
97
  [
98
- {"gfuri"=>"http://localhost:5125",
98
+ {"base_uri"=>"http://localhost:5125",
99
99
  "path"=>"app name/host name/complex graph test",
100
100
  "service_name"=>"multiforecast",
101
101
  "section_name"=>"app%20name%2Fhost%20name",
@@ -113,7 +113,7 @@ end
113
113
 
114
114
  shared_context "stub_get_complex" do
115
115
  def complex_example
116
- {"gfuri"=>"http://localhost:5125",
116
+ {"base_uri"=>"http://localhost:5125",
117
117
  "path"=>"app name/host name/complex graph test",
118
118
  "service_name"=>"multiforecast",
119
119
  "section_name"=>"app%20name%2Fhost%20name",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiforecast-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0.2
4
+ version: 0.62.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-06 00:00:00.000000000 Z
11
+ date: 2013-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: growthforecast-client