riddl 0.99.184 → 0.99.185

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: 34185cd539b33033e2da9a8a3de9adb7aebd52f0
4
- data.tar.gz: a72f90e26bcb0d45fa6b467c40c6c51ca0e2211f
3
+ metadata.gz: b0a37d9a0ef71a17381a6e147cecb2f3095a960d
4
+ data.tar.gz: 1f25bdb596b5731033653f93ad5f614f722552dc
5
5
  SHA512:
6
- metadata.gz: 67e128c69893b0d367c69bba32a3af43f3f688f49be990c6779fb13e707e8c4b89c7375349bf4ed1422b3eecb7770aeed3779458714323272b86709e4070699b
7
- data.tar.gz: 42ffb28d1beac0823471df53387d4d420173c3ab3172a080a8b16b596fe76449d80af7268aa4c2950749eeab0c182143ef05e836c5523d3c92a0433b243264f4
6
+ metadata.gz: 423a794bf828bd127cacd3483c34908a590abbb17a2aa9707ddc47be3e3a12111188333cad971839de9f1322ac7d6c212b87ab36a51f1abdff6aa9d321b42ccb
7
+ data.tar.gz: 8e01f996226211901f8b0b77c7c8c4bce0be6ee38c3d4439f868c50a1d6d63dac2f44efc0327392b52f80a92f045948ee5a8e122b5fd7839120e76cb7135a6ca
@@ -4,10 +4,12 @@
4
4
  <header name="RIDDL_DESCRIPTION" fixed="oh my, a riddl description"/>
5
5
  <parameter name="riddl-description" mimetype="text/xml"/>
6
6
  </message>
7
- <message name="riddl-resource-description-request">
7
+ <message name="riddl-resource-description-request" xmlns:doc="http://riddl.org/ns/documentation/1.0" doc:example="riddl-resource-description">
8
8
  <parameter name="riddl-resource-description" type="string"/>
9
9
  </message>
10
10
  <resource>
11
- <get in="riddl-resource-description-request" out="riddl-description-response"/>
11
+ <get in="riddl-resource-description-request" out="riddl-description-response">
12
+ <documentation xmlns="http://riddl.org/ns/documentation/1.0" summary="Show a list of operations and sub-resources for the current resource."/>
13
+ </get>
12
14
  </resource>
13
15
  </description>
@@ -4,10 +4,12 @@
4
4
  <header name="RIDDL_DESCRIPTION" fixed="oh my, a riddl description"/>
5
5
  <parameter name="riddl-description" mimetype="text/xml"/>
6
6
  </message>
7
- <message name="riddl-description-request">
7
+ <message name="riddl-description-request" xmlns:doc="http://riddl.org/ns/documentation/1.0" doc:example="riddl-description">
8
8
  <parameter name="riddl-description" type="string"/>
9
9
  </message>
10
10
  <resource>
11
- <get in="riddl-description-request" out="riddl-description-response"/>
11
+ <get in="riddl-description-request" out="riddl-description-response">
12
+ <documentation xmlns="http://riddl.org/ns/documentation/1.0" summary="Show all operations and the full resource tree for this REST service."/>
13
+ </get>
12
14
  </resource>
13
15
  </description>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0"?>
2
- <description xmlns="http://riddl.org/ns/description/1.0" xmlns:ann="http://riddl.org/ns/annotation/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns:doc="http://cpee.org/ns/documentation">
2
+ <description xmlns="http://riddl.org/ns/description/1.0" xmlns:ann="http://riddl.org/ns/annotation/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns:doc="http://riddl.org/ns/documentation/1.0">
3
3
  <message name="json">
4
4
  <parameter name="value" mimetype="application/json"/>
5
5
  </message>
@@ -271,7 +271,6 @@ module Riddl
271
271
  run Riddl::Utils::Description::RDR, @riddl.resource_description(@riddl_matching_path[0])
272
272
  end
273
273
  else
274
- @riddl_info[:d] = @riddl.resource_description(@riddl_matching_path[0])
275
274
  if @riddl.description?
