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
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
<a href="../../files/lib/myspace/object_rb.html">
|
|
59
59
|
lib/myspace/object.rb
|
|
60
60
|
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../../files/pkg/myspace-ruby-0_7_0/lib/myspace/object_rb.html">
|
|
63
|
+
pkg/myspace-ruby-0.7.0/lib/myspace/object.rb
|
|
64
|
+
</a>
|
|
61
65
|
<br />
|
|
62
66
|
</td>
|
|
63
67
|
</tr>
|
|
@@ -88,12 +92,18 @@
|
|
|
88
92
|
<h3 class="section-bar">Methods</h3>
|
|
89
93
|
|
|
90
94
|
<div class="name-list">
|
|
91
|
-
<a href="#
|
|
92
|
-
<a href="#
|
|
93
|
-
<a href="#
|
|
94
|
-
<a href="#
|
|
95
|
-
<a href="#
|
|
96
|
-
<a href="#
|
|
95
|
+
<a href="#M000056">build_request</a>
|
|
96
|
+
<a href="#M000050">build_request</a>
|
|
97
|
+
<a href="#M000052">get</a>
|
|
98
|
+
<a href="#M000058">get</a>
|
|
99
|
+
<a href="#M000051">get_raw</a>
|
|
100
|
+
<a href="#M000057">get_raw</a>
|
|
101
|
+
<a href="#M000048">json_to_obj</a>
|
|
102
|
+
<a href="#M000054">json_to_obj</a>
|
|
103
|
+
<a href="#M000055">json_to_obj_collection</a>
|
|
104
|
+
<a href="#M000049">json_to_obj_collection</a>
|
|
105
|
+
<a href="#M000053">new</a>
|
|
106
|
+
<a href="#M000047">new</a>
|
|
97
107
|
</div>
|
|
98
108
|
</div>
|
|
99
109
|
|
|
@@ -115,11 +125,11 @@
|
|
|
115
125
|
<div id="methods">
|
|
116
126
|
<h3 class="section-bar">Public Class methods</h3>
|
|
117
127
|
|
|
118
|
-
<div id="method-
|
|
119
|
-
<a name="
|
|
128
|
+
<div id="method-M000056" class="method-detail">
|
|
129
|
+
<a name="M000056"></a>
|
|
120
130
|
|
|
121
131
|
<div class="method-heading">
|
|
122
|
-
<a href="#
|
|
132
|
+
<a href="#M000056" class="method-signature">
|
|
123
133
|
<span class="method-name">build_request</span><span class="method-args">(params,optParams=nil,format="json")</span>
|
|
124
134
|
</a>
|
|
125
135
|
</div>
|
|
@@ -129,8 +139,64 @@
|
|
|
129
139
|
Builds a REST request based on the supplied params and optParams
|
|
130
140
|
</p>
|
|
131
141
|
<p><a class="source-toggle" href="#"
|
|
132
|
-
onclick="toggleCode('
|
|
133
|
-
<div class="method-source-code" id="
|
|
142
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
|
143
|
+
<div class="method-source-code" id="M000056-source">
|
|
144
|
+
<pre>
|
|
145
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 53</span>
|
|
146
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">format</span>=<span class="ruby-value str">"json"</span>)
|
|
147
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@numParams</span>
|
|
148
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(
|
|
149
|
+
<span class="ruby-node">"#{self}.get needs #{@numParams} (#{@pathFormat})"</span>)
|
|
150
|
+
<span class="ruby-keyword kw">end</span>
|
|
151
|
+
|
|
152
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequest</span>.<span class="ruby-identifier">new</span>(
|
|
153
|
+
<span class="ruby-node">"try a collection of #{self} objects"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pathFormat</span>.<span class="ruby-identifier">nil?</span>
|
|
154
|
+
|
|
155
|
+
<span class="ruby-keyword kw">begin</span>
|
|
156
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-node">"/#{API_VERSION}#{@pathFormat % params}.#{format}"</span>
|
|
157
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
158
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(
|
|
159
|
+
<span class="ruby-node">"couldn't build a path from params '#{params.join("'")}' \
|
|
160
|
+
and format string #{@pathFormat}. Exception is: (#{e})"</span>)
|
|
161
|
+
<span class="ruby-keyword kw">end</span>
|
|
162
|
+
|
|
163
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">optParams</span>
|
|
164
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(
|
|
165
|
+
<span class="ruby-value str">"optParams should be a Hash."</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">optParams</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>)
|
|
166
|
+
|
|
167
|
+
<span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"?"</span>
|
|
168
|
+
|
|
169
|
+
<span class="ruby-identifier">optParams</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
170
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@optParams</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@optParams</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>)
|
|
171
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"option '#{k}' is not valid."</span>)
|
|
172
|
+
<span class="ruby-keyword kw">end</span>
|
|
173
|
+
<span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"#{k}=#{v}&"</span>
|
|
174
|
+
}
|
|
175
|
+
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/&$/</span>,<span class="ruby-value str">""</span>)
|
|
176
|
+
<span class="ruby-keyword kw">end</span>
|
|
177
|
+
<span class="ruby-identifier">path</span>
|
|
178
|
+
<span class="ruby-keyword kw">end</span>
|
|
179
|
+
</pre>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<div id="method-M000050" class="method-detail">
|
|
185
|
+
<a name="M000050"></a>
|
|
186
|
+
|
|
187
|
+
<div class="method-heading">
|
|
188
|
+
<a href="#M000050" class="method-signature">
|
|
189
|
+
<span class="method-name">build_request</span><span class="method-args">(params,optParams=nil,format="json")</span>
|
|
190
|
+
</a>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="method-description">
|
|
194
|
+
<p>
|
|
195
|
+
Builds a REST request based on the supplied params and optParams
|
|
196
|
+
</p>
|
|
197
|
+
<p><a class="source-toggle" href="#"
|
|
198
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
|
199
|
+
<div class="method-source-code" id="M000050-source">
|
|
134
200
|
<pre>
|
|
135
201
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 53</span>
|
|
136
202
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">format</span>=<span class="ruby-value str">"json"</span>)
|
|
@@ -171,23 +237,23 @@ Builds a REST request based on the supplied params and optParams
|
|
|
171
237
|
</div>
|
|
172
238
|
</div>
|
|
173
239
|
|
|
174
|
-
<div id="method-
|
|
175
|
-
<a name="
|
|
240
|
+
<div id="method-M000052" class="method-detail">
|
|
241
|
+
<a name="M000052"></a>
|
|
176
242
|
|
|
177
243
|
<div class="method-heading">
|
|
178
|
-
<a href="#
|
|
244
|
+
<a href="#M000052" class="method-signature">
|
|
179
245
|
<span class="method-name">get</span><span class="method-args">(params,optParams=nil)</span>
|
|
180
246
|
</a>
|
|
181
247
|
</div>
|
|
182
248
|
|
|
183
249
|
<div class="method-description">
|
|
184
250
|
<p>
|
|
185
|
-
Performs a <a href="Object.html#
|
|
251
|
+
Performs a <a href="Object.html#M000052">get</a> request to the API servers
|
|
186
252
|
and returns some <a href="../MySpace.html">MySpace</a> object
|
|
187
253
|
</p>
|
|
188
254
|
<p><a class="source-toggle" href="#"
|
|
189
|
-
onclick="toggleCode('
|
|
190
|
-
<div class="method-source-code" id="
|
|
255
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
|
256
|
+
<div class="method-source-code" id="M000052-source">
|
|
191
257
|
<pre>
|
|
192
258
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 94</span>
|
|
193
259
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>)
|
|
@@ -201,7 +267,6 @@ and returns some <a href="../MySpace.html">MySpace</a> object
|
|
|
201
267
|
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@dataType</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"Hash"</span>
|
|
202
268
|
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">json_to_obj</span>(<span class="ruby-identifier">body</span>)
|
|
203
269
|
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@dataType</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"Array"</span>
|
|
204
|
-
<span class="ruby-identifier">body</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\{"Groups"\:/</span>,<span class="ruby-value str">'{"groups":'</span>) <span class="ruby-comment cmt"># you did not see this</span>
|
|
205
270
|
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">json_to_obj_collection</span>(<span class="ruby-identifier">body</span>)
|
|
206
271
|
<span class="ruby-keyword kw">else</span>
|
|
207
272
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{@dataType} is not a valid data type."</span>)
|
|
@@ -212,11 +277,51 @@ and returns some <a href="../MySpace.html">MySpace</a> object
|
|
|
212
277
|
</div>
|
|
213
278
|
</div>
|
|
214
279
|
|
|
215
|
-
<div id="method-
|
|
216
|
-
<a name="
|
|
280
|
+
<div id="method-M000058" class="method-detail">
|
|
281
|
+
<a name="M000058"></a>
|
|
217
282
|
|
|
218
283
|
<div class="method-heading">
|
|
219
|
-
<a href="#
|
|
284
|
+
<a href="#M000058" class="method-signature">
|
|
285
|
+
<span class="method-name">get</span><span class="method-args">(params,optParams=nil)</span>
|
|
286
|
+
</a>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<div class="method-description">
|
|
290
|
+
<p>
|
|
291
|
+
Performs a <a href="Object.html#M000052">get</a> request to the API servers
|
|
292
|
+
and returns some <a href="../MySpace.html">MySpace</a> object
|
|
293
|
+
</p>
|
|
294
|
+
<p><a class="source-toggle" href="#"
|
|
295
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
|
296
|
+
<div class="method-source-code" id="M000058-source">
|
|
297
|
+
<pre>
|
|
298
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 94</span>
|
|
299
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>)
|
|
300
|
+
|
|
301
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>)
|
|
302
|
+
<span class="ruby-comment cmt">#puts "#{path} pathFormat #{@pathFormat} childType #{@childType} </span>
|
|
303
|
+
<span class="ruby-comment cmt">#childBase #{@childBase} numParams #{@numParams}"</span>
|
|
304
|
+
|
|
305
|
+
<span class="ruby-identifier">body</span> = <span class="ruby-constant">MySpace</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">get_body</span>(<span class="ruby-identifier">path</span>)
|
|
306
|
+
|
|
307
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@dataType</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"Hash"</span>
|
|
308
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">json_to_obj</span>(<span class="ruby-identifier">body</span>)
|
|
309
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@dataType</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"Array"</span>
|
|
310
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">json_to_obj_collection</span>(<span class="ruby-identifier">body</span>)
|
|
311
|
+
<span class="ruby-keyword kw">else</span>
|
|
312
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidRequestParams</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{@dataType} is not a valid data type."</span>)
|
|
313
|
+
<span class="ruby-keyword kw">end</span>
|
|
314
|
+
<span class="ruby-keyword kw">end</span>
|
|
315
|
+
</pre>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div id="method-M000051" class="method-detail">
|
|
321
|
+
<a name="M000051"></a>
|
|
322
|
+
|
|
323
|
+
<div class="method-heading">
|
|
324
|
+
<a href="#M000051" class="method-signature">
|
|
220
325
|
<span class="method-name">get_raw</span><span class="method-args">(params,optParams=nil,format="json")</span>
|
|
221
326
|
</a>
|
|
222
327
|
</div>
|
|
@@ -226,8 +331,8 @@ and returns some <a href="../MySpace.html">MySpace</a> object
|
|
|
226
331
|
Performs a request to the API servers and returns the raw JSON/XML
|
|
227
332
|
</p>
|
|
228
333
|
<p><a class="source-toggle" href="#"
|
|
229
|
-
onclick="toggleCode('
|
|
230
|
-
<div class="method-source-code" id="
|
|
334
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
|
335
|
+
<div class="method-source-code" id="M000051-source">
|
|
231
336
|
<pre>
|
|
232
337
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 88</span>
|
|
233
338
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_raw</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">format</span>=<span class="ruby-value str">"json"</span>)
|
|
@@ -239,11 +344,38 @@ Performs a request to the API servers and returns the raw JSON/XML
|
|
|
239
344
|
</div>
|
|
240
345
|
</div>
|
|
241
346
|
|
|
242
|
-
<div id="method-
|
|
243
|
-
<a name="
|
|
347
|
+
<div id="method-M000057" class="method-detail">
|
|
348
|
+
<a name="M000057"></a>
|
|
349
|
+
|
|
350
|
+
<div class="method-heading">
|
|
351
|
+
<a href="#M000057" class="method-signature">
|
|
352
|
+
<span class="method-name">get_raw</span><span class="method-args">(params,optParams=nil,format="json")</span>
|
|
353
|
+
</a>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<div class="method-description">
|
|
357
|
+
<p>
|
|
358
|
+
Performs a request to the API servers and returns the raw JSON/XML
|
|
359
|
+
</p>
|
|
360
|
+
<p><a class="source-toggle" href="#"
|
|
361
|
+
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
|
362
|
+
<div class="method-source-code" id="M000057-source">
|
|
363
|
+
<pre>
|
|
364
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 88</span>
|
|
365
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_raw</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">format</span>=<span class="ruby-value str">"json"</span>)
|
|
366
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">params</span>,<span class="ruby-identifier">optParams</span>,<span class="ruby-identifier">format</span>)
|
|
367
|
+
<span class="ruby-constant">MySpace</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">get_body</span>(<span class="ruby-identifier">path</span>)
|
|
368
|
+
<span class="ruby-keyword kw">end</span>
|
|
369
|
+
</pre>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<div id="method-M000048" class="method-detail">
|
|
375
|
+
<a name="M000048"></a>
|
|
244
376
|
|
|
245
377
|
<div class="method-heading">
|
|
246
|
-
<a href="#
|
|
378
|
+
<a href="#M000048" class="method-signature">
|
|
247
379
|
<span class="method-name">json_to_obj</span><span class="method-args">(body)</span>
|
|
248
380
|
</a>
|
|
249
381
|
</div>
|
|
@@ -253,8 +385,8 @@ Performs a request to the API servers and returns the raw JSON/XML
|
|
|
253
385
|
Attempts to convert JSON to <a href="../MySpace.html">MySpace</a> objects
|
|
254
386
|
</p>
|
|
255
387
|
<p><a class="source-toggle" href="#"
|
|
256
|
-
onclick="toggleCode('
|
|
257
|
-
<div class="method-source-code" id="
|
|
388
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
|
389
|
+
<div class="method-source-code" id="M000048-source">
|
|
258
390
|
<pre>
|
|
259
391
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 25</span>
|
|
260
392
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_to_obj</span>(<span class="ruby-identifier">body</span>)
|
|
@@ -271,11 +403,43 @@ Attempts to convert JSON to <a href="../MySpace.html">MySpace</a> objects
|
|
|
271
403
|
</div>
|
|
272
404
|
</div>
|
|
273
405
|
|
|
274
|
-
<div id="method-
|
|
275
|
-
<a name="
|
|
406
|
+
<div id="method-M000054" class="method-detail">
|
|
407
|
+
<a name="M000054"></a>
|
|
408
|
+
|
|
409
|
+
<div class="method-heading">
|
|
410
|
+
<a href="#M000054" class="method-signature">
|
|
411
|
+
<span class="method-name">json_to_obj</span><span class="method-args">(body)</span>
|
|
412
|
+
</a>
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<div class="method-description">
|
|
416
|
+
<p>
|
|
417
|
+
Attempts to convert JSON to <a href="../MySpace.html">MySpace</a> objects
|
|
418
|
+
</p>
|
|
419
|
+
<p><a class="source-toggle" href="#"
|
|
420
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
|
421
|
+
<div class="method-source-code" id="M000054-source">
|
|
422
|
+
<pre>
|
|
423
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 25</span>
|
|
424
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_to_obj</span>(<span class="ruby-identifier">body</span>)
|
|
425
|
+
<span class="ruby-keyword kw">begin</span>
|
|
426
|
+
<span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">body</span>))
|
|
427
|
+
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">user</span> = <span class="ruby-constant">MySpace</span><span class="ruby-operator">::</span><span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">user</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">"user"</span>)
|
|
428
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
429
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidResponse</span>, <span class="ruby-node">"could not parse json from #{body}: '#{e}'"</span>
|
|
430
|
+
<span class="ruby-keyword kw">end</span>
|
|
431
|
+
<span class="ruby-identifier">obj</span>
|
|
432
|
+
<span class="ruby-keyword kw">end</span>
|
|
433
|
+
</pre>
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div id="method-M000055" class="method-detail">
|
|
439
|
+
<a name="M000055"></a>
|
|
276
440
|
|
|
277
441
|
<div class="method-heading">
|
|
278
|
-
<a href="#
|
|
442
|
+
<a href="#M000055" class="method-signature">
|
|
279
443
|
<span class="method-name">json_to_obj_collection</span><span class="method-args">(body)</span>
|
|
280
444
|
</a>
|
|
281
445
|
</div>
|
|
@@ -286,8 +450,47 @@ Attempts to convert JSON to a <a href="../MySpace.html">MySpace</a> objects
|
|
|
286
450
|
(with child collections)
|
|
287
451
|
</p>
|
|
288
452
|
<p><a class="source-toggle" href="#"
|
|
289
|
-
onclick="toggleCode('
|
|
290
|
-
<div class="method-source-code" id="
|
|
453
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
|
454
|
+
<div class="method-source-code" id="M000055-source">
|
|
455
|
+
<pre>
|
|
456
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 36</span>
|
|
457
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_to_obj_collection</span>(<span class="ruby-identifier">body</span>)
|
|
458
|
+
<span class="ruby-keyword kw">begin</span>
|
|
459
|
+
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">json_to_obj</span>(<span class="ruby-identifier">body</span>)
|
|
460
|
+
|
|
461
|
+
<span class="ruby-identifier">col</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">instance_variable_get</span> <span class="ruby-node">"@#{@childBase}"</span>
|
|
462
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidResponse</span>, <span class="ruby-node">"No '#{@childBase}' in response"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">col</span>
|
|
463
|
+
|
|
464
|
+
<span class="ruby-identifier">col</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-node">"@#{@childBase}"</span>,
|
|
465
|
+
<span class="ruby-identifier">col</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">"#{@childType}.new(o)"</span>) }
|
|
466
|
+
|
|
467
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
468
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidResponse</span>, <span class="ruby-node">"could not parse json from #{body}: '#{e}'"</span>
|
|
469
|
+
<span class="ruby-keyword kw">end</span>
|
|
470
|
+
<span class="ruby-identifier">obj</span>
|
|
471
|
+
<span class="ruby-keyword kw">end</span>
|
|
472
|
+
</pre>
|
|
473
|
+
</div>
|
|
474
|
+
</div>
|
|
475
|
+
</div>
|
|
476
|
+
|
|
477
|
+
<div id="method-M000049" class="method-detail">
|
|
478
|
+
<a name="M000049"></a>
|
|
479
|
+
|
|
480
|
+
<div class="method-heading">
|
|
481
|
+
<a href="#M000049" class="method-signature">
|
|
482
|
+
<span class="method-name">json_to_obj_collection</span><span class="method-args">(body)</span>
|
|
483
|
+
</a>
|
|
484
|
+
</div>
|
|
485
|
+
|
|
486
|
+
<div class="method-description">
|
|
487
|
+
<p>
|
|
488
|
+
Attempts to convert JSON to a <a href="../MySpace.html">MySpace</a> objects
|
|
489
|
+
(with child collections)
|
|
490
|
+
</p>
|
|
491
|
+
<p><a class="source-toggle" href="#"
|
|
492
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
|
493
|
+
<div class="method-source-code" id="M000049-source">
|
|
291
494
|
<pre>
|
|
292
495
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 36</span>
|
|
293
496
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_to_obj_collection</span>(<span class="ruby-identifier">body</span>)
|
|
@@ -310,19 +513,42 @@ Attempts to convert JSON to a <a href="../MySpace.html">MySpace</a> objects
|
|
|
310
513
|
</div>
|
|
311
514
|
</div>
|
|
312
515
|
|
|
313
|
-
<div id="method-
|
|
314
|
-
<a name="
|
|
516
|
+
<div id="method-M000053" class="method-detail">
|
|
517
|
+
<a name="M000053"></a>
|
|
518
|
+
|
|
519
|
+
<div class="method-heading">
|
|
520
|
+
<a href="#M000053" class="method-signature">
|
|
521
|
+
<span class="method-name">new</span><span class="method-args">(attribs={})</span>
|
|
522
|
+
</a>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<div class="method-description">
|
|
526
|
+
<p><a class="source-toggle" href="#"
|
|
527
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
|
528
|
+
<div class="method-source-code" id="M000053-source">
|
|
529
|
+
<pre>
|
|
530
|
+
<span class="ruby-comment cmt"># File pkg/myspace-ruby-0.7.0/lib/myspace/object.rb, line 19</span>
|
|
531
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attribs</span>={})
|
|
532
|
+
<span class="ruby-identifier">attribs</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">val</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>,<span class="ruby-identifier">val</span>) }
|
|
533
|
+
<span class="ruby-keyword kw">end</span>
|
|
534
|
+
</pre>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
537
|
+
</div>
|
|
538
|
+
|
|
539
|
+
<div id="method-M000047" class="method-detail">
|
|
540
|
+
<a name="M000047"></a>
|
|
315
541
|
|
|
316
542
|
<div class="method-heading">
|
|
317
|
-
<a href="#
|
|
543
|
+
<a href="#M000047" class="method-signature">
|
|
318
544
|
<span class="method-name">new</span><span class="method-args">(attribs={})</span>
|
|
319
545
|
</a>
|
|
320
546
|
</div>
|
|
321
547
|
|
|
322
548
|
<div class="method-description">
|
|
323
549
|
<p><a class="source-toggle" href="#"
|
|
324
|
-
onclick="toggleCode('
|
|
325
|
-
<div class="method-source-code" id="
|
|
550
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
|
551
|
+
<div class="method-source-code" id="M000047-source">
|
|
326
552
|
<pre>
|
|
327
553
|
<span class="ruby-comment cmt"># File lib/myspace/object.rb, line 19</span>
|
|
328
554
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attribs</span>={})
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
<a href="../../files/lib/myspace/classes/user_rb.html">
|
|
59
59
|
lib/myspace/classes/user.rb
|
|
60
60
|
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../../files/pkg/myspace-ruby-0_7_0/lib/myspace/classes/user_rb.html">
|
|
63
|
+
pkg/myspace-ruby-0.7.0/lib/myspace/classes/user.rb
|
|
64
|
+
</a>
|
|
61
65
|
<br />
|
|
62
66
|
</td>
|
|
63
67
|
</tr>
|
|
@@ -106,6 +110,29 @@
|
|
|
106
110
|
<td class="context-item-value"> [RW] </td>
|
|
107
111
|
<td class="context-item-desc"></td>
|
|
108
112
|
</tr>
|
|
113
|
+
<tr class="top-aligned-row context-row">
|
|
114
|
+
<td class="context-item-name">image</td>
|
|
115
|
+
<td class="context-item-value"> [RW] </td>
|
|
116
|
+
<td class="context-item-desc"></td>
|
|
117
|
+
</tr>
|
|
118
|
+
<tr class="top-aligned-row context-row">
|
|
119
|
+
<td class="context-item-name">largeimage</td>
|
|
120
|
+
<td class="context-item-value"> [RW] </td>
|
|
121
|
+
<td class="context-item-desc"></td>
|
|
122
|
+
</tr>
|
|
123
|
+
<tr class="top-aligned-row context-row">
|
|
124
|
+
<td class="context-item-name">largeimage</td>
|
|
125
|
+
<td class="context-item-value"> [RW] </td>
|
|
126
|
+
<td class="context-item-desc"></td>
|
|
127
|
+
</tr>
|
|
128
|
+
<tr class="top-aligned-row context-row">
|
|
129
|
+
<td class="context-item-name">name</td>
|
|
130
|
+
<td class="context-item-value"> [RW] </td>
|
|
131
|
+
<td class="context-item-desc">
|
|
132
|
+
the name the user specified for the profile (not username/vanity url)
|
|
133
|
+
|
|
134
|
+
</td>
|
|
135
|
+
</tr>
|
|
109
136
|
<tr class="top-aligned-row context-row">
|
|
110
137
|
<td class="context-item-name">name</td>
|
|
111
138
|
<td class="context-item-value"> [RW] </td>
|
|
@@ -119,6 +146,19 @@ the name the user specified for the profile (not username/vanity url)
|
|
|
119
146
|
<td class="context-item-value"> [RW] </td>
|
|
120
147
|
<td class="context-item-desc"></td>
|
|
121
148
|
</tr>
|
|
149
|
+
<tr class="top-aligned-row context-row">
|
|
150
|
+
<td class="context-item-name">onlineNow</td>
|
|
151
|
+
<td class="context-item-value"> [RW] </td>
|
|
152
|
+
<td class="context-item-desc"></td>
|
|
153
|
+
</tr>
|
|
154
|
+
<tr class="top-aligned-row context-row">
|
|
155
|
+
<td class="context-item-name">uri</td>
|
|
156
|
+
<td class="context-item-value"> [RW] </td>
|
|
157
|
+
<td class="context-item-desc">
|
|
158
|
+
the URL of the user‘s profile page
|
|
159
|
+
|
|
160
|
+
</td>
|
|
161
|
+
</tr>
|
|
122
162
|
<tr class="top-aligned-row context-row">
|
|
123
163
|
<td class="context-item-name">uri</td>
|
|
124
164
|
<td class="context-item-value"> [RW] </td>
|
|
@@ -132,6 +172,16 @@ the URL of the user‘s profile page
|
|
|
132
172
|
<td class="context-item-value"> [RW] </td>
|
|
133
173
|
<td class="context-item-desc"></td>
|
|
134
174
|
</tr>
|
|
175
|
+
<tr class="top-aligned-row context-row">
|
|
176
|
+
<td class="context-item-name">userId</td>
|
|
177
|
+
<td class="context-item-value"> [RW] </td>
|
|
178
|
+
<td class="context-item-desc"></td>
|
|
179
|
+
</tr>
|
|
180
|
+
<tr class="top-aligned-row context-row">
|
|
181
|
+
<td class="context-item-name">userType</td>
|
|
182
|
+
<td class="context-item-value"> [RW] </td>
|
|
183
|
+
<td class="context-item-desc"></td>
|
|
184
|
+
</tr>
|
|
135
185
|
<tr class="top-aligned-row context-row">
|
|
136
186
|
<td class="context-item-name">userType</td>
|
|
137
187
|
<td class="context-item-value"> [RW] </td>
|
|
@@ -142,6 +192,11 @@ the URL of the user‘s profile page
|
|
|
142
192
|
<td class="context-item-value"> [RW] </td>
|
|
143
193
|
<td class="context-item-desc"></td>
|
|
144
194
|
</tr>
|
|
195
|
+
<tr class="top-aligned-row context-row">
|
|
196
|
+
<td class="context-item-name">webUri</td>
|
|
197
|
+
<td class="context-item-value"> [RW] </td>
|
|
198
|
+
<td class="context-item-desc"></td>
|
|
199
|
+
</tr>
|
|
145
200
|
</table>
|
|
146
201
|
</div>
|
|
147
202
|
</div>
|