ruby_odata 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2010, Visoft, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of Visoft, Inc. nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL VISOFT, INC. BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
= odata_ruby
|
2
|
+
|
3
|
+
The <b>Open Data Protocol</b> (OData) is a fantastic way to query and update data over standard Web technologies. The odata_ruby library acts as a consumer of OData services.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
The API is a work in progress. Notably, changes can't be bundled (through save_changes, only the last operation before save_changes is persisted).
|
7
|
+
|
8
|
+
=== Adding
|
9
|
+
When you point at a service, an AddTo<EntityName> method is created for you. This method takes in the new entity to create. To commit the change, you need to call the save_changes method on the service. To add a new category for example, you would simply do the following:
|
10
|
+
|
11
|
+
require 'lib/odata_ruby'
|
12
|
+
|
13
|
+
svc = OData::Service.new "http://127.0.0.1:8888/SampleService/Entities.svc"
|
14
|
+
new_category = Category.new
|
15
|
+
new_category.Name = "Sample Category"
|
16
|
+
svc.AddToCategories(new_category)
|
17
|
+
category = svc.save_changes
|
18
|
+
puts category.to_json
|
19
|
+
|
20
|
+
=== Updating
|
21
|
+
To update an object, simply pass the modified object to the update_object method on the service. Updating, like adding requires you to call save_changes in order to persist the change. For example:
|
22
|
+
|
23
|
+
require 'lib/odata_ruby'
|
24
|
+
|
25
|
+
svc = OData::Service.new "http://127.0.0.1:8888/SampleService/Entities.svc"
|
26
|
+
new_category = Category.new
|
27
|
+
new_category.Name = "Sample Category"
|
28
|
+
svc.AddToCategories(new_category)
|
29
|
+
category = svc.save_changes
|
30
|
+
puts category.to_json
|
31
|
+
|
32
|
+
category.Name = 'Updated Category'
|
33
|
+
svc.update_object(category)
|
34
|
+
result = svc.save_changes
|
35
|
+
puts "Was the category updated? #{result}"
|
36
|
+
|
37
|
+
=== Deleting
|
38
|
+
Deleting an object involves passing the tracked object to the delete_object method on the service. Deleting is another function that involves the save_changes method (to commit the change back to the server). In this example, we'll add a category and then delete it.
|
39
|
+
|
40
|
+
require 'lib/odata_ruby'
|
41
|
+
|
42
|
+
svc = OData::Service.new "http://127.0.0.1:8888/SampleService/Entities.svc"
|
43
|
+
new_category = Category.new
|
44
|
+
new_category.Name = "Sample Category"
|
45
|
+
svc.AddToCategories(new_category)
|
46
|
+
category = svc.save_changes
|
47
|
+
puts category.to_json
|
48
|
+
|
49
|
+
svc.delete_object(category)
|
50
|
+
result = svc.save_changes
|
51
|
+
puts "Was the category deleted? #{result}"
|
52
|
+
|
53
|
+
=== Querying
|
54
|
+
Querying is easy, for example to pull all the categories from the SampleService, you simply can run:
|
55
|
+
|
56
|
+
require 'lib/odata_ruby'
|
57
|
+
|
58
|
+
svc = OData::Service.new "http://127.0.0.1:8888/SampleService/Entities.svc"
|
59
|
+
svc.Categories
|
60
|
+
categories = svc.execute
|
61
|
+
puts categories.to_json
|
62
|
+
|
63
|
+
You can also expand and add filters to the query before executing it. For example:
|
64
|
+
|
65
|
+
=== Expanding
|
66
|
+
|
67
|
+
# Without expanding the query
|
68
|
+
svc.Products(1)
|
69
|
+
prod1 = svc.execute
|
70
|
+
puts "Without expanding the query"
|
71
|
+
puts "#{prod1.to_json}\n"
|
72
|
+
|
73
|
+
# With expanding the query
|
74
|
+
svc.Products(1).expand('Category')
|
75
|
+
prod1 = svc.execute
|
76
|
+
puts "Without expanding the query"
|
77
|
+
puts "#{prod1.to_json}\n"
|
78
|
+
|
79
|
+
|
80
|
+
=== Filtering
|
81
|
+
|
82
|
+
# You can access by ID (but that isn't is a filter)
|
83
|
+
# The syntax is just svc.ENTITYNAME(ID) which is shown in the expanding examples above
|
84
|
+
|
85
|
+
svc.Products.filter("Name eq 'Product 2'")
|
86
|
+
prod = svc.execute
|
87
|
+
puts "Filtering on Name eq 'Product 2'"
|
88
|
+
puts "#{prod.to_json}"
|
89
|
+
|
90
|
+
=== Combining Expanding and Filtering
|
91
|
+
|
92
|
+
svc.Products.filter("Name eq 'Product 2'").expand("Category")
|
93
|
+
prod = svc.execute
|
94
|
+
puts "Filtering on Name eq 'Product 2' and expanding"
|
95
|
+
puts "#{prod.to_json}"
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
== Tests
|
100
|
+
*DATABASE SETUP - DO THIS FIRST*
|
101
|
+
Within /test/SampleService/App_Data/ rename _TestDB*.* to TestDB*.*. This file is just the inital database, and needs to be renamed so that unwanted changes to that DB aren't persisted in source control.
|
102
|
+
|
103
|
+
All of the tests are written using Cucumber going against a sample service (Found in /test/SampleService/*). The SampleService is an ASP.NET Web Site running a SQLEXPRESS 2008 R2 Database (TestDB), as well as the ADO.NET Entity Framework and a WCF Data Service. In order to run the tests, you need to spin up the SampleService and have it running on port 8888 (http://localhost:8888/SampleService).
|
104
|
+
|
105
|
+
One way to do this is to open the SampleService within Visual Studio 2010 and run it from there. Another option is to use Cassini (the built ASP.NET Development server that comes with Visual Studio 2010). There is a batch file found in /test called "Cassini x64.bat", you can run the batch file and just close the command window. There is a also a "Cassini x86.bat" file for those of you running a 32-bit machine, however it hasn't been tested. The only difference is the path to the Program Files directory. Once you run the batch file, the web server will spin up and you can find the instance in your systray just like if Visual Studio ran it for you. To stop the server, right click on the icon in your systray and tell it to stop
|
106
|
+
|
107
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rake/rdoctask'
|
2
|
+
Rake::RDocTask.new do |rd|
|
3
|
+
rd.main = "README.rdoc"
|
4
|
+
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
5
|
+
rd.rdoc_dir = 'doc'
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'jeweler'
|
10
|
+
Jeweler::Tasks.new do |gemspec|
|
11
|
+
gemspec.name = "ruby_odata"
|
12
|
+
gemspec.summary = "Ruby consumer of OData services."
|
13
|
+
gemspec.description = "An OData Client Library for Ruby. Use this to interact with OData services"
|
14
|
+
gemspec.email = "damien.white@visoftinc.com"
|
15
|
+
gemspec.homepage = "http://github.com/visoft/ruby_odata"
|
16
|
+
gemspec.authors = ["Damien White"]
|
17
|
+
gemspec.add_dependency('activesupport', '>= 2.3.5')
|
18
|
+
gemspec.add_dependency('rest-client', '>= 1.5.1')
|
19
|
+
gemspec.add_dependency('nokogiri', '>= 1.4.2')
|
20
|
+
gemspec.rubyforge_project = 'ruby-odata'
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
24
|
+
rubyforge.doc_task = "rdoc"
|
25
|
+
end
|
26
|
+
rescue LoadError
|
27
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
28
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %>
|
7
|
+
wip: --tags @wip:3 --wip features
|
@@ -0,0 +1,219 @@
|
|
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>
|
@@ -0,0 +1,194 @@
|
|
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>
|