ruby_odata 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +9 -0
  2. data/LICENSE +24 -0
  3. data/README.rdoc +107 -0
  4. data/Rakefile +28 -0
  5. data/VERSION +1 -0
  6. data/config/cucumber.yml +7 -0
  7. data/doc/classes/OData/ClassBuilder.html +219 -0
  8. data/doc/classes/OData/Operation.html +194 -0
  9. data/doc/classes/OData/QueryBuilder.html +305 -0
  10. data/doc/classes/OData/Service.html +420 -0
  11. data/doc/classes/OData.html +126 -0
  12. data/doc/created.rid +1 -0
  13. data/doc/files/README_rdoc.html +252 -0
  14. data/doc/files/lib/odata_ruby/class_builder_rb.html +101 -0
  15. data/doc/files/lib/odata_ruby/operation_rb.html +101 -0
  16. data/doc/files/lib/odata_ruby/query_builder_rb.html +101 -0
  17. data/doc/files/lib/odata_ruby/service_rb.html +101 -0
  18. data/doc/files/lib/odata_ruby_rb.html +114 -0
  19. data/doc/fr_class_index.html +31 -0
  20. data/doc/fr_file_index.html +32 -0
  21. data/doc/fr_method_index.html +40 -0
  22. data/doc/index.html +24 -0
  23. data/doc/rdoc-style.css +208 -0
  24. data/features/service.feature +82 -0
  25. data/features/service_manage.feature +44 -0
  26. data/features/step_definitions/service_steps.rb +132 -0
  27. data/features/support/env.rb +4 -0
  28. data/features/support/hooks.rb +4 -0
  29. data/lib/odata_ruby/class_builder.rb +84 -0
  30. data/lib/odata_ruby/operation.rb +18 -0
  31. data/lib/odata_ruby/query_builder.rb +63 -0
  32. data/lib/odata_ruby/service.rb +207 -0
  33. data/lib/odata_ruby.rb +15 -0
  34. data/ruby_odata.gemspec +94 -0
  35. data/test/Cassini x64.bat +1 -0
  36. data/test/Cassini x86.bat +1 -0
  37. data/test/SampleService/App_Code/Entities.cs +39 -0
  38. data/test/SampleService/App_Code/Model.Designer.cs +414 -0
  39. data/test/SampleService/App_Code/Model.edmx +140 -0
  40. data/test/SampleService/App_Data/_TestDB.mdf +0 -0
  41. data/test/SampleService/App_Data/_TestDB_Log.ldf +0 -0
  42. data/test/SampleService/Entities.svc +1 -0
  43. data/test/SampleService/web.config +27 -0
  44. data/test/blueprints.rb +16 -0
  45. metadata +158 -0