276
275
  instance_exec(@riddl_info, &@riddl_interfaces[nil])
277
276
  elsif @riddl.declaration?
@@ -0,0 +1,197 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8"/>
5
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE"/>
6
+
7
+ <title>Documentation</title>
8
+
9
+ <style>
10
+ body {
11
+ counter-reset: h1counter;
12
+ }
13
+ h1 { font-size: 1.5em }
14
+ h2 { font-size: 1.2em }
15
+ h3 { font-size: 1.0em }
16
+ h1:before {
17
+ content: counter(h1counter) ".\0000a0\0000a0";
18
+ counter-increment: h1counter;
19
+ counter-reset: h2counter;
20
+ }
21
+ h2:before {
22
+ content: counter(h1counter) "." counter(h2counter) ".\0000a0\0000a0";
23
+ counter-increment: h2counter;
24
+ }
25
+ </style>
26
+
27
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
28
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
29
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js"></script>
30
+ <script src="https://cdn.rawgit.com/vkiryukhin/vkBeautify/master/vkbeautify.js"></script>
31
+ <script>//<![CDATA[
32
+ $.fn.serializeXML = function(){
33
+ var out = '';
34
+ if (typeof XMLSerializer == 'function') {
35
+ var xs = new XMLSerializer();
36
+ this.each(function() {
37
+ out += xs.serializeToString(this);
38
+ });
39
+ } else if (this[0] && this[0].xml != 'undefined') {
40
+ this.each(function() {
41
+ out += this.xml;
42
+ });
43
+ }
44
+ return out;
45
+ };
46
+
47
+ $(document).ready(function(){
48
+ var rpath = "<%= @h['RIDDL_DECLARATION_PATH'] %>";
49
+ var pathele = _.compact(rpath.split('/'));
50
+
51
+ var t = $('#breadcrumblink')[0];
52
+ var link = "";
53
+ _.each(pathele,function(e){
54
+ link = link + "/" + e;
55
+ var clone = document.importNode(t.content, true);
56
+ $('a',clone).attr('href',link + "/?doc=true");
57
+ $('a',clone).text(e);
58
+ $('#breadcrumb').append(clone);
59
+ });
60
+
61
+ $.ajax({
62
+ url: rpath + "?riddl-resource-description",
63
+ success: function(data){
64
+ $('#main').append(marked($('description > resource > documentation',data).text()));
65
+
66
+ $('description > resource > resource',data).each(function(k,ele){
67
+ var sum = $('documentation',ele).attr('summary');
68
+ var exa = $('example',ele).length == 0 ? null : $('example',ele).text();
69
+ if (exa) {
70
+ var rell = exa;
71
+ var relt = exa + ' (' + $(ele).attr('relative') + ')';
72
+ } else {
73
+ var rell = $(ele).attr('relative');
74
+ var relt = _.trim(rell);
75
+ }
76
+ var t = $('#subresourceitem')[0];
77
+ var clone = document.importNode(t.content, true);
78
+ $('a',clone).attr('href','./' + rell + '/?doc=true');
79
+ if (relt != "") {
80
+ $('a',clone).text(relt);
81
+ }
82
+ if (sum) { $('.content',clone).text(sum); }
83
+ $('#subresources .anchor').append(clone);
84
+ });
85
+
86
+ $('description > resource > :not(documentation):not(resource):not(example)',data).each(function(k,ele){
87
+ var sum = $('documentation',ele).attr('summary');
88
+ var details = $('documentation',ele).text();
89
+ var tin = $(ele).attr('in');
90
+ var tout = $(ele).attr('out');
91
+ var whatl = $(ele).prop('tagName');
92
+ var whatd = tin == "*" ? '' : '( ' + tin + ' )';
93
+ whatd += tout ? ' : ' + tout : '';
94
+
95
+ var ex = "";
96
+ var tinmess = "";
97
+ if (tin && tin != "*") {
98
+ $('description > message[name="' + tin + '"]',data).each(function(k,mess){
99
+ tinmess = mess;
100
+ _.each(mess.attributes,function(attr){
101
+ if (attr.localName == 'example' && attr.namespaceURI == "http://riddl.org/ns/documentation/1.0") {
102
+ ex = attr.nodeValue;
103
+ }
104
+ });
105
+ });
106
+ }
107
+ var toutmess = "";
108
+ if (tout && tout != "*") {
109
+ $('description > message[name="' + tout + '"]',data).each(function(k,mess){
110
+ toutmess = mess;
111
+ });
112
+ }
113
+
114
+ // Overview
115
+ var t = $('#operationitem')[0];
116
+ var clone = document.importNode(t.content, true);
117
+ $('.what .link',clone).text(whatl);
118
+ $('.what .link',clone).attr('href','#' + (whatl + '_' + whatd).replace(/ /g,'_'));
119
+ $('.what .details',clone).text(whatd);
120
+ if (ex != "") {
121
+ $('.what .try a',clone).attr('href','?' + ex);
122
+ } else {
123
+ $('.what .try',clone).remove();
124
+ }
125
+ if (sum) { $('.content',clone).text(sum); }
126
+ $('#operations .anchor').append(clone);
127
+
128
+ //Details
129
+ var t = $('#operationsec')[0];
130
+ var clone = document.importNode(t.content, true);
131
+ $('.what',clone).text(whatl + ' ' + whatd);
132
+ $('.what',clone).attr('id',(whatl + '_' + whatd).replace(/ /g,'_'));
133
+ $('.text',clone).text(details == "" ? sum : details);
134
+ if (ex != "") {
135
+ $('.try a',clone).attr('href','?' + ex);
136
+ $('.try a',clone).text('?' + ex);
137
+ } else {
138
+ $('.try',clone).remove();
139
+ }
140
+
141
+ if (tin && tin != "*") {
142
+ $('.input .message',clone).text(vkbeautify.xml($(tinmess).serializeXML()));
143
+ } else {
144
+ $('.input',clone).remove();
145
+ }
146
+ if (tout) {
147
+ $('.output .message',clone).text(vkbeautify.xml($(toutmess).serializeXML()));
148
+ } else {
149
+ $('.output',clone).remove();
150
+ }
151
+ $('#operations').append(clone);
152
+ });
153
+
154
+ }
155
+ });
156
+ });
157
+ //]]></script>
158
+ </head>
159
+ <body>
160
+ <template id="breadcrumblink"><span> / </span><a href=""></a></template>
161
+ <template id="subresourceitem"><li><div class='what'><a class='details' href=''>Example missing</a></div><div class="content"></div></li></template>
162
+ <template id="operationitem"><li><div class='what'><a class='link' href=''></a> <span class='details'></span> <span class='try'>(<a href=''>Try it!</a>)</span></div><div class="content"></div></li></template>
163
+ <template id="operationsec">
164
+ <section>
165
+ <h2 class="what" id=""></h2>
166
+ <p class="try">Example: <a href=""></a></p>
167
+ <p class="text"></p>
168
+ <div class="input">
169
+ <h3>Input</h3>
170
+ <pre class='message'></pre>
171
+ </div>
172
+ <div class="output">
173
+ <h3>Output</h3>
174
+ <pre class='message'></pre>
175
+ </div>
176
+ </section>
177
+ </template>
178
+
179
+ <nav id="breadcrumb">[<a href="/">TOP</a>]</nav>
180
+ <section id="main"></section>
181
+ <section id="subresources">
182
+ <h1>Sub-Resources</h1>
183
+ <p>From here on you can go to the following sub resources:</p>
184
+ <ul class="anchor"></ul>
185
+ </section>
186
+ <section id="operations">
187
+ <h1>Operations</h1>
188
+ <section>
189
+ <p>For this resource the following operations are possible:</p>
190
+ <ul class="anchor"></ul>
191
+ </section>
192
+ </section>
193
+ </body>
194
+ </html>
195
+
196
+
197
+
@@ -0,0 +1,14 @@
1
+ require 'erb'
2
+
3
+ module Riddl
4
+ module Utils
5
+
6
+ class DocOverlay < Riddl::Implementation
7
+ def response
8
+ rval = ERB.new(File.read(File.dirname(__FILE__) + '/docoverlay.html'), 0, "%<>")
9
+ Riddl::Parameter::Complex.new('documentationresponse','text/html',rval.result(binding))
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -16,9 +16,9 @@ module Riddl
16
16
  end
