rbbt-rest 1.8.132 → 1.8.133
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/entity.rb +4 -0
- data/lib/rbbt/rest/entity/rest.rb +4 -4
- data/share/views/tools/Rggplot.haml +15 -0
- data/share/views/tools/Rpng.haml +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd372404c5852b1fbb2ff81458ac565c59aef590d691684e133ae25d8f4870d
|
4
|
+
data.tar.gz: 5d60c4e944ec6f9c5a38b46a907ae393bbcd876dca7cdef277f8caafa488c9af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7476ccde9c44721f3d1374b9640aeffda1223ea422b6fad58f6dff36ea14cbe61b342cd3867b50a44ec699397504bc2de2ed45f11f6ae6e524d1ada1d21ce13a
|
7
|
+
data.tar.gz: 5ded5d4e71d4ce4e330de4d18a7485daeb65ea78b2053de9e56c88c47ce8d0cb4c15462ae354b4bee622d07bb2e2e6cd51d10f8d7d6a5a5332cb502411e2a01b
|
data/lib/rbbt/rest/entity.rb
CHANGED
@@ -69,6 +69,8 @@ module Sinatra
|
|
69
69
|
entity_type = consume_parameter :entity_type
|
70
70
|
entity = consume_parameter :entity
|
71
71
|
|
72
|
+
entity = Entity::REST.restore_element(entity)
|
73
|
+
|
72
74
|
entity_type = Entity::REST.restore_element(entity_type)
|
73
75
|
|
74
76
|
entity = setup_entity(entity_type, entity, @clean_params)
|
@@ -83,6 +85,8 @@ module Sinatra
|
|
83
85
|
entity = consume_parameter :entity
|
84
86
|
action = consume_parameter :action
|
85
87
|
|
88
|
+
entity = Entity::REST.restore_element(entity)
|
89
|
+
|
86
90
|
entity_type = Entity::REST.restore_element(entity_type)
|
87
91
|
|
88
92
|
entity = setup_entity(entity_type, entity, @clean_params)
|
@@ -14,11 +14,11 @@ module Entity
|
|
14
14
|
#{{{ MISC
|
15
15
|
|
16
16
|
def self.clean_element(elem)
|
17
|
-
elem.gsub('/', '-..-').gsub('%', 'o-o').gsub('[','(.-(').gsub(']',').-)')
|
17
|
+
elem.gsub('/', '-..-').gsub("|", '-...-').gsub('%', 'o-o').gsub('[','(.-(').gsub(']',').-)')
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.restore_element(elem)
|
21
|
-
CGI.unescape(CGI.unescape(elem.gsub('-..-', '/').gsub('o-o', '%').gsub('(.-(','[').gsub(').-)',']')))
|
21
|
+
CGI.unescape(CGI.unescape(elem.gsub('-..-', '/').gsub('-...-', '|').gsub('o-o', '%').gsub('(.-(','[').gsub(').-)',']')))
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.setup(mod)
|
@@ -84,13 +84,13 @@ module Entity
|
|
84
84
|
end
|
85
85
|
|
86
86
|
|
87
|
-
url = File.join('/', 'entity', Entity::REST.clean_element(type.to_s), entity)
|
87
|
+
url = File.join('/', 'entity', Entity::REST.clean_element(type.to_s), Entity::REST.clean_element(entity))
|
88
88
|
url << "?" << Misc.hash2GET_params(params) if params.any?
|
89
89
|
url
|
90
90
|
end
|
91
91
|
|
92
92
|
def self.entity_action_url(entity, type, action, params = {})
|
93
|
-
url = File.join('/', 'entity_action', Entity::REST.clean_element(type.to_s), action.to_s, entity)
|
93
|
+
url = File.join('/', 'entity_action', Entity::REST.clean_element(type.to_s), action.to_s, Entity::REST.clean_element(entity))
|
94
94
|
url << "?" << Misc.hash2GET_params(params) if params.any?
|
95
95
|
url
|
96
96
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- filename = 'R-png_' << rand(10000).to_s unless defined? filename and filename
|
2
|
+
- text = filename unless defined? text and text
|
3
|
+
|
4
|
+
- size = 3 unless defined? size and size
|
5
|
+
- width = size unless defined? width and width
|
6
|
+
- height = size unless defined? height and height
|
7
|
+
- plot = block.call unless (defined? plot and plot) or not defined? block
|
8
|
+
- plot_options = {} unless defined? plot_options and plot_options
|
9
|
+
|
10
|
+
- filename += '.png' unless filename =~ /\.png$/i
|
11
|
+
- require 'rbbt/util/R'
|
12
|
+
|
13
|
+
= resource filename, text, :image do |filename|
|
14
|
+
- R::PNG.ggplot(filename, data, plot, width, height, plot_options)
|
15
|
+
|
data/share/views/tools/Rpng.haml
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
- plot = block.call unless (defined? plot and plot) or not defined? block
|
8
8
|
|
9
9
|
- filename += '.png' unless filename =~ /\.png$/i
|
10
|
+
- require 'rbbt/util/R'
|
10
11
|
= resource filename, text, :image do |filename|
|
11
12
|
- TmpFile.with_file(plot) do |plot_file|
|
12
13
|
- if defined? data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.133
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -1855,6 +1855,7 @@ files:
|
|
1855
1855
|
- share/views/public/robots.txt
|
1856
1856
|
- share/views/public/spain_logo.svg
|
1857
1857
|
- share/views/tasks.haml
|
1858
|
+
- share/views/tools/Rggplot.haml
|
1858
1859
|
- share/views/tools/Rpng.haml
|
1859
1860
|
- share/views/tools/nvd3.haml
|
1860
1861
|
- share/views/tools/nvd3/chart.haml
|