openstack-swift 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/doc/classes/Openstack.html +119 -0
- data/doc/classes/Openstack/Swift.html +137 -0
- data/doc/classes/Openstack/Swift/UnauthorizedError.html +111 -0
- data/doc/classes/Openstack/Swift/WebApi.html +185 -0
- data/doc/classes/Openstack/Swift/WebApi.src/M000001.html +21 -0
- data/doc/classes/Openstack/Swift/WebApi.src/M000002.html +24 -0
- data/doc/classes/Openstack/Swift/WebApi.src/M000003.html +20 -0
- data/doc/classes/Openstack/Swift/WebApi.src/M000004.html +20 -0
- data/doc/created.rid +1 -11
- data/doc/files/lib/openstack-swift/errors_rb.html +101 -0
- data/doc/files/lib/openstack-swift/version_rb.html +101 -0
- data/doc/files/lib/openstack-swift/web_api_rb.html +101 -0
- data/doc/files/lib/openstack-swift_rb.html +112 -0
- data/doc/files/spec/openstack-swift/web_api_spec_rb.html +131 -0
- data/doc/files/spec/spec_helper_rb.html +110 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +30 -0
- data/doc/index.html +20 -84
- data/doc/rdoc-style.css +208 -0
- data/lib/openstack-swift/client.rb +2 -2
- data/lib/openstack-swift/version.rb +1 -1
- data/openstack-swift-0.0.1.gem +0 -0
- metadata +81 -96
- data/doc/Gemfile.html +0 -100
- data/doc/Object.html +0 -177
- data/doc/Openstack.html +0 -162
- data/doc/Openstack/Swift.html +0 -182
- data/doc/Openstack/Swift/AuthenticationError.html +0 -151
- data/doc/Openstack/Swift/Client.html +0 -316
- data/doc/Openstack/Swift/UnauthorizedError.html +0 -147
- data/doc/Openstack/Swift/WebApi.html +0 -417
- data/doc/Rakefile.html +0 -98
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/lib/openstack-swift/client_rb.html +0 -52
- data/doc/lib/openstack-swift/errors_rb.html +0 -52
- data/doc/lib/openstack-swift/version_rb.html +0 -52
- data/doc/lib/openstack-swift/web_api_rb.html +0 -52
- data/doc/lib/openstack-swift_rb.html +0 -66
- data/doc/rdoc.css +0 -763
- data/doc/spec/openstack-swift/client_spec_rb.html +0 -54
- data/doc/spec/openstack-swift/web_api_spec_rb.html +0 -54
- data/doc/spec/spec_helper_rb.html +0 -58
@@ -1,417 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
-
|
8
|
-
<title>Module: Openstack::Swift::WebApi</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" href="../../rdoc.css" type="text/css" media="screen" />
|
11
|
-
|
12
|
-
<script src="../../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
<script src="../../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="../../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script src="../../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
-
|
17
|
-
</head>
|
18
|
-
<body id="top" class="module">
|
19
|
-
|
20
|
-
<div id="metadata">
|
21
|
-
<div id="home-metadata">
|
22
|
-
<div id="home-section" class="section">
|
23
|
-
<h3 class="section-header">
|
24
|
-
<a href="../../index.html">Home</a>
|
25
|
-
<a href="../../index.html#classes">Classes</a>
|
26
|
-
<a href="../../index.html#methods">Methods</a>
|
27
|
-
</h3>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<div id="file-metadata">
|
32
|
-
<div id="file-list-section" class="section">
|
33
|
-
<h3 class="section-header">In Files</h3>
|
34
|
-
<div class="section-body">
|
35
|
-
<ul>
|
36
|
-
|
37
|
-
<li><a href="../../lib/openstack-swift/web_api_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="lib/openstack-swift/web_api.rb">lib/openstack-swift/web_api.rb</a></li>
|
39
|
-
|
40
|
-
</ul>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
|
45
|
-
</div>
|
46
|
-
|
47
|
-
<div id="class-metadata">
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<!-- Method Quickref -->
|
56
|
-
<div id="method-list-section" class="section">
|
57
|
-
<h3 class="section-header">Methods</h3>
|
58
|
-
<ul class="link-list">
|
59
|
-
|
60
|
-
<li><a href="#method-i-account">#account</a></li>
|
61
|
-
|
62
|
-
<li><a href="#method-i-auth">#auth</a></li>
|
63
|
-
|
64
|
-
<li><a href="#method-i-containers">#containers</a></li>
|
65
|
-
|
66
|
-
<li><a href="#method-i-download_object">#download_object</a></li>
|
67
|
-
|
68
|
-
<li><a href="#method-i-objects">#objects</a></li>
|
69
|
-
|
70
|
-
<li><a href="#method-i-upload_object">#upload_object</a></li>
|
71
|
-
|
72
|
-
</ul>
|
73
|
-
</div>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="project-metadata">
|
80
|
-
|
81
|
-
|
82
|
-
<div id="fileindex-section" class="section project-section">
|
83
|
-
<h3 class="section-header">Files</h3>
|
84
|
-
<ul>
|
85
|
-
|
86
|
-
<li class="file"><a href="../../Gemfile.html">Gemfile</a></li>
|
87
|
-
|
88
|
-
<li class="file"><a href="../../Rakefile.html">Rakefile</a></li>
|
89
|
-
|
90
|
-
</ul>
|
91
|
-
</div>
|
92
|
-
|
93
|
-
|
94
|
-
<div id="classindex-section" class="section project-section">
|
95
|
-
<h3 class="section-header">Class/Module Index
|
96
|
-
<span class="search-toggle"><img src="../../images/find.png"
|
97
|
-
height="16" width="16" alt="[+]"
|
98
|
-
title="show/hide quicksearch" /></span></h3>
|
99
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
100
|
-
<fieldset>
|
101
|
-
<legend>Quicksearch</legend>
|
102
|
-
<input type="text" name="quicksearch" value=""
|
103
|
-
class="quicksearch-field" />
|
104
|
-
</fieldset>
|
105
|
-
</form>
|
106
|
-
|
107
|
-
<ul class="link-list">
|
108
|
-
|
109
|
-
<li><a href="../../Openstack.html">Openstack</a></li>
|
110
|
-
|
111
|
-
<li><a href="../../Openstack/Swift.html">Openstack::Swift</a></li>
|
112
|
-
|
113
|
-
<li><a href="../../Openstack/Swift/AuthenticationError.html">Openstack::Swift::AuthenticationError</a></li>
|
114
|
-
|
115
|
-
<li><a href="../../Openstack/Swift/Client.html">Openstack::Swift::Client</a></li>
|
116
|
-
|
117
|
-
<li><a href="../../Openstack/Swift/WebApi.html">Openstack::Swift::WebApi</a></li>
|
118
|
-
|
119
|
-
<li><a href="../../Object.html">Object</a></li>
|
120
|
-
|
121
|
-
</ul>
|
122
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
123
|
-
</div>
|
124
|
-
|
125
|
-
|
126
|
-
</div>
|
127
|
-
</div>
|
128
|
-
|
129
|
-
<div id="documentation">
|
130
|
-
<h1 class="module">Openstack::Swift::WebApi</h1>
|
131
|
-
|
132
|
-
<div id="description" class="description">
|
133
|
-
|
134
|
-
</div><!-- description -->
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<!-- Methods -->
|
149
|
-
|
150
|
-
<div id="public-instance-method-details" class="method-section section">
|
151
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
152
|
-
|
153
|
-
|
154
|
-
<div id="account-method" class="method-detail ">
|
155
|
-
<a name="method-i-account"></a>
|
156
|
-
|
157
|
-
|
158
|
-
<div class="method-heading">
|
159
|
-
<span class="method-name">account</span><span
|
160
|
-
class="method-args">(url, token)</span>
|
161
|
-
<span class="method-click-advice">click to toggle source</span>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
|
165
|
-
<div class="method-description">
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
<div class="method-source-code" id="account-source">
|
172
|
-
<pre>
|
173
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 13</span>
|
174
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">account</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">token</span>)
|
175
|
-
<span class="ruby-identifier">query</span> = {<span class="ruby-value">:format</span> =<span class="ruby-operator">></span> <span class="ruby-string">"json"</span>}
|
176
|
-
<span class="ruby-identifier">res</span> = <span class="ruby-constant">HTTParty</span>.<span class="ruby-identifier">head</span>(<span class="ruby-identifier">url</span>, <span class="ruby-value">:headers</span> =<span class="ruby-operator">></span> {<span class="ruby-string">'X-Auth-Token'</span>=<span class="ruby-operator">></span> <span class="ruby-identifier">token</span>}, <span class="ruby-value">:query</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">query</span>)
|
177
|
-
{
|
178
|
-
<span class="ruby-string">"bytes_used"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-account-bytes-used"</span>],
|
179
|
-
<span class="ruby-string">"object_count"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-account-object-count"</span>],
|
180
|
-
<span class="ruby-string">"container_count"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-account-container-count"</span>]
|
181
|
-
}
|
182
|
-
<span class="ruby-keyword">end</span></pre>
|
183
|
-
</div><!-- account-source -->
|
184
|
-
|
185
|
-
</div>
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
</div><!-- account-method -->
|
191
|
-
|
192
|
-
|
193
|
-
<div id="auth-method" class="method-detail ">
|
194
|
-
<a name="method-i-auth"></a>
|
195
|
-
|
196
|
-
|
197
|
-
<div class="method-heading">
|
198
|
-
<span class="method-name">auth</span><span
|
199
|
-
class="method-args">(proxy, user, password)</span>
|
200
|
-
<span class="method-click-advice">click to toggle source</span>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
|
204
|
-
<div class="method-description">
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
<div class="method-source-code" id="auth-source">
|
211
|
-
<pre>
|
212
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 6</span>
|
213
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">auth</span>(<span class="ruby-identifier">proxy</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>)
|
214
|
-
<span class="ruby-identifier">res</span> = <span class="ruby-constant">HTTParty</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">proxy</span>, <span class="ruby-value">:headers</span> =<span class="ruby-operator">></span> {<span class="ruby-string">'X-Auth-User'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>, <span class="ruby-string">'X-Auth-Key'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">password</span>})
|
215
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AuthenticationError</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
|
216
|
-
|
217
|
-
[<span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-storage-url"</span>],<span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-storage-token"</span>],<span class="ruby-identifier">res</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-string">"x-auth-token"</span>]]
|
218
|
-
<span class="ruby-keyword">end</span></pre>
|
219
|
-
</div><!-- auth-source -->
|
220
|
-
|
221
|
-
</div>
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
</div><!-- auth-method -->
|
227
|
-
|
228
|
-
|
229
|
-
<div id="containers-method" class="method-detail ">
|
230
|
-
<a name="method-i-containers"></a>
|
231
|
-
|
232
|
-
|
233
|
-
<div class="method-heading">
|
234
|
-
<span class="method-name">containers</span><span
|
235
|
-
class="method-args">(url, token, query = {})</span>
|
236
|
-
<span class="method-click-advice">click to toggle source</span>
|
237
|
-
</div>
|
238
|
-
|
239
|
-
|
240
|
-
<div class="method-description">
|
241
|
-
|
242
|
-
<p>List containers Note that swift only returns 1000 items, so to list more
|
243
|
-
than this you should use the marker option as the name of the last returned
|
244
|
-
item (1000th item) to return the next sequency (1001 - 2000) query options:
|
245
|
-
marker, prefix, limit</p>
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
<div class="method-source-code" id="containers-source">
|
250
|
-
<pre>
|
251
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 28</span>
|
252
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">containers</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">token</span>, <span class="ruby-identifier">query</span> = {})
|
253
|
-
<span class="ruby-identifier">query</span> = <span class="ruby-identifier">query</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:format</span> =<span class="ruby-operator">></span> <span class="ruby-string">"json"</span>)
|
254
|
-
<span class="ruby-identifier">res</span> = <span class="ruby-constant">HTTParty</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-value">:headers</span> =<span class="ruby-operator">></span> {<span class="ruby-string">'X-Auth-Token'</span>=<span class="ruby-operator">></span> <span class="ruby-identifier">token</span>}, <span class="ruby-value">:query</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">query</span>)
|
255
|
-
<span class="ruby-identifier">res</span>.<span class="ruby-identifier">to_a</span>
|
256
|
-
<span class="ruby-keyword">end</span></pre>
|
257
|
-
</div><!-- containers-source -->
|
258
|
-
|
259
|
-
</div>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
</div><!-- containers-method -->
|
265
|
-
|
266
|
-
|
267
|
-
<div id="download_object-method" class="method-detail ">
|
268
|
-
<a name="method-i-download_object"></a>
|
269
|
-
|
270
|
-
|
271
|
-
<div class="method-heading">
|
272
|
-
<span class="method-name">download_object</span><span
|
273
|
-
class="method-args">(url, token, container, object, file_name=nil)</span>
|
274
|
-
<span class="method-click-advice">click to toggle source</span>
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
<div class="method-description">
|
279
|
-
|
280
|
-
<p>Downloads an object (file) to disk and returns the saved file path</p>
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
<div class="method-source-code" id="download_object-source">
|
285
|
-
<pre>
|
286
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 42</span>
|
287
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">download_object</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">token</span>, <span class="ruby-identifier">container</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">file_name</span>=<span class="ruby-keyword">nil</span>)
|
288
|
-
<span class="ruby-identifier">file_name</span> <span class="ruby-operator">||=</span> <span class="ruby-node">"/tmp/swift/#{container}/#{object}"</span>
|
289
|
-
|
290
|
-
<span class="ruby-comment"># creating directory if it doesn't exist</span>
|
291
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">file_name</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(.+)\/.+?$/</span>)[<span class="ruby-value">1</span>])
|
292
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string">"wb"</span>)
|
293
|
-
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">"#{url}/#{container}/#{object}"</span>)
|
294
|
-
|
295
|
-
<span class="ruby-identifier">req</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
|
296
|
-
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">add_field</span>(<span class="ruby-string">'X-Auth-Token'</span>, <span class="ruby-identifier">token</span>)
|
297
|
-
|
298
|
-
<span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
|
299
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword">true</span>
|
300
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
|
301
|
-
|
302
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">res</span><span class="ruby-operator">|</span>
|
303
|
-
<span class="ruby-identifier">res</span>.<span class="ruby-identifier">read_body</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">chunk</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">chunk</span> }
|
304
|
-
<span class="ruby-keyword">end</span>
|
305
|
-
|
306
|
-
<span class="ruby-identifier">file_name</span>
|
307
|
-
<span class="ruby-keyword">ensure</span>
|
308
|
-
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
|
309
|
-
<span class="ruby-keyword">end</span></pre>
|
310
|
-
</div><!-- download_object-source -->
|
311
|
-
|
312
|
-
</div>
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
</div><!-- download_object-method -->
|
318
|
-
|
319
|
-
|
320
|
-
<div id="objects-method" class="method-detail ">
|
321
|
-
<a name="method-i-objects"></a>
|
322
|
-
|
323
|
-
|
324
|
-
<div class="method-heading">
|
325
|
-
<span class="method-name">objects</span><span
|
326
|
-
class="method-args">(url, token, container, query = {} )</span>
|
327
|
-
<span class="method-click-advice">click to toggle source</span>
|
328
|
-
</div>
|
329
|
-
|
330
|
-
|
331
|
-
<div class="method-description">
|
332
|
-
|
333
|
-
<p>query options: marker, prefix, limit, delimiter</p>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
<div class="method-source-code" id="objects-source">
|
338
|
-
<pre>
|
339
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 35</span>
|
340
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">objects</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">token</span>, <span class="ruby-identifier">container</span>, <span class="ruby-identifier">query</span> = {} )
|
341
|
-
<span class="ruby-identifier">query</span> = <span class="ruby-identifier">query</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:format</span> =<span class="ruby-operator">></span> <span class="ruby-string">"json"</span>)
|
342
|
-
<span class="ruby-identifier">res</span> = <span class="ruby-constant">HTTParty</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"#{url}/#{container}"</span>, <span class="ruby-value">:headers</span> =<span class="ruby-operator">></span> {<span class="ruby-string">'X-Auth-Token'</span>=<span class="ruby-operator">></span> <span class="ruby-identifier">token</span>}, <span class="ruby-value">:query</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">query</span>)
|
343
|
-
<span class="ruby-identifier">res</span>.<span class="ruby-identifier">to_a</span>
|
344
|
-
<span class="ruby-keyword">end</span></pre>
|
345
|
-
</div><!-- objects-source -->
|
346
|
-
|
347
|
-
</div>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
</div><!-- objects-method -->
|
353
|
-
|
354
|
-
|
355
|
-
<div id="upload_object-method" class="method-detail ">
|
356
|
-
<a name="method-i-upload_object"></a>
|
357
|
-
|
358
|
-
|
359
|
-
<div class="method-heading">
|
360
|
-
<span class="method-name">upload_object</span><span
|
361
|
-
class="method-args">(url, token, container, file_path, object_name=nil)</span>
|
362
|
-
<span class="method-click-advice">click to toggle source</span>
|
363
|
-
</div>
|
364
|
-
|
365
|
-
|
366
|
-
<div class="method-description">
|
367
|
-
|
368
|
-
<p>Uploads a given object to a given container</p>
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
<div class="method-source-code" id="upload_object-source">
|
373
|
-
<pre>
|
374
|
-
<span class="ruby-comment"># File lib/openstack-swift/web_api.rb, line 67</span>
|
375
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">upload_object</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">token</span>, <span class="ruby-identifier">container</span>, <span class="ruby-identifier">file_path</span>, <span class="ruby-identifier">object_name</span>=<span class="ruby-keyword">nil</span>)
|
376
|
-
<span class="ruby-identifier">object_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">file_path</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/.+\/(.+?)$/</span>)[<span class="ruby-value">1</span>]
|
377
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_path</span>, <span class="ruby-string">"rb"</span>)
|
378
|
-
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">"#{url}/#{container}/#{object_name}"</span>)
|
379
|
-
|
380
|
-
<span class="ruby-identifier">req</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Put</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
|
381
|
-
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">add_field</span>(<span class="ruby-string">'X-Auth-Token'</span>, <span class="ruby-identifier">token</span>)
|
382
|
-
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">body_stream</span> = <span class="ruby-identifier">file</span>
|
383
|
-
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">content_length</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">file_path</span>)
|
384
|
-
|
385
|
-
<span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
|
386
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword">true</span>
|
387
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
|
388
|
-
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>)
|
389
|
-
<span class="ruby-keyword">ensure</span>
|
390
|
-
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
|
391
|
-
<span class="ruby-keyword">end</span></pre>
|
392
|
-
</div><!-- upload_object-source -->
|
393
|
-
|
394
|
-
</div>
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
</div><!-- upload_object-method -->
|
400
|
-
|
401
|
-
|
402
|
-
</div><!-- public-instance-method-details -->
|
403
|
-
|
404
|
-
</div><!-- 5Buntitled-5D -->
|
405
|
-
|
406
|
-
|
407
|
-
</div><!-- documentation -->
|
408
|
-
|
409
|
-
<div id="validator-badges">
|
410
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
411
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
412
|
-
Rdoc Generator</a> 2</small>.</p>
|
413
|
-
</div>
|
414
|
-
|
415
|
-
</body>
|
416
|
-
</html>
|
417
|
-
|
data/doc/Rakefile.html
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
-
<head>
|
7
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
-
|
9
|
-
<title>File: Rakefile [RDoc Documentation]</title>
|
10
|
-
|
11
|
-
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
-
|
13
|
-
<script src="./js/jquery.js" type="text/javascript"
|
14
|
-
charset="utf-8"></script>
|
15
|
-
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
-
charset="utf-8"></script>
|
17
|
-
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
-
charset="utf-8"></script>
|
19
|
-
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
-
charset="utf-8"></script>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body class="file">
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="./index.html">Home</a>
|
29
|
-
<a href="./index.html#classes">Classes</a>
|
30
|
-
<a href="./index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="project-metadata">
|
36
|
-
|
37
|
-
|
38
|
-
<div id="fileindex-section" class="section project-section">
|
39
|
-
<h3 class="section-header">Files</h3>
|
40
|
-
<ul>
|
41
|
-
|
42
|
-
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
|
43
|
-
|
44
|
-
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
45
|
-
|
46
|
-
</ul>
|
47
|
-
</div>
|
48
|
-
|
49
|
-
|
50
|
-
<div id="classindex-section" class="section project-section">
|
51
|
-
<h3 class="section-header">Class Index
|
52
|
-
<span class="search-toggle"><img src="./images/find.png"
|
53
|
-
height="16" width="16" alt="[+]"
|
54
|
-
title="show/hide quicksearch" /></span></h3>
|
55
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
56
|
-
<fieldset>
|
57
|
-
<legend>Quicksearch</legend>
|
58
|
-
<input type="text" name="quicksearch" value=""
|
59
|
-
class="quicksearch-field" />
|
60
|
-
</fieldset>
|
61
|
-
</form>
|
62
|
-
|
63
|
-
<ul class="link-list">
|
64
|
-
|
65
|
-
<li><a href="./Openstack.html">Openstack</a></li>
|
66
|
-
|
67
|
-
<li><a href="./Openstack/Swift.html">Openstack::Swift</a></li>
|
68
|
-
|
69
|
-
<li><a href="./Openstack/Swift/AuthenticationError.html">Openstack::Swift::AuthenticationError</a></li>
|
70
|
-
|
71
|
-
<li><a href="./Openstack/Swift/Client.html">Openstack::Swift::Client</a></li>
|
72
|
-
|
73
|
-
<li><a href="./Openstack/Swift/WebApi.html">Openstack::Swift::WebApi</a></li>
|
74
|
-
|
75
|
-
<li><a href="./Object.html">Object</a></li>
|
76
|
-
|
77
|
-
</ul>
|
78
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
79
|
-
</div>
|
80
|
-
|
81
|
-
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="documentation">
|
86
|
-
|
87
|
-
<p>require ‘bundler’ Bundler::GemHelper.install_tasks</p>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="validator-badges">
|
92
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
93
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
94
|
-
Rdoc Generator</a> 2</small>.</p>
|
95
|
-
</div>
|
96
|
-
</body>
|
97
|
-
</html>
|
98
|
-
|