17
17
 
18
18
  def real_path(real)
19
- t = @top.sub(/^\/*/,'').split('/')
19
+ t = @top.sub(/^\/*/,'').split(/(?<!\*\*)\//)
20
20
  real = real.sub(/^\/*/,'').split('/')
21
- real = real[t.length..-1]
21
+ real = t.last == "**/*" ? [] : real[t.length..-1]
22
22
  '/' + real.join('/')
23
23
  end
24
24
 
@@ -4,10 +4,12 @@
4
4
  <header name="RIDDL_DESCRIPTION" fixed="oh my, a riddl description"/>
5
5
  <parameter name="riddl-description" mimetype="text/xml"/>
6
6
  </message>
7
- <message name="riddl-resource-description-request">
7
+ <message name="riddl-resource-description-request" xmlns:doc="http://riddl.org/ns/documentation/1.0" doc:example="riddl-resource-description">
8
8
  <parameter name="riddl-resource-description" type="string"/>
9
9
  </message>
10
10
  <resource>
11
- <get in="riddl-resource-description-request" out="riddl-description-response"/>
11
+ <get in="riddl-resource-description-request" out="riddl-description-response">
12
+ <documentation xmlns="http://riddl.org/ns/documentation/1.0" summary="Show a list of operations and sub-resources for the current resource."/>
13
+ </get>
12
14
  </resource>
13
15
  </description>
@@ -4,10 +4,12 @@
4
4
  <header name="RIDDL_DESCRIPTION" fixed="oh my, a riddl description"/>
5
5
  <parameter name="riddl-description" mimetype="text/xml"/>
6
6
  </message>
7
- <message name="riddl-description-request">
7
+ <message name="riddl-description-request" xmlns:doc="http://riddl.org/ns/documentation/1.0" doc:example="riddl-description">
8
8
  <parameter name="riddl-description" type="string"/>
9
9
  </message>
10
10
  <resource>
11
- <get in="riddl-description-request" out="riddl-description-response"/>
11
+ <get in="riddl-description-request" out="riddl-description-response">
12
+ <documentation xmlns="http://riddl.org/ns/documentation/1.0" summary="Show all operations and the full resource tree for this REST service."/>
13
+ </get>
12
14
  </resource>
13
15
  </description>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0"?>
2
- <description xmlns="http://riddl.org/ns/description/1.0" xmlns:ann="http://riddl.org/ns/annotation/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns:doc="http://cpee.org/ns/documentation">
2
+ <description xmlns="http://riddl.org/ns/description/1.0" xmlns:ann="http://riddl.org/ns/annotation/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns:doc="http://riddl.org/ns/documentation/1.0">
3
3
  <message name="json">
4
4
  <parameter name="value" mimetype="application/json"/>
5
5
  </message>
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.184"
3
+ s.version = "0.99.185"
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.184
4
+ version: 0.99.185
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-23 00:00:00.000000000 Z
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-smart
@@ -418,6 +418,8 @@ files:
418
418
  - lib/ruby/riddl/roles/http%3A%2F%2Foauth.net%2F1.0/base.rb
419
419
  - lib/ruby/riddl/server.rb
420
420
  - lib/ruby/riddl/utils/description.rb
421
+ - lib/ruby/riddl/utils/docoverlay.html
422
+ - lib/ruby/riddl/utils/docoverlay.rb
421
423
  - lib/ruby/riddl/utils/downloadify.rb
422
424
  - lib/ruby/riddl/utils/erbserve.rb
423
425
  - lib/ruby/riddl/utils/fileserve.rb