ruby_odata 0.0.1
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.
- data/.gitignore +9 -0
- data/LICENSE +24 -0
- data/README.rdoc +107 -0
- data/Rakefile +28 -0
- data/VERSION +1 -0
- data/config/cucumber.yml +7 -0
- data/doc/classes/OData/ClassBuilder.html +219 -0
- data/doc/classes/OData/Operation.html +194 -0
- data/doc/classes/OData/QueryBuilder.html +305 -0
- data/doc/classes/OData/Service.html +420 -0
- data/doc/classes/OData.html +126 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_rdoc.html +252 -0
- data/doc/files/lib/odata_ruby/class_builder_rb.html +101 -0
- data/doc/files/lib/odata_ruby/operation_rb.html +101 -0
- data/doc/files/lib/odata_ruby/query_builder_rb.html +101 -0
- data/doc/files/lib/odata_ruby/service_rb.html +101 -0
- data/doc/files/lib/odata_ruby_rb.html +114 -0
- data/doc/fr_class_index.html +31 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +40 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/features/service.feature +82 -0
- data/features/service_manage.feature +44 -0
- data/features/step_definitions/service_steps.rb +132 -0
- data/features/support/env.rb +4 -0
- data/features/support/hooks.rb +4 -0
- data/lib/odata_ruby/class_builder.rb +84 -0
- data/lib/odata_ruby/operation.rb +18 -0
- data/lib/odata_ruby/query_builder.rb +63 -0
- data/lib/odata_ruby/service.rb +207 -0
- data/lib/odata_ruby.rb +15 -0
- data/ruby_odata.gemspec +94 -0
- data/test/Cassini x64.bat +1 -0
- data/test/Cassini x86.bat +1 -0
- data/test/SampleService/App_Code/Entities.cs +39 -0
- data/test/SampleService/App_Code/Model.Designer.cs +414 -0
- data/test/SampleService/App_Code/Model.edmx +140 -0
- data/test/SampleService/App_Data/_TestDB.mdf +0 -0
- data/test/SampleService/App_Data/_TestDB_Log.ldf +0 -0
- data/test/SampleService/Entities.svc +1 -0
- data/test/SampleService/web.config +27 -0
- data/test/blueprints.rb +16 -0
- metadata +158 -0
@@ -0,0 +1,305 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: OData::QueryBuilder</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">OData::QueryBuilder</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/odata_ruby/query_builder_rb.html">
|
59
|
+
lib/odata_ruby/query_builder.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
The <a href="QueryBuilder.html#M000007">query</a> builder is used to call
|
84
|
+
<a href="QueryBuilder.html#M000007">query</a> operations against the
|
85
|
+
service. This shouldn‘t be called directly, but rather it is returned
|
86
|
+
from the dynamic methods created for the specific service that you are
|
87
|
+
calling.
|
88
|
+
</p>
|
89
|
+
<p>
|
90
|
+
For example, given the following code snippet:
|
91
|
+
</p>
|
92
|
+
<pre>
|
93
|
+
svc = OData::Service.new "http://127.0.0.1:8888/SampleService/Entities.svc"
|
94
|
+
svc.Categories
|
95
|
+
</pre>
|
96
|
+
<p>
|
97
|
+
The <b>Categories</b> method would return a <a
|
98
|
+
href="QueryBuilder.html">QueryBuilder</a>
|
99
|
+
</p>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div id="method-list">
|
107
|
+
<h3 class="section-bar">Methods</h3>
|
108
|
+
|
109
|
+
<div class="name-list">
|
110
|
+
<a href="#M000005">expand</a>
|
111
|
+
<a href="#M000006">filter</a>
|
112
|
+
<a href="#M000004">new</a>
|
113
|
+
<a href="#M000007">query</a>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
<!-- if includes -->
|
121
|
+
|
122
|
+
<div id="section">
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<!-- if method_list -->
|
132
|
+
<div id="methods">
|
133
|
+
<h3 class="section-bar">Public Class methods</h3>
|
134
|
+
|
135
|
+
<div id="method-M000004" class="method-detail">
|
136
|
+
<a name="M000004"></a>
|
137
|
+
|
138
|
+
<div class="method-heading">
|
139
|
+
<a href="#M000004" class="method-signature">
|
140
|
+
<span class="method-name">new</span><span class="method-args">(root)</span>
|
141
|
+
</a>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="method-description">
|
145
|
+
<p>
|
146
|
+
Creates a <a href="QueryBuilder.html#M000004">new</a> instance of the <a
|
147
|
+
href="QueryBuilder.html">QueryBuilder</a> class
|
148
|
+
</p>
|
149
|
+
<h4>Required Attributes</h4>
|
150
|
+
<ul>
|
151
|
+
<li>root: The root entity collection to <a
|
152
|
+
href="QueryBuilder.html#M000007">query</a> against
|
153
|
+
|
154
|
+
</li>
|
155
|
+
</ul>
|
156
|
+
<p><a class="source-toggle" href="#"
|
157
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
158
|
+
<div class="method-source-code" id="M000004-source">
|
159
|
+
<pre>
|
160
|
+
<span class="ruby-comment cmt"># File lib/odata_ruby/query_builder.rb, line 13</span>
|
161
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">root</span>)
|
162
|
+
<span class="ruby-ivar">@root</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">to_s</span>
|
163
|
+
<span class="ruby-ivar">@expands</span> = []
|
164
|
+
<span class="ruby-ivar">@filters</span> = []
|
165
|
+
<span class="ruby-keyword kw">end</span>
|
166
|
+
</pre>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
172
|
+
|
173
|
+
<div id="method-M000005" class="method-detail">
|
174
|
+
<a name="M000005"></a>
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
<a href="#M000005" class="method-signature">
|
178
|
+
<span class="method-name">expand</span><span class="method-args">(path)</span>
|
179
|
+
</a>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="method-description">
|
183
|
+
<p>
|
184
|
+
Used to eagerly-load data for nested objects, for example, obtaining a
|
185
|
+
Category for a Product within one call to the server
|
186
|
+
</p>
|
187
|
+
<h4>Required Attributes</h4>
|
188
|
+
<ul>
|
189
|
+
<li>path: The path of the entity to <a
|
190
|
+
href="QueryBuilder.html#M000005">expand</a> relative to the root
|
191
|
+
|
192
|
+
</li>
|
193
|
+
</ul>
|
194
|
+
<h4>Example</h4>
|
195
|
+
<pre>
|
196
|
+
# Without expanding the query (no Category will be filled in for the Product)
|
197
|
+
svc.Products(1)
|
198
|
+
prod1 = svc.execute
|
199
|
+
|
200
|
+
# With expanding the query (the Category will be filled in)
|
201
|
+
svc.Products(1).expand('Category')
|
202
|
+
prod1 = svc.execute
|
203
|
+
</pre>
|
204
|
+
<p><a class="source-toggle" href="#"
|
205
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
206
|
+
<div class="method-source-code" id="M000005-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/odata_ruby/query_builder.rb, line 31</span>
|
209
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">path</span>)
|
210
|
+
<span class="ruby-ivar">@expands</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">path</span>
|
211
|
+
<span class="ruby-keyword kw">self</span>
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
</pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="method-M000006" class="method-detail">
|
219
|
+
<a name="M000006"></a>
|
220
|
+
|
221
|
+
<div class="method-heading">
|
222
|
+
<a href="#M000006" class="method-signature">
|
223
|
+
<span class="method-name">filter</span><span class="method-args">(filter)</span>
|
224
|
+
</a>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
<p>
|
229
|
+
Used to <a href="QueryBuilder.html#M000006">filter</a> data being returned
|
230
|
+
</p>
|
231
|
+
<h4>Required Attributes</h4>
|
232
|
+
<ul>
|
233
|
+
<li><a href="QueryBuilder.html#M000006">filter</a>: The path of the entity to
|
234
|
+
<a href="QueryBuilder.html#M000005">expand</a> relative to the root
|
235
|
+
|
236
|
+
</li>
|
237
|
+
</ul>
|
238
|
+
<h4>Example</h4>
|
239
|
+
<pre>
|
240
|
+
svc.Products.filter("Name eq 'Product 2'")
|
241
|
+
prod = svc.execute
|
242
|
+
</pre>
|
243
|
+
<p><a class="source-toggle" href="#"
|
244
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
245
|
+
<div class="method-source-code" id="M000006-source">
|
246
|
+
<pre>
|
247
|
+
<span class="ruby-comment cmt"># File lib/odata_ruby/query_builder.rb, line 43</span>
|
248
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">filter</span>(<span class="ruby-identifier">filter</span>)
|
249
|
+
<span class="ruby-ivar">@filters</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">filter</span>)
|
250
|
+
<span class="ruby-keyword kw">self</span>
|
251
|
+
<span class="ruby-keyword kw">end</span>
|
252
|
+
</pre>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
<div id="method-M000007" class="method-detail">
|
258
|
+
<a name="M000007"></a>
|
259
|
+
|
260
|
+
<div class="method-heading">
|
261
|
+
<a href="#M000007" class="method-signature">
|
262
|
+
<span class="method-name">query</span><span class="method-args">()</span>
|
263
|
+
</a>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<div class="method-description">
|
267
|
+
<p>
|
268
|
+
Builds the <a href="QueryBuilder.html#M000007">query</a> URI (path, not
|
269
|
+
including root) incorporating expands, filters, etc. This is used
|
270
|
+
internally when the execute method is called on the service
|
271
|
+
</p>
|
272
|
+
<p><a class="source-toggle" href="#"
|
273
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
274
|
+
<div class="method-source-code" id="M000007-source">
|
275
|
+
<pre>
|
276
|
+
<span class="ruby-comment cmt"># File lib/odata_ruby/query_builder.rb, line 50</span>
|
277
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
|
278
|
+
<span class="ruby-identifier">q</span> = <span class="ruby-ivar">@root</span>.<span class="ruby-identifier">clone</span>
|
279
|
+
<span class="ruby-identifier">query_options</span> = []
|
280
|
+
<span class="ruby-identifier">query_options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"$expand=#{@expands.join(',')}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@expands</span>.<span class="ruby-identifier">empty?</span>
|
281
|
+
<span class="ruby-identifier">query_options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"$filter=#{@filters.join('+and+')}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@filters</span>.<span class="ruby-identifier">empty?</span>
|
282
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">query_options</span>.<span class="ruby-identifier">empty?</span>
|
283
|
+
<span class="ruby-identifier">q</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"?"</span>
|
284
|
+
<span class="ruby-identifier">q</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">query_options</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&'</span>)
|
285
|
+
<span class="ruby-keyword kw">end</span>
|
286
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">q</span>
|
287
|
+
<span class="ruby-keyword kw">end</span>
|
288
|
+
</pre>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
<div id="validator-badges">
|
301
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
</body>
|
305
|
+
</html>
|