riddl 0.99.211 → 0.99.212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab377ecd069457ffa199b2766460263cf6fa16ec
4
- data.tar.gz: 33564e3629eb93cc4c1021f08d7eb34d97dbad36
3
+ metadata.gz: 312e41b9c6194074f78d75343365750ea2d79e3e
4
+ data.tar.gz: 110b882327acf91457b06100d53bb3609b0b3e71
5
5
  SHA512:
6
- metadata.gz: 72f39a90c58a8630b4751fec9abf6e3c5a7a081d9f26b30f88949ea296d827b4ca294f4380f2d0368c79bf93cff62f7e81eca55d8291d02b357da4ab1e92105b
7
- data.tar.gz: dfea44c97e9bbda2c30250aefeb9fd7249dd0845b5e47a918e9586fdc4ce17571a75645a9153f71ae4184f81d775dca7245da1391c46e2a52f3b016bb9d10539
6
+ metadata.gz: e7e033610fed585467e72dd14d4c5273df9c03767ea135b6057442427b21f822b2390303be96d2071aea8e678455505a7fb56daeba84f614365160306e9c3d5a
7
+ data.tar.gz: 127eda4baaeaa48c0bbca02d86aa939b22c39aa030fee06eb8532d8b4187cd4f3d1f81d460a5ecc4eddfc6d28faef66b8b4e8d589ae6bbea6f121b12d7863ea1
@@ -13,6 +13,7 @@
13
13
  <tile>
14
14
  <layer name="oauth2-univie-client">
15
15
  <apply-to>/**/*</apply-to>
16
+ <block method="get" pass="*">/currentsemester</block>
16
17
  </layer>
17
18
  <layer name="structure"/>
18
19
  </tile>
@@ -10,7 +10,7 @@ module Riddl
10
10
  @base_path = @resource
11
11
  #}}}
12
12
  end
13
-
13
+
14
14
  def visualize(mode,res=@resource,what='')
15
15
  #{{{
16
16
  what += res.path
@@ -48,23 +48,23 @@ module Riddl
48
48
  res = add_path(path,res,rec)
49
49
  res.add_access_methods(des,desres,index,interface)
50
50
  res.add_custom(desres)
51
- block.each do |bl|
52
- bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'')
53
- bpath = (bpath == "" ? "/" : bpath)
54
- if interface.sub == bpath
55
- res.remove_access_methods(des,bl.attributes)
56
- end
57
- end
58
51
  desres.find("des:resource").each do |desres|
59
52
  cpath = desres.attributes['relative'] || "{}"
60
53
  rec = desres.attributes['recursive']
61
54
  int = Interface.new_from_interface(interface,(interface.sub+"/"+cpath).gsub(/\/+/,'/'))
62
55
  add_description(des,desres,cpath,index,int,block,rec,res)
63
56
  end
57
+ block.each do |bl|
58
+ bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'')
59
+ bpath = (bpath == "" ? "/" : bpath)
60
+ if path == bpath
61
+ res.remove_access_methods(des,bl.attributes,index)
62
+ end
63
+ end
64
64
  nil
65
65
  #}}}
66
66
  end
67
-
67
+
68
68
  def compose!(res=@base_path)
69
69
  #{{{
70
70
  res.compose!
@@ -92,7 +92,7 @@ module Riddl
92
92
  @custom = custom
93
93
  @interface = interface
94
94
  end
95
- def visualize; ""; end
95
+ def visualize; "pass *"; end
96
96
  def hash
97
97
  0
98
98
  end
@@ -1,7 +1,7 @@
1
1
  module Riddl
2
2
  class Wrapper
3
3
  class Description < WrapperUtils
4
-
4
+
5
5
  class Resource
6
6
  def initialize(path=nil,recursive=false)
7
7
  #{{{
@@ -57,7 +57,7 @@ module Riddl
57
57
 
58
58
  # TODO add websockets
59
59
 
60
- def remove_access_methods(des,filter)
60
+ def remove_access_methods(des,filter,index)
61
61
  #{{{
62
62
  freq = if filter['in'] && filter['in'] != '*'
63
63
  t = [RequestInOut,Riddl::Wrapper::Description::Message.new(des,filter['in'])]
@@ -75,7 +75,7 @@ module Riddl
75
75
  raise BlockError, "blocking #{filter.inspect} not possible" if freq.nil?
76
76
 
77
77
  if reqs = @access_methods[filter['method']]
78
- reqs = reqs.last # current layer
78
+ reqs = reqs[index]
79
79
  reqs.delete_if do |req|
80
80
  if req.class == freq[0]
81
81
  if req.class == RequestInOut
@@ -90,19 +90,20 @@ module Riddl
90
90
  elsif req.class == RequestTransformation
91
91
  true if freq[1] && freq[1].hash == req.trans.hash
92
92
  elsif req.class == RequestPass
93
+ p 'rrrr'
93
94
  true
94
95
  end
95
- end
96
+ end
96
97
  end
97
- end
98
+ end
98
99
  #}}}
99
100
  end
100
101
 
101
102
  def compose!
102
103
  #{{{
103
104
  @access_methods.each do |k,v|
104
- ### remove all emtpy layers
105
- v.compact!
105
+ ### remove all emtpy layers
106
+ v = v.map{|e| e.empty? ? nil: e}.compact
106
107
  case v.size
107
108
  when 0
108
109
  when 1
@@ -110,10 +111,10 @@ module Riddl
110
111
  else
111
112
  @composition[k] = compose_layers(k,v)
112
113
  end
113
- end
114
+ end
114
115
  #}}}
115
116
  end
116
-
117
+
117
118
  def compose_layers(k,layers)
118
119
  #{{{
119
120
  routes = []
