ruby_odata 0.0.1 → 0.0.2
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 +2 -1
- data/CHANGELOG.rdoc +10 -0
- data/VERSION +1 -1
- data/features/query_builder.feature +96 -0
- data/features/service.feature +0 -33
- data/features/step_definitions/service_steps.rb +35 -0
- data/lib/odata_ruby/query_builder.rb +15 -1
- data/ruby_odata.gemspec +6 -20
- metadata +7 -21
- data/doc/classes/OData.html +0 -126
- data/doc/classes/OData/ClassBuilder.html +0 -219
- data/doc/classes/OData/Operation.html +0 -194
- data/doc/classes/OData/QueryBuilder.html +0 -305
- data/doc/classes/OData/Service.html +0 -420
- data/doc/created.rid +0 -1
- data/doc/files/README_rdoc.html +0 -252
- data/doc/files/lib/odata_ruby/class_builder_rb.html +0 -101
- data/doc/files/lib/odata_ruby/operation_rb.html +0 -101
- data/doc/files/lib/odata_ruby/query_builder_rb.html +0 -101
- data/doc/files/lib/odata_ruby/service_rb.html +0 -101
- data/doc/files/lib/odata_ruby_rb.html +0 -114
- data/doc/fr_class_index.html +0 -31
- data/doc/fr_file_index.html +0 -32
- data/doc/fr_method_index.html +0 -40
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
@@ -1,219 +0,0 @@
|
|
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::ClassBuilder</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::ClassBuilder</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/odata_ruby/class_builder_rb.html">
|
59
|
-
lib/odata_ruby/class_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
|
-
Internally used helper class for building a dynamic class. This class
|
84
|
-
shouldn‘t be called directly.
|
85
|
-
</p>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
<div id="method-list">
|
93
|
-
<h3 class="section-bar">Methods</h3>
|
94
|
-
|
95
|
-
<div class="name-list">
|
96
|
-
<a href="#M000003">build</a>
|
97
|
-
<a href="#M000002">new</a>
|
98
|
-
</div>
|
99
|
-
</div>
|
100
|
-
|
101
|
-
</div>
|
102
|
-
|
103
|
-
|
104
|
-
<!-- if includes -->
|
105
|
-
|
106
|
-
<div id="section">
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
<!-- if method_list -->
|
116
|
-
<div id="methods">
|
117
|
-
<h3 class="section-bar">Public Class methods</h3>
|
118
|
-
|
119
|
-
<div id="method-M000002" class="method-detail">
|
120
|
-
<a name="M000002"></a>
|
121
|
-
|
122
|
-
<div class="method-heading">
|
123
|
-
<a href="#M000002" class="method-signature">
|
124
|
-
<span class="method-name">new</span><span class="method-args">(klass_name, methods, nav_props)</span>
|
125
|
-
</a>
|
126
|
-
</div>
|
127
|
-
|
128
|
-
<div class="method-description">
|
129
|
-
<p>
|
130
|
-
Creates a <a href="ClassBuilder.html#M000002">new</a> instance of the <a
|
131
|
-
href="ClassBuilder.html">ClassBuilder</a> class
|
132
|
-
</p>
|
133
|
-
<h4>Required Attributes</h4>
|
134
|
-
<ul>
|
135
|
-
<li>klass_name: The name/type of the class to create
|
136
|
-
|
137
|
-
</li>
|
138
|
-
<li>methods: The accessor methods to add to the class
|
139
|
-
|
140
|
-
</li>
|
141
|
-
<li>nav_props: The accessor methods to add for navigation properties
|
142
|
-
|
143
|
-
</li>
|
144
|
-
</ul>
|
145
|
-
<p><a class="source-toggle" href="#"
|
146
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
147
|
-
<div class="method-source-code" id="M000002-source">
|
148
|
-
<pre>
|
149
|
-
<span class="ruby-comment cmt"># File lib/odata_ruby/class_builder.rb, line 10</span>
|
150
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">klass_name</span>, <span class="ruby-identifier">methods</span>, <span class="ruby-identifier">nav_props</span>)
|
151
|
-
<span class="ruby-ivar">@klass_name</span> = <span class="ruby-identifier">klass_name</span>
|
152
|
-
<span class="ruby-ivar">@methods</span> = <span class="ruby-identifier">methods</span>
|
153
|
-
<span class="ruby-ivar">@nav_props</span> = <span class="ruby-identifier">nav_props</span>
|
154
|
-
<span class="ruby-keyword kw">end</span>
|
155
|
-
</pre>
|
156
|
-
</div>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
161
|
-
|
162
|
-
<div id="method-M000003" class="method-detail">
|
163
|
-
<a name="M000003"></a>
|
164
|
-
|
165
|
-
<div class="method-heading">
|
166
|
-
<a href="#M000003" class="method-signature">
|
167
|
-
<span class="method-name">build</span><span class="method-args">()</span>
|
168
|
-
</a>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
<p>
|
173
|
-
Returns a dynamically generated class definition based on the constructor
|
174
|
-
parameters
|
175
|
-
</p>
|
176
|
-
<p><a class="source-toggle" href="#"
|
177
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
178
|
-
<div class="method-source-code" id="M000003-source">
|
179
|
-
<pre>
|
180
|
-
<span class="ruby-comment cmt"># File lib/odata_ruby/class_builder.rb, line 17</span>
|
181
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>
|
182
|
-
<span class="ruby-comment cmt"># return if already built</span>
|
183
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@klass</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@klass</span>.<span class="ruby-identifier">nil?</span>
|
184
|
-
|
185
|
-
<span class="ruby-comment cmt"># need the class name to build class</span>
|
186
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@klass_name</span>.<span class="ruby-identifier">nil?</span>
|
187
|
-
|
188
|
-
<span class="ruby-comment cmt"># return if we can find constant corresponding to class name</span>
|
189
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@klass_name</span>
|
190
|
-
<span class="ruby-ivar">@klass</span> = <span class="ruby-ivar">@klass_name</span>.<span class="ruby-identifier">constantize</span>
|
191
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@klass</span>
|
192
|
-
<span class="ruby-keyword kw">end</span>
|
193
|
-
|
194
|
-
<span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-ivar">@klass_name</span>, <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>))
|
195
|
-
<span class="ruby-ivar">@klass</span> = <span class="ruby-ivar">@klass_name</span>.<span class="ruby-identifier">constantize</span>
|
196
|
-
|
197
|
-
<span class="ruby-identifier">add_methods</span>(<span class="ruby-ivar">@klass</span>)
|
198
|
-
<span class="ruby-identifier">add_nav_props</span>(<span class="ruby-ivar">@klass</span>)
|
199
|
-
|
200
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@klass</span>
|
201
|
-
<span class="ruby-keyword kw">end</span>
|
202
|
-
</pre>
|
203
|
-
</div>
|
204
|
-
</div>
|
205
|
-
</div>
|
206
|
-
|
207
|
-
|
208
|
-
</div>
|
209
|
-
|
210
|
-
|
211
|
-
</div>
|
212
|
-
|
213
|
-
|
214
|
-
<div id="validator-badges">
|
215
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
</body>
|
219
|
-
</html>
|
@@ -1,194 +0,0 @@
|
|
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::Operation</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::Operation</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/odata_ruby/operation_rb.html">
|
59
|
-
lib/odata_ruby/operation.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
|
-
Internally used helper class for storing operations called against the
|
84
|
-
service. This class shouldn‘t be used directly.
|
85
|
-
</p>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
<div id="method-list">
|
93
|
-
<h3 class="section-bar">Methods</h3>
|
94
|
-
|
95
|
-
<div class="name-list">
|
96
|
-
<a href="#M000001">new</a>
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
|
103
|
-
<!-- if includes -->
|
104
|
-
|
105
|
-
<div id="section">
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
<div id="attribute-list">
|
112
|
-
<h3 class="section-bar">Attributes</h3>
|
113
|
-
|
114
|
-
<div class="name-list">
|
115
|
-
<table>
|
116
|
-
<tr class="top-aligned-row context-row">
|
117
|
-
<td class="context-item-name">kind</td>
|
118
|
-
<td class="context-item-value"> [RW] </td>
|
119
|
-
<td class="context-item-desc"></td>
|
120
|
-
</tr>
|
121
|
-
<tr class="top-aligned-row context-row">
|
122
|
-
<td class="context-item-name">klass</td>
|
123
|
-
<td class="context-item-value"> [RW] </td>
|
124
|
-
<td class="context-item-desc"></td>
|
125
|
-
</tr>
|
126
|
-
<tr class="top-aligned-row context-row">
|
127
|
-
<td class="context-item-name">klass_name</td>
|
128
|
-
<td class="context-item-value"> [RW] </td>
|
129
|
-
<td class="context-item-desc"></td>
|
130
|
-
</tr>
|
131
|
-
</table>
|
132
|
-
</div>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<!-- if method_list -->
|
138
|
-
<div id="methods">
|
139
|
-
<h3 class="section-bar">Public Class methods</h3>
|
140
|
-
|
141
|
-
<div id="method-M000001" class="method-detail">
|
142
|
-
<a name="M000001"></a>
|
143
|
-
|
144
|
-
<div class="method-heading">
|
145
|
-
<a href="#M000001" class="method-signature">
|
146
|
-
<span class="method-name">new</span><span class="method-args">(kind, klass_name, klass)</span>
|
147
|
-
</a>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
<div class="method-description">
|
151
|
-
<p>
|
152
|
-
Creates a <a href="Operation.html#M000001">new</a> instance of the <a
|
153
|
-
href="Operation.html">Operation</a> class
|
154
|
-
</p>
|
155
|
-
<h4>Required Attributes</h4>
|
156
|
-
<ul>
|
157
|
-
<li>kind: The operation type (Add, Update, or Delete)
|
158
|
-
|
159
|
-
</li>
|
160
|
-
<li>klass_name: The name/type of the class to operate against
|
161
|
-
|
162
|
-
</li>
|
163
|
-
<li>klass: The actual class
|
164
|
-
|
165
|
-
</li>
|
166
|
-
</ul>
|
167
|
-
<p><a class="source-toggle" href="#"
|
168
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
169
|
-
<div class="method-source-code" id="M000001-source">
|
170
|
-
<pre>
|
171
|
-
<span class="ruby-comment cmt"># File lib/odata_ruby/operation.rb, line 12</span>
|
172
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">kind</span>, <span class="ruby-identifier">klass_name</span>, <span class="ruby-identifier">klass</span>)
|
173
|
-
<span class="ruby-ivar">@kind</span> = <span class="ruby-identifier">kind</span>
|
174
|
-
<span class="ruby-ivar">@klass_name</span> = <span class="ruby-identifier">klass_name</span>
|
175
|
-
<span class="ruby-ivar">@klass</span> = <span class="ruby-identifier">klass</span>
|
176
|
-
<span class="ruby-keyword kw">end</span>
|
177
|
-
</pre>
|
178
|
-
</div>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
|
183
|
-
</div>
|
184
|
-
|
185
|
-
|
186
|
-
</div>
|
187
|
-
|
188
|
-
|
189
|
-
<div id="validator-badges">
|
190
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
</body>
|
194
|
-
</html>
|
@@ -1,305 +0,0 @@
|
|
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>
|