riddl 1.0.20 → 1.0.21
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 +4 -4
- data/README.md +1 -1
- data/examples/propnew/server.properties.schema +4 -4
- data/lib/ruby/riddl/client.rb +25 -10
- data/lib/ruby/riddl/parameter.rb +8 -3
- data/riddl.gemspec +2 -2
- metadata +3 -3
- /data/{COPYING → LICENSE} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28692624877cae67118d788e232ffad0707e98f685257ae38661a50235cc2e19
|
|
4
|
+
data.tar.gz: 773269607873f5d8153cb92accdb3bbcd058109c3ea00f1704807d5b5496d8af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4ac230888df9ae43b840f407764ee293d6d1ddfe9c242ea9fa5e850c8b455a1722a9a1da6ba675710b310e9fa10804d67b037424799e671b4ef6b2cd299bd93
|
|
7
|
+
data.tar.gz: 5bb88e50380fcc18206f5d0c021cbeac4c7c473e97e94c221af6880baa9aac20b8f39057e042127fd2cce4e8157710eadbf630174f8a3caa426d7c1f5f083c31
|
data/README.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
This file is part of CPEE.
|
|
3
3
|
|
|
4
4
|
CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
5
|
-
of the GNU General Public License as published by the Free Software Foundation,
|
|
5
|
+
of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
6
6
|
either version 3 of the License, or (at your option) any later version.
|
|
7
7
|
|
|
8
8
|
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
9
9
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
10
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
11
11
|
|
|
12
|
-
You should have received a copy of the GNU General Public License along with
|
|
13
|
-
CPEE (file
|
|
12
|
+
You should have received a copy of the GNU Lesser General Public License along with
|
|
13
|
+
CPEE (file LICENSE in the main directory). If not, see
|
|
14
14
|
<http://www.gnu.org/licenses/>.
|
|
15
15
|
-->
|
|
16
16
|
|
data/lib/ruby/riddl/client.rb
CHANGED
|
@@ -291,10 +291,11 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
291
291
|
qparams = extract_qparams(parameters,riddl_method.downcase)
|
|
292
292
|
|
|
293
293
|
response = nil
|
|
294
|
+
ignore = @options[:ignore_response] ? true : false # status and headers only, the body is discarded while receiving
|
|
294
295
|
if @wrapper.nil? || @wrapper.description? || (@wrapper.declaration? && !@base.nil?)
|
|
295
|
-
status, response, response_headers = make_request(@base + @rpath,riddl_method,parameters,headers,qparams,simulate,riddl_message && riddl_message.out ? true : false)
|
|
296
|
+
status, response, response_headers = make_request(@base + @rpath,riddl_method,parameters,headers,qparams,simulate,riddl_message && riddl_message.out ? true : false,ignore)
|
|
296
297
|
return response if simulate
|
|
297
|
-
if !@wrapper.nil? && status >= 200 && status < 300
|
|
298
|
+
if !@wrapper.nil? && !ignore && status >= 200 && status < 300
|
|
298
299
|
unless @wrapper.check_message(response,response_headers,riddl_message.out)
|
|
299
300
|
raise OutputError, "Not a valid output from service."
|
|
300
301
|
end
|
|
@@ -302,9 +303,9 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
302
303
|
elsif !@wrapper.nil? && @base.nil? && @wrapper.declaration?
|
|
303
304
|
headers['RIDDL-DECLARATION-PATH'] = @rpath
|
|
304
305
|
if !riddl_message.route?
|
|
305
|
-
status, response, response_headers = make_request(riddl_message.interface.real_url(@rpath,@base),riddl_method,parameters,headers,qparams,simulate,riddl_message && riddl_message.out ? true : false)
|
|
306
|
+
status, response, response_headers = make_request(riddl_message.interface.real_url(@rpath,@base),riddl_method,parameters,headers,qparams,simulate,riddl_message && riddl_message.out ? true : false,ignore)
|
|
306
307
|
return response if simulate
|
|
307
|
-
if status >= 200 && status < 300
|
|
308
|
+
if !ignore && status >= 200 && status < 300
|
|
308
309
|
unless @wrapper.check_message(response,response_headers,riddl_message.out)
|
|
309
310
|
raise OutputError, "Not a valid output from service."
|
|
310
311
|
end
|
|
@@ -314,13 +315,14 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
314
315
|
th = headers
|
|
315
316
|
tq = qparams
|
|
316
317
|
riddl_message.route.each do |m|
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
last = (m == riddl_message.route.last) # intermediate responses are the input of the next hop, never ignore them
|
|
319
|
+
if last
|
|
320
|
+
status, response, response_headers = make_request(m.interface.real_url(@rpath,@base),riddl_method,tp,th,tq,simulate,riddl_message && riddl_message.out ? true : false,ignore)
|
|
319
321
|
else
|
|
320
322
|
status, response, response_headers = make_request(m.interface.real_url(@rpath,@base),riddl_method,tp,th,tq,simulate,true)
|
|
321
323
|
end
|
|
322
324
|
return response if simulate
|
|
323
|
-
if status < 200 || status >= 300 || !@wrapper.check_message(response,response_headers,m.out)
|
|
325
|
+
if status < 200 || status >= 300 || (!(last && ignore) && !@wrapper.check_message(response,response_headers,m.out))
|
|
324
326
|
raise OutputError, "Not a valid output from service."
|
|
325
327
|
end
|
|
326
328
|
unless m == riddl_message.route.last
|
|
@@ -342,7 +344,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
342
344
|
end #}}}
|
|
343
345
|
private :exec_request
|
|
344
346
|
|
|
345
|
-
def make_request(url,riddl_method,parameters,headers,qparams,simulate,ack) #{{{
|
|
347
|
+
def make_request(url,riddl_method,parameters,headers,qparams,simulate,ack,ignore=false) #{{{
|
|
346
348
|
url = URI.parse(url)
|
|
347
349
|
qs = qparams.join('&')
|
|
348
350
|
if url.class == URI::HTTP || url.class == URI::HTTPS
|
|
@@ -371,8 +373,21 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
371
373
|
opts[:verbose] = true ### sadly only to console, does not respect @options[:debug]
|
|
372
374
|
end
|
|
373
375
|
|
|
376
|
+
# stream the body into the tempfile while receiving, so that large responses
|
|
377
|
+
# are not held in memory (without on_body, ethon collects the whole body)
|
|
378
|
+
bs = nil
|
|
379
|
+
unless ignore
|
|
380
|
+
bs = Parameter::Tempfile.new("RiddlBody")
|
|
381
|
+
bs.binmode
|
|
382
|
+
end
|
|
374
383
|
begin
|
|
375
384
|
req = Typhoeus::Request.new(uri,opts)
|
|
385
|
+
if ignore
|
|
386
|
+
req.on_body { |chunk,_| nil } # discard
|
|
387
|
+
else
|
|
388
|
+
bs.rewind; bs.truncate(0) # a redirect body must not end up in the result
|
|
389
|
+
req.on_body { |chunk,_| bs.write chunk; nil } # anything but :abort continues
|
|
390
|
+
end
|
|
376
391
|
res = req.run
|
|
377
392
|
|
|
378
393
|
response_headers = {}
|
|
@@ -389,8 +404,8 @@ unless Module.constants.include?('CLIENT_INCLUDED')
|
|
|
389
404
|
end
|
|
390
405
|
end while res.code.to_i == 302 || res.code.to_i == 301
|
|
391
406
|
|
|
392
|
-
|
|
393
|
-
|
|
407
|
+
return res.code.to_i, Riddl::Parameter::Array.new, response_headers if ignore
|
|
408
|
+
|
|
394
409
|
bs.rewind
|
|
395
410
|
|
|
396
411
|
response = Riddl::Protocols::HTTP::Parser.new(
|
data/lib/ruby/riddl/parameter.rb
CHANGED
|
@@ -52,9 +52,14 @@ module Riddl
|
|
|
52
52
|
end
|
|
53
53
|
class Tempfile < ::Tempfile
|
|
54
54
|
def _close
|
|
55
|
-
@tmpfile
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
if @tmpfile # older rubies keep the file in @tmpfile (and @data for the finalizer)
|
|
56
|
+
@tmpfile.close
|
|
57
|
+
@data[1] = nil if @data
|
|
58
|
+
@tmpfile = nil
|
|
59
|
+
else # newer rubies (e.g. 3.4) only have the delegated file, @tmpfile is never set
|
|
60
|
+
f = __getobj__
|
|
61
|
+
f.close unless f.closed?
|
|
62
|
+
end
|
|
58
63
|
end
|
|
59
64
|
end
|
|
60
65
|
end
|
data/riddl.gemspec
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "riddl"
|
|
3
|
-
s.version = "1.0.
|
|
3
|
+
s.version = "1.0.21"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
5
|
s.license = "LGPL-3.0-or-later"
|
|
6
6
|
s.summary = "Restful Interface Description and Declaration Language: tools and client/server libs"
|
|
7
7
|
|
|
8
8
|
s.description = "REST service interface definition, mixing, and evolution. Supports mixed http and xmpp servers."
|
|
9
9
|
|
|
10
|
-
s.files = Dir['{lib/ruby/riddl/ns/**/*,tools/**/*,ns/**/*,contrib/**/*,lib/ruby/riddl/**/*,examples/**/*}'] + %w(
|
|
10
|
+
s.files = Dir['{lib/ruby/riddl/ns/**/*,tools/**/*,ns/**/*,contrib/**/*,lib/ruby/riddl/**/*,examples/**/*}'] + %w(LICENSE Rakefile riddl.gemspec README.md TODO AUTHORS INSTALL.md)
|
|
11
11
|
|
|
12
12
|
s.require_path = 'lib/ruby'
|
|
13
13
|
s.extra_rdoc_files = ['README.md']
|
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: 1.0.
|
|
4
|
+
version: 1.0.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen 'eTM' Mangler
|
|
@@ -253,8 +253,8 @@ extra_rdoc_files:
|
|
|
253
253
|
- README.md
|
|
254
254
|
files:
|
|
255
255
|
- AUTHORS
|
|
256
|
-
- COPYING
|
|
257
256
|
- INSTALL.md
|
|
257
|
+
- LICENSE
|
|
258
258
|
- README.md
|
|
259
259
|
- Rakefile
|
|
260
260
|
- TODO
|
|
@@ -533,7 +533,7 @@ homepage: http://github.com/etm/riddl/
|
|
|
533
533
|
licenses:
|
|
534
534
|
- LGPL-3.0-or-later
|
|
535
535
|
metadata:
|
|
536
|
-
documentation_uri: https://gemdocs.org/gems/riddl/1.0.
|
|
536
|
+
documentation_uri: https://gemdocs.org/gems/riddl/1.0.21/
|
|
537
537
|
rdoc_options: []
|
|
538
538
|
require_paths:
|
|
539
539
|
- lib/ruby
|
/data/{COPYING → LICENSE}
RENAMED
|
File without changes
|