@@ -0,0 +1,420 @@
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::Service</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::Service</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/odata_ruby/service_rb.html">
59
+ lib/odata_ruby/service.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
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000010">delete_object</a>&nbsp;&nbsp;
90
+ <a href="#M000013">execute</a>&nbsp;&nbsp;
91
+ <a href="#M000009">method_missing</a>&nbsp;&nbsp;
92
+ <a href="#M000008">new</a>&nbsp;&nbsp;
93
+ <a href="#M000014">respond_to?</a>&nbsp;&nbsp;
94
+ <a href="#M000012">save_changes</a>&nbsp;&nbsp;
95
+ <a href="#M000011">update_object</a>&nbsp;&nbsp;
96
+ </div>
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+
107
+
108
+
109
+
110
+ <div id="attribute-list">
111
+ <h3 class="section-bar">Attributes</h3>
112
+
113
+ <div class="name-list">
114
+ <table>
115
+ <tr class="top-aligned-row context-row">
116
+ <td class="context-item-name">classes</td>
117
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
118
+ <td class="context-item-desc"></td>
119
+ </tr>
120
+ </table>
121
+ </div>
122
+ </div>
123
+
124
+
125
+
126
+ <!-- if method_list -->
127
+ <div id="methods">
128
+ <h3 class="section-bar">Public Class methods</h3>
129
+
130
+ <div id="method-M000008" class="method-detail">
131
+ <a name="M000008"></a>
132
+
133
+ <div class="method-heading">
134
+ <a href="#M000008" class="method-signature">
135
+ <span class="method-name">new</span><span class="method-args">(service_uri)</span>
136
+ </a>
137
+ </div>
138
+
139
+ <div class="method-description">
140
+ <p>
141
+ Creates a <a href="Service.html#M000008">new</a> instance of the <a
142
+ href="Service.html">Service</a> class
143
+ </p>
144
+ <h4>Required Attributes</h4>
145
+ <ul>
146
+ <li>service_uri: The root URI of the <a href="../OData.html">OData</a> service
147
+
148
+ </li>
149
+ </ul>
150
+ <p><a class="source-toggle" href="#"
151
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
152
+ <div class="method-source-code" id="M000008-source">
153
+ <pre>
154
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 9</span>
155
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">service_uri</span>)
156
+ <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">service_uri</span>
157
+ <span class="ruby-ivar">@collections</span> = <span class="ruby-identifier">get_collections</span>
158
+ <span class="ruby-identifier">build_classes</span>
159
+ <span class="ruby-keyword kw">end</span>
160
+ </pre>
161
+ </div>
162
+ </div>
163
+ </div>
164
+
165
+ <h3 class="section-bar">Public Instance methods</h3>
166
+
167
+ <div id="method-M000010" class="method-detail">
168
+ <a name="M000010"></a>
169
+
170
+ <div class="method-heading">
171
+ <a href="#M000010" class="method-signature">
172
+ <span class="method-name">delete_object</span><span class="method-args">(obj)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ <p>
178
+ Queues an object for deletion. To actually remove it from the server, you
179
+ must call <a href="Service.html#M000012">save_changes</a> as well.
180
+ </p>
181
+ <h4>Required Attributes</h4>
182
+ <ul>
183
+ <li>obj: The object to mark for deletion
184
+
185
+ </li>
186
+ </ul>
187
+ <p>
188
+ Note: This method will throw an exception if the <tt>obj</tt> isn&#8216;t a
189
+ tracked entity
190
+ </p>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000010-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 43</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_object</span>(<span class="ruby-identifier">obj</span>)
197
+ <span class="ruby-identifier">type</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>
198
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:__metadata</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:__metadata</span>).<span class="ruby-identifier">nil?</span>
199
+ <span class="ruby-ivar">@save_operation</span> = <span class="ruby-constant">Operation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;Delete&quot;</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">obj</span>)
200
+ <span class="ruby-keyword kw">else</span>
201
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;You cannot delete a non-tracked entity&quot;</span>
202
+ <span class="ruby-keyword kw">end</span>
203
+ <span class="ruby-keyword kw">end</span>
204
+ </pre>
205
+ </div>
206
+ </div>
207
+ </div>
208
+
209
+ <div id="method-M000013" class="method-detail">
210
+ <a name="M000013"></a>
211
+
212
+ <div class="method-heading">
213
+ <a href="#M000013" class="method-signature">
214
+ <span class="method-name">execute</span><span class="method-args">()</span>
215
+ </a>
216
+ </div>
217
+
218
+ <div class="method-description">
219
+ <p>
220
+ Performs query operations (Read) against the server
221
+ </p>
222
+ <p><a class="source-toggle" href="#"
223
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
224
+ <div class="method-source-code" id="M000013-source">
225
+ <pre>
226
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 94</span>
227
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute</span>
228
+ <span class="ruby-identifier">result</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span> <span class="ruby-identifier">build_query_uri</span>
229
+ <span class="ruby-identifier">build_classes_from_result</span>(<span class="ruby-identifier">result</span>)
230
+ <span class="ruby-keyword kw">end</span>
231
+ </pre>
232
+ </div>
233
+ </div>
234
+ </div>
235
+
236
+ <div id="method-M000009" class="method-detail">
237
+ <a name="M000009"></a>
238
+
239
+ <div class="method-heading">
240
+ <a href="#M000009" class="method-signature">
241
+ <span class="method-name">method_missing</span><span class="method-args">(name, *args)</span>
242
+ </a>
243
+ </div>
244
+
245
+ <div class="method-description">
246
+ <p>
247
+ Handles the dynamic AddTo&lt;EntityName&gt; methods as well as the
248
+ collections on the service
249
+ </p>
250
+ <p><a class="source-toggle" href="#"
251
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
252
+ <div class="method-source-code" id="M000009-source">
253
+ <pre>
254
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 16</span>
255
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
256
+ <span class="ruby-comment cmt"># Queries</span>
257
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@collections</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
258
+ <span class="ruby-identifier">root</span> = <span class="ruby-node">&quot;/#{name.to_s.camelize}&quot;</span>
259
+ <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;(#{args.join(',')})&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
260
+ <span class="ruby-ivar">@query</span> = <span class="ruby-constant">QueryBuilder</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">root</span>)
261
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@query</span>
262
+ <span class="ruby-comment cmt"># Adds </span>
263
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^AddTo(.*)/</span>
264
+ <span class="ruby-identifier">type</span> = <span class="ruby-identifier">$1</span>
265
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@collections</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
266
+ <span class="ruby-ivar">@save_operation</span> = <span class="ruby-constant">Operation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;Add&quot;</span>, <span class="ruby-identifier">$1</span>, <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
267
+ <span class="ruby-keyword kw">else</span>
268
+ <span class="ruby-keyword kw">super</span>
269
+ <span class="ruby-keyword kw">end</span>
270
+ <span class="ruby-keyword kw">else</span>
271
+ <span class="ruby-keyword kw">super</span>
272
+ <span class="ruby-keyword kw">end</span>
273
+
274
+ <span class="ruby-keyword kw">end</span>
275
+ </pre>
276
+ </div>
277
+ </div>
278
+ </div>
279
+
280
+ <div id="method-M000014" class="method-detail">
281
+ <a name="M000014"></a>
282
+
283
+ <div class="method-heading">
284
+ <a href="#M000014" class="method-signature">
285
+ <span class="method-name">respond_to?</span><span class="method-args">(method)</span>
286
+ </a>
287
+ </div>
288
+
289
+ <div class="method-description">
290
+ <p>
291
+ Overridden to identify methods handled by <a
292
+ href="Service.html#M000009">method_missing</a>
293
+ </p>
294
+ <p><a class="source-toggle" href="#"
295
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
296
+ <div class="method-source-code" id="M000014-source">
297
+ <pre>
298
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 100</span>
299
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>)
300
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@collections</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>)
301
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
302
+ <span class="ruby-comment cmt"># Adds </span>
303
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^AddTo(.*)/</span>
304
+ <span class="ruby-identifier">type</span> = <span class="ruby-identifier">$1</span>
305
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@collections</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
306
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
307
+ <span class="ruby-keyword kw">else</span>
308
+ <span class="ruby-keyword kw">super</span>
309
+ <span class="ruby-keyword kw">end</span>
310
+ <span class="ruby-keyword kw">else</span>
311
+ <span class="ruby-keyword kw">super</span>
312
+ <span class="ruby-keyword kw">end</span>
313
+ <span class="ruby-keyword kw">end</span>
314
+ </pre>
315
+ </div>
316
+ </div>
317
+ </div>
318
+
319
+ <div id="method-M000012" class="method-detail">
320
+ <a name="M000012"></a>
321
+
322
+ <div class="method-heading">
323
+ <a href="#M000012" class="method-signature">
324
+ <span class="method-name">save_changes</span><span class="method-args">()</span>
325
+ </a>
326
+ </div>
327
+
328
+ <div class="method-description">
329
+ <p>
330
+ Performs save operations (Create/Update/Delete) against the server
331
+ </p>
332
+ <p><a class="source-toggle" href="#"
333
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
334
+ <div class="method-source-code" id="M000012-source">
335
+ <pre>
336
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 68</span>
337
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save_changes</span>
338
+ <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">@save_operation</span>.<span class="ruby-identifier">nil?</span>
339
+
340
+ <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">nil</span>
341
+
342
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Add&quot;</span>
343
+ <span class="ruby-identifier">save_uri</span> = <span class="ruby-node">&quot;#{@uri}/#{@save_operation.klass_name}&quot;</span>
344
+ <span class="ruby-identifier">json_klass</span> = <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_json</span>
345
+ <span class="ruby-identifier">post_result</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span> <span class="ruby-identifier">save_uri</span>, <span class="ruby-identifier">json_klass</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:json</span>
346
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">build_classes_from_result</span>(<span class="ruby-identifier">post_result</span>)
347
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Update&quot;</span>
348
+ <span class="ruby-identifier">update_uri</span> = <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:__metadata</span>)[<span class="ruby-identifier">:uri</span>]
349
+ <span class="ruby-identifier">json_klass</span> = <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_json</span>
350
+ <span class="ruby-identifier">update_result</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">put</span> <span class="ruby-identifier">update_uri</span>, <span class="ruby-identifier">json_klass</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:json</span>
351
+ <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">update_result</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">204</span>)
352
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Delete&quot;</span>
353
+ <span class="ruby-identifier">delete_uri</span> = <span class="ruby-ivar">@save_operation</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:__metadata</span>)[<span class="ruby-identifier">:uri</span>]
354
+ <span class="ruby-identifier">delete_result</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">delete_uri</span>
355
+ <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">delete_result</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">204</span>)
356
+ <span class="ruby-keyword kw">end</span>
357
+
358
+ <span class="ruby-ivar">@save_operation</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># Clear out the last operation</span>
359
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
360
+ <span class="ruby-keyword kw">end</span>
361
+ </pre>
362
+ </div>
363
+ </div>
364
+ </div>
365
+
366
+ <div id="method-M000011" class="method-detail">
367
+ <a name="M000011"></a>
368
+
369
+ <div class="method-heading">
370
+ <a href="#M000011" class="method-signature">
371
+ <span class="method-name">update_object</span><span class="method-args">(obj)</span>
372
+ </a>
373
+ </div>
374
+
375
+ <div class="method-description">
376
+ <p>
377
+ Queues an object for update. To actually update it on the server, you must
378
+ call <a href="Service.html#M000012">save_changes</a> as well.
379
+ </p>
380
+ <h4>Required Attributes</h4>
381
+ <ul>
382
+ <li>obj: The object to queue for update
383
+
384
+ </li>
385
+ </ul>
386
+ <p>
387
+ Note: This method will throw an exception if the <tt>obj</tt> isn&#8216;t a
388
+ tracked entity
389
+ </p>
390
+ <p><a class="source-toggle" href="#"
391
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
392
+ <div class="method-source-code" id="M000011-source">
393
+ <pre>
394
+ <span class="ruby-comment cmt"># File lib/odata_ruby/service.rb, line 58</span>
395
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_object</span>(<span class="ruby-identifier">obj</span>)
396
+ <span class="ruby-identifier">type</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>
397
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:__metadata</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:__metadata</span>).<span class="ruby-identifier">nil?</span>
398
+ <span class="ruby-ivar">@save_operation</span> = <span class="ruby-constant">Operation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;Update&quot;</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">obj</span>)
399
+ <span class="ruby-keyword kw">else</span>
400
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;You cannot update a non-tracked entity&quot;</span>
401
+ <span class="ruby-keyword kw">end</span>
402
+ <span class="ruby-keyword kw">end</span>
403
+ </pre>
404
+ </div>
405
+ </div>
406
+ </div>
407
+
408
+
409
+ </div>
410
+
411
+
412
+ </div>
413
+
414
+
415
+ <div id="validator-badges">
416
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
417
+ </div>
418
+
419
+ </body>
420
+ </html>
@@ -0,0 +1,126 @@
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>Module: OData</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>Module</strong></td>
53
+ <td class="class-name-in-header">OData</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
+ <a href="../files/lib/odata_ruby/operation_rb.html">
63
+ lib/odata_ruby/operation.rb
64
+ </a>
65
+ <br />
66
+ <a href="../files/lib/odata_ruby/query_builder_rb.html">
67
+ lib/odata_ruby/query_builder.rb
68
+ </a>
69
+ <br />
70
+ <a href="../files/lib/odata_ruby/service_rb.html">
71
+ lib/odata_ruby/service.rb
72
+ </a>
73
+ <br />
74
+ </td>
75
+ </tr>
76
+
77
+ </table>
78
+ </div>
79
+ <!-- banner header -->
80
+
81
+ <div id="bodyContent">
82
+
83
+
84
+
85
+ <div id="contextContent">
86
+
87
+
88
+
89
+ </div>
90
+
91
+
92
+ </div>
93
+
94
+
95
+ <!-- if includes -->
96
+
97
+ <div id="section">
98
+
99
+ <div id="class-list">
100
+ <h3 class="section-bar">Classes and Modules</h3>
101
+
102
+ Class <a href="OData/ClassBuilder.html" class="link">OData::ClassBuilder</a><br />
103
+ Class <a href="OData/Operation.html" class="link">OData::Operation</a><br />
104
+ Class <a href="OData/QueryBuilder.html" class="link">OData::QueryBuilder</a><br />
105
+ Class <a href="OData/Service.html" class="link">OData::Service</a><br />
106
+
107
+ </div>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- if method_list -->
116
+
117
+
118
+ </div>
119
+
120
+
121
+ <div id="validator-badges">
122
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
123
+ </div>
124
+
125
+ </body>
126
+ </html>
data/doc/created.rid ADDED
@@ -0,0 +1 @@
1
+ Fri, 11 Jun 2010 18:01:50 -0400