@@ -152,9 +153,9 @@ module Riddl
152
153
  if r.size > 1
153
154
  teh_last = r[-2]
154
155
  success = false
155
- else
156
+ else
156
157
  ret = teh_last
157
- end
158
+ end
158
159
  end
159
160
  end while !success
160
161
  Composition.new(r,ret)
@@ -171,18 +172,18 @@ module Riddl
171
172
  #}}}
172
173
  end
173
174
  private :compose_plain
174
-
175
+
175
176
  def traverse_layers(container,path,layers,layer)
176
177
  #{{{
177
178
  return if layers.count <= layer
178
179
  current = path.last
179
- current_path = path.dup
180
+ current_path = path.dup
180
181
 
181
182
  # messages RequestInOut and RequestStarOut with no out are not processed
182
183
  return if ((current.class == RequestInOut || current.class == RequestStarOut) && current.out.nil?)
183
184
 
184
- if current.class == RequestInOut ||
185
- (current.class == RequestTransformation && !current.out.nil?) ||
185
+ if current.class == RequestInOut ||
186
+ (current.class == RequestTransformation && !current.out.nil?) ||
186
187
  current.class == RequestStarOut
187
188
  # Find all where "in" matches
188
189
  layers[layer].find_all{ |l| (l.class == RequestInOut && l.in.traverse?(current.out) && !l.used?) }.each do |r|
@@ -196,7 +197,7 @@ module Riddl
196
197
  if num > 0
197
198
  path = current_path.dup
198
199
  container << path
199
- end
200
+ end
200
201
  path << r.transform(current)
201
202
  r.used = true
202
203
  traverse_layers(container,path,layers,layer+1)
@@ -206,7 +207,7 @@ module Riddl
206
207
  add_to_path_and_split(container,path,layers,layer,num,current_path,r)
207
208
  end
208
209
  return
209
- end
210
+ end
210
211
 
211
212
  if (current.class == RequestTransformation && current.out.nil?) ||
212
213
  current.class == RequestPass
@@ -214,7 +215,7 @@ module Riddl
214
215
  layers[layer].find_all{|l| (l.class == RequestInOut && !l.used?) || (l.class != RequestInOut) }.each_with_index do |r,num|
215
216
  add_to_path_and_split(container,path,layers,layer,num,current_path,r)
216
217
  end
217
- end
218
+ end
218
219
  #}}}
219
220
  end
220
221
  private :traverse_layers
@@ -224,7 +225,7 @@ module Riddl
224
225
  if num > 0
225
226
  path = current_path.dup
226
227
  container << path
227
- end
228
+ end
228
229
  path << r
229
230
  path.last.used = true
230
231
  traverse_layers(container,path,layers,layer+1)
@@ -239,7 +240,7 @@ module Riddl
239
240
  result << t + "<#{k} "
240
241
  else
241
242
  result << t + "<request method=\"#{k}\" "
242
- end
243
+ end
243
244
  case m
244
245
  when Riddl::Wrapper::Description::RequestInOut
245
246
  messages[m.in.hash] ||= m.in
@@ -247,16 +248,15 @@ module Riddl
247
248
  unless m.out.nil?
248
249
  messages[m.out.hash] ||= m.out
249
250
  result << " out=\"#{m.out.hash}\""
250
- end
251
+ end
251
252
  when Riddl::Wrapper::Description::RequestStarOut
252
253
  result << "in=\"*\""
253
254
  unless m.out.nil?
254
255
  messages[m.out.hash] ||= m.out
255
256
  result << " out=\"#{m.out.hash}\""
256
- end
257
+ end
257
258
  when Riddl::Wrapper::Description::RequestPass
258
- messages[m.pass.hash] ||= m.pass
259
- result << "pass=\"#{m.pass.hash}\""
259
+ result << "pass=\"*\""
260
260
  when Riddl::Wrapper::Description::RequestTransformation
261
261
  messages[m.trans.hash] ||= m.trans
262
262
  result << "transformation=\"#{m.trans.hash}\""
@@ -265,13 +265,13 @@ module Riddl
265
265
  result << ">\n"
266
266
  m.custom.each do |e|
267
267
  result << e.dump + "\n"
268
- end
268
+ end
269
269
  if %w{get post put delete websocket}.include?(k)
270
270
  result << t + "</#{k}>"
271
271
  else
272
272
  result << t + "</request>\n"
273
- end
274
- else
273
+ end
274
+ else
275
275
  result << "/>\n"
276
276
  end
277
277
  result
@@ -290,18 +290,18 @@ module Riddl
290
290
  @composition.each do |k,v|
291
291
  v.each do |m|
292
292
  result << description_xml_string_analyse(messages,t,k,m.result)
293
- end
293
+ end
294
294
  end
295
295
  else
296
296
  @access_methods.each do |k,v|
297
297
  v.first.each do |m|
298
298
  result << description_xml_string_analyse(messages,t,k,m)
299
- end
299
+ end
300
300
  end
301
301
  end
302
302
  result
303
303
  #}}}
304
- end
304
+ end
305
305
  def description_xml_string_sub(messages,t)
306
306
  #{{{
307
307
  result = ''
@@ -371,7 +371,7 @@ module Riddl
371
371
  @access_methods[method][index] << RequestPass.new(interface,custom)
372
372
  end
373
373
  private :add_request_pass
374
-
374
+
375
375
  def add_websocket(index,interface,custom)
376
376
  @access_methods['websocket'] ||= []
377
377
  @access_methods['websocket'][index] ||= []
data/riddl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.211"
3
+ s.version = "0.99.212"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "restful interface description and declaration language: tools and client/server libs"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.211
4
+ version: 0.99.212
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen 'eTM' Mangler