myspace-ruby 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +3 -3
- data/doc/classes/MySpace/Connection.html +328 -46
- data/doc/classes/MySpace/Object.html +264 -38
- data/doc/classes/MySpace/User.html +55 -0
- data/doc/classes/MySpace.html +73 -19
- data/doc/classes/MySpaceAPITest.html +172 -220
- data/doc/created.rid +1 -1
- data/doc/files/lib/myspace_rb.html +19 -14
- data/doc/files/tests/test_rb.html +1 -1
- data/doc/fr_class_index.html +3 -0
- data/doc/fr_file_index.html +9 -0
- data/doc/fr_method_index.html +58 -28
- data/lib/myspace/classes/user.rb +1 -0
- data/lib/myspace/connection.rb +2 -2
- data/lib/myspace/loader.rb +1 -1
- data/lib/myspace/object.rb +0 -1
- data/lib/myspace.rb +1 -1
- data/tests/test.rb +3 -7
- metadata +2 -3
- data/lib/myspace/classes/group.rb +0 -55
data/README
CHANGED
|
@@ -13,7 +13,7 @@ To get a developer account, you need to sign up at:
|
|
|
13
13
|
http://developer.myspace.com
|
|
14
14
|
|
|
15
15
|
Once approved, you will need to create an application to get your api key and
|
|
16
|
-
secret key. The api key is a http URL (e.g http://www.myspace.com/2543521521)
|
|
16
|
+
secret key. The api key is a http URL (e.g. http://www.myspace.com/2543521521)
|
|
17
17
|
and the secret key will be a 32 character hex string.
|
|
18
18
|
|
|
19
19
|
You can find the keys in the Application Builder, by clicking on the
|
|
@@ -23,7 +23,7 @@ secretKey is 'Application Domain'.
|
|
|
23
23
|
The keys can be placed into myspace.conf or specified at runtime
|
|
24
24
|
when you new a MySpace::Connection. The myspace.conf file can be in the
|
|
25
25
|
current directory where the script is being run from, or can be specified
|
|
26
|
-
by
|
|
26
|
+
by setting the MYSPACE_CONF environment variable.
|
|
27
27
|
|
|
28
28
|
You only have access to users that have installed your application. Also,
|
|
29
29
|
write access to these user's profiles (to update status or upload a picture)
|
|
@@ -36,7 +36,7 @@ This library has some external dependencies:
|
|
|
36
36
|
oauth ( http://oauth.googlecode.com/svn/code/ruby )
|
|
37
37
|
json/pure ( http://json.rubyforge.org )
|
|
38
38
|
|
|
39
|
-
You can install json via
|
|
39
|
+
You can install json via rubygem, which should provide a native C 'ext' and
|
|
40
40
|
pure ruby 'pure' extension. The native 'json/ext' module is faster, but could
|
|
41
41
|
lead to some compatibility issues, so we stuck with the pure variant.
|
|
42
42
|
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
<a href="../../files/lib/myspace/connection_rb.html">
|
|
59
59
|
lib/myspace/connection.rb
|
|
60
60
|
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../../files/pkg/myspace-ruby-0_7_0/lib/myspace/connection_rb.html">
|
|
63
|
+
pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb
|
|
64
|
+
</a>
|
|
61
65
|
<br />
|
|
62
66
|
</td>
|
|
63
67
|
</tr>
|
|
@@ -97,13 +101,20 @@ counterparts unless they‘re specified during initialization.
|
|
|
97
101
|
<h3 class="section-bar">Methods</h3>
|
|
98
102
|
|
|
99
103
|
<div class="name-list">
|
|
100
|
-
<a href="#
|
|
101
|
-
<a href="#
|
|
102
|
-
<a href="#
|
|
103
|
-
<a href="#
|
|
104
|
-
<a href="#
|
|
105
|
-
<a href="#
|
|
106
|
-
<a href="#
|
|
104
|
+
<a href="#M000043">connect</a>
|
|
105
|
+
<a href="#M000036">connect</a>
|
|
106
|
+
<a href="#M000035">consumer</a>
|
|
107
|
+
<a href="#M000042">consumer</a>
|
|
108
|
+
<a href="#M000046">get</a>
|
|
109
|
+
<a href="#M000039">get</a>
|
|
110
|
+
<a href="#M000038">get_body</a>
|
|
111
|
+
<a href="#M000045">get_body</a>
|
|
112
|
+
<a href="#M000040">new</a>
|
|
113
|
+
<a href="#M000033">new</a>
|
|
114
|
+
<a href="#M000037">post</a>
|
|
115
|
+
<a href="#M000044">post</a>
|
|
116
|
+
<a href="#M000034">timestamp</a>
|
|
117
|
+
<a href="#M000041">timestamp</a>
|
|
107
118
|
</div>
|
|
108
119
|
</div>
|
|
109
120
|
|
|
@@ -116,6 +127,7 @@ counterparts unless they‘re specified during initialization.
|
|
|
116
127
|
|
|
117
128
|
<div id="includes-list">
|
|
118
129
|
<span class="include-name">Net</span>
|
|
130
|
+
<span class="include-name">Net</span>
|
|
119
131
|
</div>
|
|
120
132
|
</div>
|
|
121
133
|
|
|
@@ -136,6 +148,14 @@ counterparts unless they‘re specified during initialization.
|
|
|
136
148
|
<td class="context-item-desc">
|
|
137
149
|
API key
|
|
138
150
|
|
|
151
|
+
</td>
|
|
152
|
+
</tr>
|
|
153
|
+
<tr class="top-aligned-row context-row">
|
|
154
|
+
<td class="context-item-name">apiKey</td>
|
|
155
|
+
<td class="context-item-value"> [RW] </td>
|
|
156
|
+
<td class="context-item-desc">
|
|
157
|
+
API key
|
|
158
|
+
|
|
139
159
|
</td>
|
|
140
160
|
</tr>
|
|
141
161
|
<tr class="top-aligned-row context-row">
|
|
@@ -144,6 +164,22 @@ API key
|
|
|
144
164
|
<td class="context-item-desc">
|
|
145
165
|
API password
|
|
146
166
|
|
|
167
|
+
</td>
|
|
168
|
+
</tr>
|
|
169
|
+
<tr class="top-aligned-row context-row">
|
|
170
|
+
<td class="context-item-name">apiSecret</td>
|
|
171
|
+
<td class="context-item-value"> [RW] </td>
|
|
172
|
+
<td class="context-item-desc">
|
|
173
|
+
API password
|
|
174
|
+
|
|
175
|
+
</td>
|
|
176
|
+
</tr>
|
|
177
|
+
<tr class="top-aligned-row context-row">
|
|
178
|
+
<td class="context-item-name">format</td>
|
|
179
|
+
<td class="context-item-value"> [RW] </td>
|
|
180
|
+
<td class="context-item-desc">
|
|
181
|
+
preferred output format
|
|
182
|
+
|
|
147
183
|
</td>
|
|
148
184
|
</tr>
|
|
149
185
|
<tr class="top-aligned-row context-row">
|
|
@@ -158,7 +194,23 @@ preferred output format
|
|
|
158
194
|
<td class="context-item-name">host</td>
|
|
159
195
|
<td class="context-item-value"> [RW] </td>
|
|
160
196
|
<td class="context-item-desc">
|
|
161
|
-
host to <a href="Connection.html#
|
|
197
|
+
host to <a href="Connection.html#M000036">connect</a>
|
|
198
|
+
|
|
199
|
+
</td>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr class="top-aligned-row context-row">
|
|
202
|
+
<td class="context-item-name">host</td>
|
|
203
|
+
<td class="context-item-value"> [RW] </td>
|
|
204
|
+
<td class="context-item-desc">
|
|
205
|
+
host to <a href="Connection.html#M000036">connect</a>
|
|
206
|
+
|
|
207
|
+
</td>
|
|
208
|
+
</tr>
|
|
209
|
+
<tr class="top-aligned-row context-row">
|
|
210
|
+
<td class="context-item-name">username</td>
|
|
211
|
+
<td class="context-item-value"> [RW] </td>
|
|
212
|
+
<td class="context-item-desc">
|
|
213
|
+
API username
|
|
162
214
|
|
|
163
215
|
</td>
|
|
164
216
|
</tr>
|
|
@@ -180,11 +232,49 @@ API username
|
|
|
180
232
|
<div id="methods">
|
|
181
233
|
<h3 class="section-bar">Public Class methods</h3>
|
|
182
234
|
|
|
183
|
-
<div id="method-
|
|
184
|
-
<a name="
|
|
235
|
+
<div id="method-M000040" class="method-detail">
|
|
236
|
+
<a name="M000040"></a>
|
|
237
|
+
|
|
238
|
+
<div class="method-heading">
|
|
239
|
+
<a href="#M000040" class="method-signature">
|
|
240
|
+
<span class="method-name">new</span><span class="method-args">(attributes={}) {|self if block_given?| ...}</span>
|
|
241
|
+
</a>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
<div class="method-description">
|
|
245
|
+
<p>
|
|
246
|
+
Constructor for the <a href="Connection.html">MySpace::Connection</a> class
|
|
247
|
+
</p>
|
|
248
|
+
<p><a class="source-toggle" href="#"
|
|
249
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
|
250
|
+
<div class="method-source-code" id="M000040-source">
|
|
251
|
+
<pre>
|
|
252
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 23</span>
|
|
253
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>={})
|
|
254
|
+
<span class="ruby-ivar">@apiKey</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:apiKey</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">CONF</span>[<span class="ruby-value str">"apiKey"</span>]
|
|
255
|
+
<span class="ruby-ivar">@secretKey</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:secretKey</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">CONF</span>[<span class="ruby-value str">"secretKey"</span>]
|
|
256
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">API_HOST</span>
|
|
257
|
+
<span class="ruby-ivar">@format</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:format</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">"json"</span>
|
|
258
|
+
|
|
259
|
+
<span class="ruby-ivar">@oauthOptions</span> = {
|
|
260
|
+
<span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:query_string</span>,
|
|
261
|
+
<span class="ruby-identifier">:nonce</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">65535</span>).<span class="ruby-identifier">to_s</span>,
|
|
262
|
+
<span class="ruby-identifier">:timestamp</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_s</span>,
|
|
263
|
+
<span class="ruby-identifier">:site</span> =<span class="ruby-operator">></span> <span class="ruby-node">"http://#{API_HOST}"</span>,
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
267
|
+
<span class="ruby-keyword kw">end</span>
|
|
268
|
+
</pre>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div id="method-M000033" class="method-detail">
|
|
274
|
+
<a name="M000033"></a>
|
|
185
275
|
|
|
186
276
|
<div class="method-heading">
|
|
187
|
-
<a href="#
|
|
277
|
+
<a href="#M000033" class="method-signature">
|
|
188
278
|
<span class="method-name">new</span><span class="method-args">(attributes={}) {|self if block_given?| ...}</span>
|
|
189
279
|
</a>
|
|
190
280
|
</div>
|
|
@@ -194,13 +284,13 @@ API username
|
|
|
194
284
|
Constructor for the <a href="Connection.html">MySpace::Connection</a> class
|
|
195
285
|
</p>
|
|
196
286
|
<p><a class="source-toggle" href="#"
|
|
197
|
-
onclick="toggleCode('
|
|
198
|
-
<div class="method-source-code" id="
|
|
287
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
|
288
|
+
<div class="method-source-code" id="M000033-source">
|
|
199
289
|
<pre>
|
|
200
290
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 23</span>
|
|
201
291
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>={})
|
|
202
292
|
<span class="ruby-ivar">@apiKey</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:apiKey</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">CONF</span>[<span class="ruby-value str">"apiKey"</span>]
|
|
203
|
-
<span class="ruby-ivar">@secretKey</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:
|
|
293
|
+
<span class="ruby-ivar">@secretKey</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:secretKey</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">CONF</span>[<span class="ruby-value str">"secretKey"</span>]
|
|
204
294
|
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">API_HOST</span>
|
|
205
295
|
<span class="ruby-ivar">@format</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">:format</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">"json"</span>
|
|
206
296
|
|
|
@@ -220,11 +310,11 @@ Constructor for the <a href="Connection.html">MySpace::Connection</a> class
|
|
|
220
310
|
|
|
221
311
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
222
312
|
|
|
223
|
-
<div id="method-
|
|
224
|
-
<a name="
|
|
313
|
+
<div id="method-M000043" class="method-detail">
|
|
314
|
+
<a name="M000043"></a>
|
|
225
315
|
|
|
226
316
|
<div class="method-heading">
|
|
227
|
-
<a href="#
|
|
317
|
+
<a href="#M000043" class="method-signature">
|
|
228
318
|
<span class="method-name">connect</span><span class="method-args">() {|@http if block_given?| ...}</span>
|
|
229
319
|
</a>
|
|
230
320
|
</div>
|
|
@@ -235,8 +325,39 @@ Connects to the MySapce API servers, returning a Net::HTTP class instance.
|
|
|
235
325
|
If a block is given, then that instance is yielded.
|
|
236
326
|
</p>
|
|
237
327
|
<p><a class="source-toggle" href="#"
|
|
238
|
-
onclick="toggleCode('
|
|
239
|
-
<div class="method-source-code" id="
|
|
328
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
|
329
|
+
<div class="method-source-code" id="M000043-source">
|
|
330
|
+
<pre>
|
|
331
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 50</span>
|
|
332
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span>
|
|
333
|
+
<span class="ruby-comment cmt"># require "net/https"</span>
|
|
334
|
+
<span class="ruby-comment cmt"># http = Net::HTTP.new(MYSPACE_API_HOST, 443)</span>
|
|
335
|
+
<span class="ruby-comment cmt"># http.use_ssl = true</span>
|
|
336
|
+
<span class="ruby-ivar">@http</span> = <span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@host</span>)
|
|
337
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@http</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
338
|
+
<span class="ruby-keyword kw">end</span>
|
|
339
|
+
</pre>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
<div id="method-M000036" class="method-detail">
|
|
345
|
+
<a name="M000036"></a>
|
|
346
|
+
|
|
347
|
+
<div class="method-heading">
|
|
348
|
+
<a href="#M000036" class="method-signature">
|
|
349
|
+
<span class="method-name">connect</span><span class="method-args">() {|@http if block_given?| ...}</span>
|
|
350
|
+
</a>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<div class="method-description">
|
|
354
|
+
<p>
|
|
355
|
+
Connects to the MySapce API servers, returning a Net::HTTP class instance.
|
|
356
|
+
If a block is given, then that instance is yielded.
|
|
357
|
+
</p>
|
|
358
|
+
<p><a class="source-toggle" href="#"
|
|
359
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
|
360
|
+
<div class="method-source-code" id="M000036-source">
|
|
240
361
|
<pre>
|
|
241
362
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 50</span>
|
|
242
363
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span>
|
|
@@ -251,34 +372,57 @@ If a block is given, then that instance is yielded.
|
|
|
251
372
|
</div>
|
|
252
373
|
</div>
|
|
253
374
|
|
|
254
|
-
<div id="method-
|
|
255
|
-
<a name="
|
|
375
|
+
<div id="method-M000035" class="method-detail">
|
|
376
|
+
<a name="M000035"></a>
|
|
256
377
|
|
|
257
378
|
<div class="method-heading">
|
|
258
|
-
<a href="#
|
|
379
|
+
<a href="#M000035" class="method-signature">
|
|
259
380
|
<span class="method-name">consumer</span><span class="method-args">()</span>
|
|
260
381
|
</a>
|
|
261
382
|
</div>
|
|
262
383
|
|
|
263
384
|
<div class="method-description">
|
|
264
385
|
<p><a class="source-toggle" href="#"
|
|
265
|
-
onclick="toggleCode('
|
|
266
|
-
<div class="method-source-code" id="
|
|
386
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
|
387
|
+
<div class="method-source-code" id="M000035-source">
|
|
267
388
|
<pre>
|
|
268
389
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 44</span>
|
|
269
390
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consumer</span>
|
|
270
|
-
<span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-
|
|
391
|
+
<span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@apiKey</span>,<span class="ruby-ivar">@secretKey</span>,<span class="ruby-ivar">@oauthOptions</span>)
|
|
392
|
+
<span class="ruby-keyword kw">end</span>
|
|
393
|
+
</pre>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div id="method-M000042" class="method-detail">
|
|
399
|
+
<a name="M000042"></a>
|
|
400
|
+
|
|
401
|
+
<div class="method-heading">
|
|
402
|
+
<a href="#M000042" class="method-signature">
|
|
403
|
+
<span class="method-name">consumer</span><span class="method-args">()</span>
|
|
404
|
+
</a>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div class="method-description">
|
|
408
|
+
<p><a class="source-toggle" href="#"
|
|
409
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
|
410
|
+
<div class="method-source-code" id="M000042-source">
|
|
411
|
+
<pre>
|
|
412
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 44</span>
|
|
413
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consumer</span>
|
|
414
|
+
<span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@apiKey</span>,<span class="ruby-ivar">@secretKey</span>,<span class="ruby-ivar">@oauthOptions</span>)
|
|
271
415
|
<span class="ruby-keyword kw">end</span>
|
|
272
416
|
</pre>
|
|
273
417
|
</div>
|
|
274
418
|
</div>
|
|
275
419
|
</div>
|
|
276
420
|
|
|
277
|
-
<div id="method-
|
|
278
|
-
<a name="
|
|
421
|
+
<div id="method-M000046" class="method-detail">
|
|
422
|
+
<a name="M000046"></a>
|
|
279
423
|
|
|
280
424
|
<div class="method-heading">
|
|
281
|
-
<a href="#
|
|
425
|
+
<a href="#M000046" class="method-signature">
|
|
282
426
|
<span class="method-name">get</span><span class="method-args">(path="/") {|la.call if block_given?| ...}</span>
|
|
283
427
|
</a>
|
|
284
428
|
</div>
|
|
@@ -292,8 +436,45 @@ Returns or yields a Net::HTTP::Response instance, depending on how
|
|
|
292
436
|
it‘s called.
|
|
293
437
|
</p>
|
|
294
438
|
<p><a class="source-toggle" href="#"
|
|
295
|
-
onclick="toggleCode('
|
|
296
|
-
<div class="method-source-code" id="
|
|
439
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
|
440
|
+
<div class="method-source-code" id="M000046-source">
|
|
441
|
+
<pre>
|
|
442
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 97</span>
|
|
443
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>=<span class="ruby-value str">"/"</span>)
|
|
444
|
+
<span class="ruby-identifier">req</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">path</span>)
|
|
445
|
+
|
|
446
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
447
|
+
|
|
448
|
+
<span class="ruby-identifier">la</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-identifier">req</span>.<span class="ruby-identifier">oauth!</span>(<span class="ruby-ivar">@http</span>,<span class="ruby-identifier">consumer</span>,<span class="ruby-keyword kw">nil</span>,<span class="ruby-ivar">@oauthOptions</span>)
|
|
449
|
+
<span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>) }
|
|
450
|
+
|
|
451
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">la</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
452
|
+
<span class="ruby-keyword kw">end</span>
|
|
453
|
+
</pre>
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
<div id="method-M000039" class="method-detail">
|
|
459
|
+
<a name="M000039"></a>
|
|
460
|
+
|
|
461
|
+
<div class="method-heading">
|
|
462
|
+
<a href="#M000039" class="method-signature">
|
|
463
|
+
<span class="method-name">get</span><span class="method-args">(path="/") {|la.call if block_given?| ...}</span>
|
|
464
|
+
</a>
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
<div class="method-description">
|
|
468
|
+
<p>
|
|
469
|
+
Performs a GET request against the <a href="../MySpace.html">MySpace</a>
|
|
470
|
+
API servers. The ‘path’ is the first argument, and the second
|
|
471
|
+
argument ‘http’ is an optional, existing Net::HTTP connection.
|
|
472
|
+
Returns or yields a Net::HTTP::Response instance, depending on how
|
|
473
|
+
it‘s called.
|
|
474
|
+
</p>
|
|
475
|
+
<p><a class="source-toggle" href="#"
|
|
476
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
|
477
|
+
<div class="method-source-code" id="M000039-source">
|
|
297
478
|
<pre>
|
|
298
479
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 97</span>
|
|
299
480
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>=<span class="ruby-value str">"/"</span>)
|
|
@@ -311,11 +492,11 @@ it‘s called.
|
|
|
311
492
|
</div>
|
|
312
493
|
</div>
|
|
313
494
|
|
|
314
|
-
<div id="method-
|
|
315
|
-
<a name="
|
|
495
|
+
<div id="method-M000038" class="method-detail">
|
|
496
|
+
<a name="M000038"></a>
|
|
316
497
|
|
|
317
498
|
<div class="method-heading">
|
|
318
|
-
<a href="#
|
|
499
|
+
<a href="#M000038" class="method-signature">
|
|
319
500
|
<span class="method-name">get_body</span><span class="method-args">(path)</span>
|
|
320
501
|
</a>
|
|
321
502
|
</div>
|
|
@@ -325,8 +506,8 @@ it‘s called.
|
|
|
325
506
|
Fetches the response body from the API servers
|
|
326
507
|
</p>
|
|
327
508
|
<p><a class="source-toggle" href="#"
|
|
328
|
-
onclick="toggleCode('
|
|
329
|
-
<div class="method-source-code" id="
|
|
509
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
|
510
|
+
<div class="method-source-code" id="M000038-source">
|
|
330
511
|
<pre>
|
|
331
512
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 75</span>
|
|
332
513
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_body</span>(<span class="ruby-identifier">path</span>)
|
|
@@ -349,11 +530,49 @@ Fetches the response body from the API servers
|
|
|
349
530
|
</div>
|
|
350
531
|
</div>
|
|
351
532
|
|
|
352
|
-
<div id="method-
|
|
353
|
-
<a name="
|
|
533
|
+
<div id="method-M000045" class="method-detail">
|
|
534
|
+
<a name="M000045"></a>
|
|
354
535
|
|
|
355
536
|
<div class="method-heading">
|
|
356
|
-
<a href="#
|
|
537
|
+
<a href="#M000045" class="method-signature">
|
|
538
|
+
<span class="method-name">get_body</span><span class="method-args">(path)</span>
|
|
539
|
+
</a>
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
<div class="method-description">
|
|
543
|
+
<p>
|
|
544
|
+
Fetches the response body from the API servers
|
|
545
|
+
</p>
|
|
546
|
+
<p><a class="source-toggle" href="#"
|
|
547
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
|
548
|
+
<div class="method-source-code" id="M000045-source">
|
|
549
|
+
<pre>
|
|
550
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 75</span>
|
|
551
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_body</span>(<span class="ruby-identifier">path</span>)
|
|
552
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
553
|
+
|
|
554
|
+
<span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">res</span><span class="ruby-operator">|</span>
|
|
555
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span>
|
|
556
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"200"</span>
|
|
557
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>
|
|
558
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"401"</span>
|
|
559
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCredentials</span>,
|
|
560
|
+
<span class="ruby-node">"Access denied. (#{res.code})\n#{res.body}"</span>
|
|
561
|
+
<span class="ruby-keyword kw">else</span>
|
|
562
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidResponse</span>,<span class="ruby-node">"(#{res.code})\n#{res.body}"</span>
|
|
563
|
+
<span class="ruby-keyword kw">end</span>
|
|
564
|
+
}
|
|
565
|
+
<span class="ruby-keyword kw">end</span>
|
|
566
|
+
</pre>
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
<div id="method-M000037" class="method-detail">
|
|
572
|
+
<a name="M000037"></a>
|
|
573
|
+
|
|
574
|
+
<div class="method-heading">
|
|
575
|
+
<a href="#M000037" class="method-signature">
|
|
357
576
|
<span class="method-name">post</span><span class="method-args">(path="/",data="",headers={},content_type="application/x-www-form-urlencoded") {|@http.request(req) if block_given?| ...}</span>
|
|
358
577
|
</a>
|
|
359
578
|
</div>
|
|
@@ -362,13 +581,13 @@ Fetches the response body from the API servers
|
|
|
362
581
|
<p>
|
|
363
582
|
Perform a POST operation against the <a href="../MySpace.html">MySpace</a>
|
|
364
583
|
API servers. You can pass a ‘path’, <a
|
|
365
|
-
href="Connection.html#
|
|
584
|
+
href="Connection.html#M000037">post</a> data ‘data’ and a
|
|
366
585
|
‘content_type’ optionally. application/x-www-form-urlencoded
|
|
367
586
|
text/xml; charset=utf-8
|
|
368
587
|
</p>
|
|
369
588
|
<p><a class="source-toggle" href="#"
|
|
370
|
-
onclick="toggleCode('
|
|
371
|
-
<div class="method-source-code" id="
|
|
589
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
|
590
|
+
<div class="method-source-code" id="M000037-source">
|
|
372
591
|
<pre>
|
|
373
592
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 63</span>
|
|
374
593
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>=<span class="ruby-value str">"/"</span>,<span class="ruby-identifier">data</span>=<span class="ruby-value str">""</span>,<span class="ruby-identifier">headers</span>={},<span class="ruby-identifier">content_type</span>=<span class="ruby-value str">"application/x-www-form-urlencoded"</span>)
|
|
@@ -386,11 +605,48 @@ text/xml; charset=utf-8
|
|
|
386
605
|
</div>
|
|
387
606
|
</div>
|
|
388
607
|
|
|
389
|
-
<div id="method-
|
|
390
|
-
<a name="
|
|
608
|
+
<div id="method-M000044" class="method-detail">
|
|
609
|
+
<a name="M000044"></a>
|
|
610
|
+
|
|
611
|
+
<div class="method-heading">
|
|
612
|
+
<a href="#M000044" class="method-signature">
|
|
613
|
+
<span class="method-name">post</span><span class="method-args">(path="/",data="",headers={},content_type="application/x-www-form-urlencoded") {|@http.request(req) if block_given?| ...}</span>
|
|
614
|
+
</a>
|
|
615
|
+
</div>
|
|
616
|
+
|
|
617
|
+
<div class="method-description">
|
|
618
|
+
<p>
|
|
619
|
+
Perform a POST operation against the <a href="../MySpace.html">MySpace</a>
|
|
620
|
+
API servers. You can pass a ‘path’, <a
|
|
621
|
+
href="Connection.html#M000037">post</a> data ‘data’ and a
|
|
622
|
+
‘content_type’ optionally. application/x-www-form-urlencoded
|
|
623
|
+
text/xml; charset=utf-8
|
|
624
|
+
</p>
|
|
625
|
+
<p><a class="source-toggle" href="#"
|
|
626
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
|
627
|
+
<div class="method-source-code" id="M000044-source">
|
|
628
|
+
<pre>
|
|
629
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 63</span>
|
|
630
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>=<span class="ruby-value str">"/"</span>,<span class="ruby-identifier">data</span>=<span class="ruby-value str">""</span>,<span class="ruby-identifier">headers</span>={},<span class="ruby-identifier">content_type</span>=<span class="ruby-value str">"application/x-www-form-urlencoded"</span>)
|
|
631
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
632
|
+
|
|
633
|
+
<span class="ruby-identifier">req</span> = <span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>,<span class="ruby-identifier">headers</span>)
|
|
634
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">set_form_data</span>({ }, <span class="ruby-value str">';'</span>)
|
|
635
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">data</span>
|
|
636
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">content_type</span>
|
|
637
|
+
|
|
638
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
639
|
+
<span class="ruby-keyword kw">end</span>
|
|
640
|
+
</pre>
|
|
641
|
+
</div>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
|
|
645
|
+
<div id="method-M000034" class="method-detail">
|
|
646
|
+
<a name="M000034"></a>
|
|
391
647
|
|
|
392
648
|
<div class="method-heading">
|
|
393
|
-
<a href="#
|
|
649
|
+
<a href="#M000034" class="method-signature">
|
|
394
650
|
<span class="method-name">timestamp</span><span class="method-args">()</span>
|
|
395
651
|
</a>
|
|
396
652
|
</div>
|
|
@@ -400,8 +656,8 @@ text/xml; charset=utf-8
|
|
|
400
656
|
Returns an rfc1123 format string
|
|
401
657
|
</p>
|
|
402
658
|
<p><a class="source-toggle" href="#"
|
|
403
|
-
onclick="toggleCode('
|
|
404
|
-
<div class="method-source-code" id="
|
|
659
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
|
660
|
+
<div class="method-source-code" id="M000034-source">
|
|
405
661
|
<pre>
|
|
406
662
|
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 40</span>
|
|
407
663
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">timestamp</span>
|
|
@@ -412,6 +668,32 @@ Returns an rfc1123 format string
|
|
|
412
668
|
</div>
|
|
413
669
|
</div>
|
|
414
670
|
|
|
671
|
+
<div id="method-M000041" class="method-detail">
|
|
672
|
+
<a name="M000041"></a>
|
|
673
|
+
|
|
674
|
+
<div class="method-heading">
|
|
675
|
+
<a href="#M000041" class="method-signature">
|
|
676
|
+
<span class="method-name">timestamp</span><span class="method-args">()</span>
|
|
677
|
+
</a>
|
|
678
|
+
</div>
|
|
679
|
+
|
|
680
|
+
<div class="method-description">
|
|
681
|
+
<p>
|
|
682
|
+
Returns an rfc1123 format string
|
|
683
|
+
</p>
|
|
684
|
+
<p><a class="source-toggle" href="#"
|
|
685
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
|
686
|
+
<div class="method-source-code" id="M000041-source">
|
|
687
|
+
<pre>
|
|
688
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/connection.rb, line 40</span>
|
|
689
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">timestamp</span>
|
|
690
|
+
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%a, %d %b %Y %H:%M:%S GMT"</span>)
|
|
691
|
+
<span class="ruby-keyword kw">end</span>
|
|
692
|
+
</pre>
|
|
693
|
+
</div>
|
|
694
|
+
</div>
|
|
695
|
+
</div>
|
|
696
|
+
|
|
415
697
|
|
|
416
698
|
</div>
|
|
417
699
|
|