riddl 0.99.245 → 0.99.246

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: 21279b3a0870c0fd0d3a2662b7282c858ca4c641
4
- data.tar.gz: 82bf92d098062a188f9cd7576e44583566b52b4b
3
+ metadata.gz: 2d2c9d061ddbc2a8af946846e2dd0283b17436bd
4
+ data.tar.gz: 5dd79ed2204159227425adac82b287f51c18c634
5
5
  SHA512:
6
- metadata.gz: b98a624e3da8b53ce1e5561c4ef2a66106dc179de3e814f71aa424c67a32ba9de236ce39d10d0889d6a6d2cc9aa33739c1e6f3d570b9fd0c8ca15b01fd79f6aa
7
- data.tar.gz: 61a94dbce9455f865851b7745e3c93cba9f8585509f3493c9cca4631cc770de79f911a40f7b1b791aa8292a49b90a584833deb0d4a4982a8c605a6491a344a6e
6
+ metadata.gz: 592254242b6f4406e2648efe6c413fd08cdeaa039abe64c564d9b4914bd402658b3d4b6c13ca1ed87196b3c84b2fab0481614eec9eb5adc8182945d895cc5d2d
7
+ data.tar.gz: bba2eb519a581e3eb84fa8ea47d82ebac260e405320c356f1baffedf0fe4449fc08e74cadb518ab2239f9b56e2f548dadbc0952199ee7347af0dea3a82fc647d
data/AUTHORS CHANGED
@@ -1,4 +1,3 @@
1
1
  Jürgen Mangler <juergen.mangler@gmail.com>
2
2
  Florian Stertz <florian.stertz@gmail.com>
3
3
  Sonja Biedermann <s.bdrmnn@gmail.com>
4
-
@@ -21,7 +21,7 @@ class StringIO #{{{
21
21
  end #}}}
22
22
 
23
23
  class SignalWait #{{{
24
- def initialize
24
+ def initialize
25
25
  @q = Queue.new
26
26
  end
27
27
 
@@ -93,7 +93,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
93
93
  end
94
94
  if URI.parse(@base).scheme == 'xmpp' && !((@options[:jid] && @options[:pass]) || @options[:xmpp].is_a?(Blather::Client))
95
95
  raise ConnectionError, 'XMPP connections need jid/pass or Blather::client object passed as options to be successful.'
96
- end
96
+ end
97
97
  if URI.parse(@base).scheme == 'xmpp' && @options[:jid] && @options[:pass]
98
98
  sig = SignalWait.new
99
99
  Thread::abort_on_exception = true
@@ -108,7 +108,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
108
108
  end
109
109
  rescue
110
110
  raise ConnectionError, 'XMPP connection not successful.'
111
- end
111
+ end
112
112
  end
113
113
  sig.wait 2
114
114
  end
@@ -168,7 +168,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
168
168
  raise PathError, 'Path not found.' if @path.nil?
169
169
  @path[0]
170
170
  end
171
- @rpath = @rpath == '/' ? '' : @rpath
171
+ @rpath = @rpath == '/' ? '' : @rpath
172
172
  end #}}}
173
173
  attr_reader :rpath
174
174
 
@@ -187,7 +187,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
187
187
  end
188
188
 
189
189
  blk.call(conn)
190
- end
190
+ end
191
191
  end #}}}
192
192
 
193
193
  def get(parameters = []) #{{{
@@ -196,7 +196,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
196
196
  def simulate_get(parameters = []) #{{{
197
197
  exec_request('GET',parameters,true)
198
198
  end #}}}
199
-
199
+
200
200
  def post(parameters = []) #{{{
201
201
  exec_request('POST',parameters,false)
202
202
  end #}}}
@@ -231,7 +231,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
231
231
  end
232
232
  end
233
233
  raise ArgumentError, "Hash with ONE method => parameters pair required"
234
- end #}}}
234
+ end #}}}
235
235
  private :priv_request
236
236
 
237
237
  def extract_options(parameters) #{{{
@@ -260,7 +260,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
260
260
  headers
261
261
  end #}}}
262
262
  private :extract_headers
263
-
263
+
264
264
  def extract_qparams(parameters,method) #{{{
265
265
  qparams = []
266
266
  starting = true
@@ -291,7 +291,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
291
291
  role = @wrapper.role(@path)
292
292
  if Riddl::Roles::roles[role]
293
293
  Riddl::Roles::roles[role]::before(@base + @rpath,riddl_method.downcase,parameters,headers,options) if Riddl::Roles::roles[role].respond_to?(:before)
