riddl 0.99.187 → 0.99.188

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: a2a66a5fae23e728695a686b2d059ac4b3ba65ce
4
- data.tar.gz: fc0060b340bee403e33bc45962c41cde11d4e1d2
3
+ metadata.gz: 5b01c46ef0a3f9949f0460a86dcb158c5364da1d
4
+ data.tar.gz: 17f8127d8a75e5f07d14d6aaf5f10a0a02cfb82b
5
5
  SHA512:
6
- metadata.gz: b37e33a0dc5d8d358ca6730745fa0f27536f1e5acea5ddcaf3fc97d8d6f5d632869da73927098944dd85e6efb55fbd73ddcd92021f1f7fc2f0bd83eac790c2f5
7
- data.tar.gz: 6c0af2e2474e1a7bbe2caedefb54396a4ffb0efd73e6a4cab7d773b200f805534f0fa81c83807309406900a9ab3f54ef4b03e79b7445c0169b714f788bb2720a
6
+ metadata.gz: 46aee5876655c5e0986acb3a7ca2ee3b43558dd7351ff4628612e745b1060e810d42af0d9da98e51a2e0c2419d5e34617bfca5e851d8d8e3cf6f5480f23212af
7
+ data.tar.gz: ba3ff8c03b896081b9986a02844f78b7fcfadebde58798733484f806178d46357a1a01f38d3414e623902ddd7e84e3482a7c5b83072a56e5a5547b720480e478
@@ -101,7 +101,7 @@
101
101
  var whatd = tin == "*" ? '' : '( ' + tin + ' )';
102
102
  whatd += tout ? ' : ' + tout : '';
103
103
 
104
- var ex = "";
104
+ var ex = null;
105
105
  var tinmess = "";
106
106
  if (tin && tin != "*") {
107
107
  $('description > message[name="' + tin + '"]',data).each(function(k,mess){
@@ -113,6 +113,7 @@
113
113
  });
114
114
  });
115
115
  }
116
+ if ($('example',ele).length > 0) { ex = $('example',ele).text(); }
116
117
  var toutmess = "";
117
118
  if (tout && tout != "*") {
118
119
  $('description > message[name="' + tout + '"]',data).each(function(k,mess){
@@ -126,8 +127,11 @@
126
127
  $('.what .link',clone).text(whatl);
127
128
  $('.what .link',clone).attr('href','#' + (whatl + '_' + whatd).replace(/ /g,'_'));
128
129
  $('.what .details',clone).text(whatd);
129
- if (ex != "") {
130
- $('.what .try a',clone).attr('href','?' + ex);
130
+ if (ex != null) {
131
+ if (ex == "")
132
+ $('.what .try a',clone).attr('href',window.location.pathname);
133
+ else
134
+ $('.what .try a',clone).attr('href','?' + ex);
131
135
  } else {
132
136
  $('.what .try',clone).remove();
133
137
  }
@@ -139,10 +143,18 @@
139
143
  var clone = document.importNode(t.content, true);
140
144
  $('.what',clone).text(whatl + ' ' + whatd);
141
145
  $('.what',clone).attr('id',(whatl + '_' + whatd).replace(/ /g,'_'));
142
- $('.text',clone).text(details == "" ? sum : marked(details));
143
- if (ex != "") {
144
- $('.try a',clone).attr('href','?' + ex);
145
- $('.try a',clone).text('?' + ex);
146
+ if (_.trim(details) == "") {
147
+ $('.text',clone).text(sum);
148
+ } else {
149
+ $('.text',clone).append(marked(details));
150
+ }
151
+ if (ex != null) {
152
+ if (ex == "") {
153
+ $('.try a',clone).attr('href',window.location.pathname);
154
+ } else {
155
+ $('.try a',clone).attr('href','?' + ex);
156
+ $('.try a',clone).text('?' + ex);
157
+ }
146
158
  } else {
147
159
  $('.try',clone).remove();
148
160
  }
@@ -172,7 +184,7 @@
172
184
  <template id="operationsec">
173
185
  <section>
174
186
  <h2 class="what" id=""></h2>
175
- <p class="try">Example: <a href=""></a></p>
187
+ <p class="try">Example: <a href=""><i>no parameters</i></a></p>
176
188
  <p class="text"></p>
177
189
  <div class="input">
178
190
  <h3>Input</h3>
@@ -0,0 +1,40 @@
1
+ require 'mime/types'
2
+ require 'charlock_holmes'
3
+ require 'digest/md5'
4
+ require 'xml/smart'
5
+
6
+ module Riddl
7
+ module Utils
8
+ class XMLServe < Riddl::Implementation
9
+ def response
10
+ path = File.file?(@a[0]) ? @a[0] : nil
11
+ xpath = @a[1]
12
+
13
+ if path.nil? || File.directory?(path)
14
+ @status = 404
15
+ return []
16
+ end
17
+ if File.exists?(path)
18
+ mtime = File.mtime(path)
19
+ @headers << Riddl::Header.new("Last-Modified",mtime.httpdate)
20
+ @headers << Riddl::Header.new("Cache-Control","max-age=15552000, public")
21
+ @headers << Riddl::Header.new("ETag",Digest::MD5.hexdigest(mtime.httpdate))
22
+ htime = @env["HTTP_IF_MODIFIED_SINCE"].nil? ? Time.at(0) : Time.parse(@env["HTTP_IF_MODIFIED_SINCE"])
23
+ if htime == mtime
24
+ @headers << Riddl::Header.new("Connection","close")
25
+ @status = 304 # Not modified
26
+ return []
27
+ else
28
+ if xpath
29
+ res = XML::Smart.open(path).find(xpath)
30
+ return Riddl::Parameter::Complex.new('file','text/xml',res.any? ? res.first.dump : '<empty/>')
31
+ else
32
+ return Riddl::Parameter::Complex.new('file','text/xml',File.open(path,'r'))
33
+ end
34
+ end
35
+ end
36
+ @status = 404
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.187"
3
+ s.version = "0.99.188"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.187
4
+ version: 0.99.188
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2015-03-28 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-smart
@@ -426,6 +426,7 @@ files:
426
426
  - lib/ruby/riddl/utils/notifications_producer.rb
427
427
  - lib/ruby/riddl/utils/properties.rb
428
428
  - lib/ruby/riddl/utils/turtle.rb
429
+ - lib/ruby/riddl/utils/xmlserve.rb
429
430
  - lib/ruby/riddl/utils/xsloverlay.rb
430
431
  - lib/ruby/riddl/wrapper.rb
431
432
  - lib/ruby/riddl/wrapper/declaration.rb