294
- end
294
+ end
295
295
  riddl_message = @wrapper.io_messages(@path,riddl_method.downcase,parameters,headers)
296
296
  if riddl_message.nil?
297
297
  raise InputError, "Not a valid input to service."
@@ -318,7 +318,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
318
318
  unless @wrapper.check_message(response,response_headers,riddl_message.out)
319
319
  raise OutputError, "Not a valid output from service."
320
320
  end
321
- end
321
+ end
322
322
  else
323
323
  tp = parameters
324
324
  th = headers
@@ -328,7 +328,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
328
328
  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)
329
329
  else
330
330
  status, response, response_headers = make_request(m.interface.real_url(@rpath,@base),riddl_method,tp,th,tq,simulate,true)
331
- end
331
+ end
332
332
  return response if simulate
333
333
  if status < 200 || status >= 300 || !@wrapper.check_message(response,response_headers,m.out)
334
334
  raise OutputError, "Not a valid output from service."
@@ -346,8 +346,8 @@ unless Module.constants.include?('CLIENT_INCLUDED')
346
346
  unless role.nil?
347
347
  if Riddl::Roles::roles[role]
348
348
  response = Riddl::Roles::roles[role]::after(@base + @rpath,riddl_method.downcase,status,response,response_headers,options) if Riddl::Roles::roles[role].respond_to?(:after)
349
- end
350
- end
349
+ end
350
+ end
351
351
  return status, response, response_headers
352
352
  end #}}}
353
353
  private :exec_request
@@ -356,7 +356,7 @@ unless Module.constants.include?('CLIENT_INCLUDED')
356
356
  url = URI.parse(url)
357
357
  qs = qparams.join('&')
358
358
  if url.class == URI::HTTP || url.class == URI::HTTPS
359
- #{{{
359
+ #{{{
360
360
  req = Riddl::Client::HTTPRequest.new(riddl_method,url.path,parameters,headers,qs)
361
361
  return req.simulate if simulate
362
362
 
@@ -366,10 +366,10 @@ unless Module.constants.include?('CLIENT_INCLUDED')
366
366
  if url.class == URI::HTTPS
367
367
  http.use_ssl = true
368
368
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
369
- end
369
+ end
370
370
  if @options[:debug]
371
371
  http.set_debug_output @options[:debug]
372
- end
372
+ end
373
373
  http.start do
374
374
  retrycount = 0
375
375
  begin
@@ -401,12 +401,12 @@ unless Module.constants.include?('CLIENT_INCLUDED')
401
401
  res.each do |k,v|
402
402
  if v.nil?
403
403
  response_headers[k.name.upcase.gsub(/\-/,'_')] = v
404
- else
404
+ else
405
405
  response_headers[k.upcase.gsub(/\-/,'_')] = v
406
- end
406
+ end
407
407
  end
408
408
  return res.code.to_i, response, response_headers
409
- #}}}
409
+ #}}}
410
410
  elsif url.class == URI::Generic && url.scheme.downcase == 'xmpp'
411
411
  #{{{
412
412
  req = Riddl::Client::XMPPRequest.new(riddl_method,url.user + "@" + url.host,url.path,parameters,headers,qs,ack)
@@ -436,13 +436,13 @@ unless Module.constants.include?('CLIENT_INCLUDED')
436
436
  res.register_namespace 'se', Blather::StanzaError::STANZA_ERR_NS
437
437
  err = res.find('string(/message/error/se:text)')
438
438
  status = (err.match(/\d+/)[0] || 209).to_i
439
- end
439
+ end
440
440
  sig.continue
441
441
  end
442
442
  sig.wait
443
443
  else
444
444
  status = 200
445
- @options[:xmpp].write stanza
445
+ @options[:xmpp].write stanza
446
446
 
447
447
  # xmpp writes in next_tick so we have to fucking wait also a tick
448
448
  # to ensure that all shit has been written. fuck. not the best
@@ -478,6 +478,9 @@ unless Module.constants.include?('CLIENT_INCLUDED')
478
478
 
479
479
  def simulate
480
480
  sock = StringIO.new('')
481
+ sock.define_singleton_method(:io) do
482
+ sock
483
+ end
481
484
  self.exec(sock,"1.1",self.path)
482
485
  sock.rewind
483
486
  [nil, sock, []]
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.245"
3
+ s.version = "0.99.246"
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.245
4
+ version: 0.99.246
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen 'eTM' Mangler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: tools
12
12
  cert_chain: []
13
- date: 2016-05-23 00:00:00.000000000 Z
13
+ date: 2016-08-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: xml-smart