myspace-ruby 0.7.0

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.
Files changed (56) hide show
  1. data/README +284 -0
  2. data/doc/classes/MySpace.html +666 -0
  3. data/doc/classes/MySpace/Album.html +225 -0
  4. data/doc/classes/MySpace/Connection.html +427 -0
  5. data/doc/classes/MySpace/Detail.html +191 -0
  6. data/doc/classes/MySpace/FriendStatus.html +131 -0
  7. data/doc/classes/MySpace/Friends.html +141 -0
  8. data/doc/classes/MySpace/Friendship.html +205 -0
  9. data/doc/classes/MySpace/Group.html +301 -0
  10. data/doc/classes/MySpace/Groups.html +146 -0
  11. data/doc/classes/MySpace/Interest.html +156 -0
  12. data/doc/classes/MySpace/InvalidClassDefinition.html +111 -0
  13. data/doc/classes/MySpace/InvalidCredentials.html +111 -0
  14. data/doc/classes/MySpace/InvalidDataFormat.html +111 -0
  15. data/doc/classes/MySpace/InvalidObjectMap.html +111 -0
  16. data/doc/classes/MySpace/InvalidRequest.html +111 -0
  17. data/doc/classes/MySpace/InvalidRequestParams.html +111 -0
  18. data/doc/classes/MySpace/InvalidResponse.html +111 -0
  19. data/doc/classes/MySpace/Mood.html +131 -0
  20. data/doc/classes/MySpace/Object.html +348 -0
  21. data/doc/classes/MySpace/Photo.html +146 -0
  22. data/doc/classes/MySpace/Photos.html +136 -0
  23. data/doc/classes/MySpace/Profile.html +176 -0
  24. data/doc/classes/MySpace/Status.html +131 -0
  25. data/doc/classes/MySpace/UnknownDataType.html +111 -0
  26. data/doc/classes/MySpace/User.html +162 -0
  27. data/doc/classes/MySpace/Video.html +256 -0
  28. data/doc/classes/MySpace/Videos.html +126 -0
  29. data/doc/classes/MySpaceAPITest.html +916 -0
  30. data/doc/created.rid +1 -0
  31. data/doc/files/lib/myspace_rb.html +185 -0
  32. data/doc/files/tests/test_rb.html +109 -0
  33. data/doc/fr_class_index.html +28 -0
  34. data/doc/fr_file_index.html +29 -0
  35. data/doc/fr_method_index.html +54 -0
  36. data/doc/index.html +24 -0
  37. data/doc/rdoc-style.css +208 -0
  38. data/lib/myspace.rb +45 -0
  39. data/lib/myspace/classes/album.rb +25 -0
  40. data/lib/myspace/classes/detail.rb +22 -0
  41. data/lib/myspace/classes/friends.rb +16 -0
  42. data/lib/myspace/classes/friendship.rb +27 -0
  43. data/lib/myspace/classes/group.rb +55 -0
  44. data/lib/myspace/classes/interest.rb +16 -0
  45. data/lib/myspace/classes/mood.rb +9 -0
  46. data/lib/myspace/classes/photo.rb +21 -0
  47. data/lib/myspace/classes/profile.rb +22 -0
  48. data/lib/myspace/classes/status.rb +9 -0
  49. data/lib/myspace/classes/user.rb +17 -0
  50. data/lib/myspace/classes/video.rb +41 -0
  51. data/lib/myspace/connection.rb +110 -0
  52. data/lib/myspace/error.rb +12 -0
  53. data/lib/myspace/loader.rb +74 -0
  54. data/lib/myspace/object.rb +116 -0
  55. data/tests/test.rb +148 -0
  56. metadata +108 -0
data/README ADDED
@@ -0,0 +1,284 @@
1
+ == MySpace API
2
+
3
+ This is the official MySpace Ruby library, which communicates to the MySpace
4
+ API REST servers and converts JSON into proper Ruby objects.
5
+
6
+ In order to use the library, you need to sign up for a developer account and
7
+ ensure you have the oath and json modules installed.
8
+
9
+ = Developer Account, Access Keys and Permissions
10
+
11
+ To get a developer account, you need to sign up at:
12
+
13
+ http://developer.myspace.com
14
+
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)
17
+ and the secret key will be a 32 character hex string.
18
+
19
+ You can find the keys in the Application Builder, by clicking on the
20
+ 'Edit App Information' link. The apiKey is the 'Application Uri' and the
21
+ secretKey is 'Application Domain'.
22
+
23
+ The keys can be placed into myspace.conf or specified at runtime
24
+ when you new a MySpace::Connection. The myspace.conf file can be in the
25
+ current directory where the script is being run from, or can be specified
26
+ by settin the MYSPACE_CONF environment variable.
27
+
28
+ You only have access to users that have installed your application. Also,
29
+ write access to these user's profiles (to update status or upload a picture)
30
+ is at the user's discretion.
31
+
32
+ = Depencencies
33
+
34
+ This library has some external dependencies:
35
+
36
+ oauth ( http://oauth.googlecode.com/svn/code/ruby )
37
+ json/pure ( http://json.rubyforge.org )
38
+
39
+ You can install json via rubygems, which should provide a native C 'ext' and
40
+ pure ruby 'pure' extension. The native 'json/ext' module is faster, but could
41
+ lead to some compatibility issues, so we stuck with the pure variant.
42
+
43
+ At this point, oauth is not available as a rubygem and needs to be installed
44
+ from the URL above.
45
+
46
+ = Usage
47
+
48
+ require "myspace"
49
+
50
+ userId = 123
51
+ friendId = 1234
52
+ albumId = 12345
53
+
54
+ # NOTE:
55
+ # Permission to access a user's data is restricted -- you can't just access
56
+ # any user's data. In order to access a user's data, they need to have
57
+ # installed your app.
58
+
59
+ # Snag a MySpace::User object for user with id userId
60
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
61
+ user = MySpace::User.get(userId)
62
+ puts user.name + " has a profile picture at " + user.image
63
+
64
+ # Grab an an album
65
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
66
+ album = MySpace::Album.get(userId,albumId)
67
+ if album.photoCount > 1
68
+ puts "album at #{album.albumUri} has #{album.photoCount} photos"
69
+ else
70
+ puts "#{album.title} has only one photo"
71
+ end
72
+
73
+ # Iterate through all the photos for a user
74
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
75
+ photos = MySpace::Photos.get(userId)
76
+ puts "User has #{photos.count} photos"
77
+ photos.photos.each {|photo|
78
+ puts "id #{photo.id}, caption #{photo.caption}, imageUri #{photo.imageUri}"
79
+ }
80
+
81
+ # Read a user's interests
82
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
83
+ interests = MySpace::Interest.get(userId)
84
+ puts "shrug at the fountain" if interests.books =~ /rand/i
85
+
86
+ # Read a user's profile data
87
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
88
+ profile = MySpace::Profile.get(userId)
89
+ puts "You #{profile.age >= 18 ? "can" : "can't"} vote"
90
+
91
+ # Check if two or more users are friendly
92
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
93
+ include MySpace
94
+
95
+ friendId = 92281327
96
+
97
+ friendship = Friendship.get(userId,friendId)
98
+ friend = friends.friendship.first
99
+ puts "user #{userId} is#{friend.areFriends ? "" : " not"} friends with user #{friend.friendId}"
100
+ }
101
+
102
+ friendIds = "92281327;92281328"
103
+
104
+ friendship = Friendship.get(userId,friendIds)
105
+ friendship.friends.each {|f|
106
+ puts "user #{userId} is#{f.areFriends ? "" : " not"} friends with user #{f.friendId}"
107
+ }
108
+
109
+ # Friends
110
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
111
+ friends = MySpace::Friends.get(userId, {:page => 1, :page_size => 200})
112
+ puts "User #{userId} has #{friends.count} friends."
113
+
114
+ # friends.friends is an Array of MySpace::User objects
115
+ friends.friends.each {|user|
116
+ puts "user #{user.name} #{user.webUri}"
117
+ }
118
+
119
+ # Mood
120
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
121
+ puts "user id #{userId} mood " + MySpace::Mood.get(userId).mood
122
+
123
+ # Get info on a user's videos
124
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
125
+ MySpace::Videos.get(userId).videos.each {|vid|
126
+ puts "
127
+ Name: #{vid.description.empty? ? "(no description)" : vid.description} (id #{vid.id})
128
+ Runtime: #{vid.runtime} seconds
129
+ Rating: #{vid.totalrating}
130
+ Views: #{vid.totalviews}
131
+ Votes: #{vid.totalvotes}
132
+ "
133
+ }
134
+
135
+ # Profile data detail
136
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
137
+ detail = MySpace::Detail.get(userId)
138
+ if detail.drink =~ /no/i && detail.smoke =~ /no/
139
+ puts "What *do* you do?"
140
+ end
141
+ puts detail.instance_variables.collect {|d| "#{d} = #{detail.instance_variable_get d}\n" }
142
+
143
+ # User's status
144
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
145
+ puts "User has status: #{MySpace::Status.get(userId).status}"
146
+
147
+ # Kitchen sink
148
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
149
+ require "pp"
150
+
151
+ %w( Detail Friends Groups Interest Mood Photos Profile Status User Videos ).each {|klass|
152
+ puts "\n+-+-+-+-+-+-+-+-+-+-+ #{klass} +-+-+-+-+-+-+-+-+-+-+-+-+"
153
+ obj = eval("MySpace::#{klass}")
154
+ pp obj.send(:get,userId)
155
+ }
156
+
157
+ == Class Reference
158
+
159
+
160
+ = Album
161
+ * albumUri (String)
162
+ * defaultImage (String) (String)
163
+ * id (Fixnum)
164
+ * location (String)
165
+ * photoCount (Fixnum)
166
+ * photosUri (String)
167
+ * privacy (String)
168
+ * title (String)
169
+ * user (MySpace::User)
170
+ = Detail
171
+ * user (MySpace::User)
172
+ * status (String)
173
+ * ethnicity (String)
174
+ * drink (String)
175
+ * zodiacsign (String)
176
+ * orientation (String)
177
+ * religion (String)
178
+ * herefor (String)
179
+ * smoke (String)
180
+ * education (String)
181
+ * income (String)
182
+ * children (String)
183
+ * hometown (String)
184
+ * bodyType (String)
185
+ = FriendStatus
186
+ * friendId (Fixnum)
187
+ * areFriends (TrueClass FalseClass)
188
+ = Friendship
189
+ * user (MySpace::User)
190
+ * friendship (Array MySpace::FriendStatus)
191
+ = Friends
192
+ * user (MySpace::User)
193
+ * topFriends (Array MySpace::User)
194
+ * friends (Array MySpace::User)
195
+ * next (String)
196
+ * prev (String)
197
+ * count (Fixnum)
198
+ = Interest
199
+ * user (MySpace::User)
200
+ * heroes (String)
201
+ * general (String)
202
+ * music (String)
203
+ * television (String)
204
+ * movies (String)
205
+ * books (String)
206
+ = Mood
207
+ * user (MySpace::User)
208
+ * mood (String)
209
+ = Photos
210
+ * user (MySpace::User)
211
+ * photos (Array MySpace::Photo)
212
+ * count (Fixnum)
213
+ = Photo
214
+ * caption (String)
215
+ * id (Fixnum)
216
+ * imageUri (String)
217
+ * photoUri (String)
218
+ * user (MySpace::User)
219
+ = Profile
220
+ * city (String)
221
+ * region (String)
222
+ * country (String)
223
+ * gender (String)
224
+ * postalcode (String)
225
+ * culture (String)
226
+ * basicprofile (String)
227
+ * age (Fixnum)
228
+ * aboutme (String)
229
+ * maritalstatus (String)
230
+ * hometown (String)
231
+ = Status
232
+ * user (MySpace::User)
233
+ * status (String)
234
+ = User
235
+ * name (String)
236
+ * uri (String)
237
+ * webUri (String)
238
+ * userType (String)
239
+ * userId (Fixnum)
240
+ * onlineNow (TrueClass FalseClass)
241
+ * image (String)
242
+ = Videos
243
+ * videos (Array MySpace::Video)
244
+ * count (Fixnum)
245
+ * prev (String)
246
+ * next (String)
247
+ = Video
248
+ * country (String)
249
+ * datecreated (String)
250
+ * dateupdated (String)
251
+ * description (String)
252
+ * id (Fixnum)
253
+ * image (String)
254
+ * language (String)
255
+ * mediastatus (String)
256
+ * mediatype (String)
257
+ * name (String)
258
+ * onlineNow (TrueClass FalseClass)
259
+ * privacy (String)
260
+ * resourceuserid (String)
261
+ * runtime (String)
262
+ * thumbnail (String)
263
+ * title (String)
264
+ * totalrating (String)
265
+ * totalviews (String)
266
+ * totalvotes (String)
267
+ * uri (String)
268
+ * user (MySpace::User)
269
+ * userId (Fixnum)
270
+ * userType (String)
271
+ * videoUri (String)
272
+
273
+ = License
274
+
275
+ myspace-ruby is copyright(c) 2008 MySpace. It is free software, and is distributed under the MIT license.
276
+
277
+ = Warranty
278
+
279
+ This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.
280
+
281
+ = Author
282
+
283
+ Chris Bell, copyright (c) 2008, MySpace
284
+
@@ -0,0 +1,666 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: MySpace</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">MySpace</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/myspace_rb.html">
59
+ lib/myspace.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <h2><a href="MySpace.html">MySpace</a> API</h2>
77
+ <p>
78
+ This is the official <a href="MySpace.html">MySpace</a> Ruby library, which
79
+ communicates to the <a href="MySpace.html">MySpace</a> API REST servers and
80
+ converts JSON into proper Ruby objects.
81
+ </p>
82
+ <p>
83
+ In order to use the library, you need to sign up for a developer account
84
+ and ensure you have the oath and json modules installed.
85
+ </p>
86
+ <h1>Developer Account, Access Keys and Permissions</h1>
87
+ <p>
88
+ To get a developer account, you need to sign up at:
89
+ </p>
90
+ <p>
91
+ <a href="http://developer.myspace.com">developer.myspace.com</a>
92
+ </p>
93
+ <p>
94
+ Once approved, you will need to create an application to get your api key
95
+ and secret key. The api key is a http URL (e.g <a
96
+ href="http://www.myspace.com/2543521521">www.myspace.com/2543521521</a>)
97
+ and the secret key will be a 32 character hex string.
98
+ </p>
99
+ <p>
100
+ You can find the keys in the Application Builder, by clicking on the
101
+ &#8216;Edit App Information&#8217; link. The apiKey is the
102
+ &#8216;Application Uri&#8217; and the secretKey is &#8216;Application
103
+ Domain&#8217;.
104
+ </p>
105
+ <p>
106
+ The keys can be placed into myspace.conf or specified at runtime when you
107
+ new a MySpace::Connection. The myspace.conf file can be in the current
108
+ directory where the script is being run from, or can be specified by settin
109
+ the MYSPACE_CONF environment variable.
110
+ </p>
111
+ <p>
112
+ You only have access to users that have installed your application. Also,
113
+ write access to these user&#8216;s profiles (to update status or upload a
114
+ picture) is at the user&#8216;s discretion.
115
+ </p>
116
+ <h1>Depencencies</h1>
117
+ <p>
118
+ This library has some external dependencies:
119
+ </p>
120
+ <pre>
121
+ oauth ( http://oauth.googlecode.com/svn/code/ruby )
122
+ json/pure ( http://json.rubyforge.org )
123
+ </pre>
124
+ <p>
125
+ You can install json via rubygems, which should provide a native C
126
+ &#8216;ext&#8217; and pure ruby &#8216;pure&#8217; extension. The native
127
+ &#8216;json/ext&#8217; module is faster, but could lead to some
128
+ compatibility issues, so we stuck with the pure variant.
129
+ </p>
130
+ <p>
131
+ At this point, oauth is not available as a rubygem and needs to be
132
+ installed from the URL above.
133
+ </p>
134
+ <h1>Usage</h1>
135
+ <pre>
136
+ require &quot;myspace&quot;
137
+
138
+ userId = 123
139
+ friendId = 1234
140
+ albumId = 12345
141
+
142
+ # NOTE:
143
+ # Permission to access a user's data is restricted -- you can't just access
144
+ # any user's data. In order to access a user's data, they need to have
145
+ # installed your app.
146
+
147
+ # Snag a MySpace::User object for user with id userId
148
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
149
+ user = MySpace::User.get(userId)
150
+ puts user.name + &quot; has a profile picture at &quot; + user.image
151
+
152
+ # Grab an an album
153
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
154
+ album = MySpace::Album.get(userId,albumId)
155
+ if album.photoCount &gt; 1
156
+ puts &quot;album at #{album.albumUri} has #{album.photoCount} photos&quot;
157
+ else
158
+ puts &quot;#{album.title} has only one photo&quot;
159
+ end
160
+
161
+ # Iterate through all the photos for a user
162
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
163
+ photos = MySpace::Photos.get(userId)
164
+ puts &quot;User has #{photos.count} photos&quot;
165
+ photos.photos.each {|photo|
166
+ puts &quot;id #{photo.id}, caption #{photo.caption}, imageUri #{photo.imageUri}&quot;
167
+ }
168
+
169
+ # Read a user's interests
170
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
171
+ interests = MySpace::Interest.get(userId)
172
+ puts &quot;shrug at the fountain&quot; if interests.books =~ /rand/i
173
+
174
+ # Read a user's profile data
175
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
176
+ profile = MySpace::Profile.get(userId)
177
+ puts &quot;You #{profile.age &gt;= 18 ? &quot;can&quot; : &quot;can't&quot;} vote&quot;
178
+
179
+ # Check if two or more users are friendly
180
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
181
+ include MySpace
182
+
183
+ friendId = 92281327
184
+
185
+ friendship = Friendship.get(userId,friendId)
186
+ friend = friends.friendship.first
187
+ puts &quot;user #{userId} is#{friend.areFriends ? &quot;&quot; : &quot; not&quot;} friends with user #{friend.friendId}&quot;
188
+ }
189
+
190
+ friendIds = &quot;92281327;92281328&quot;
191
+
192
+ friendship = Friendship.get(userId,friendIds)
193
+ friendship.friends.each {|f|
194
+ puts &quot;user #{userId} is#{f.areFriends ? &quot;&quot; : &quot; not&quot;} friends with user #{f.friendId}&quot;
195
+ }
196
+
197
+ # Friends
198
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
199
+ friends = MySpace::Friends.get(userId, {:page =&gt; 1, :page_size =&gt; 200})
200
+ puts &quot;User #{userId} has #{friends.count} friends.&quot;
201
+
202
+ # friends.friends is an Array of MySpace::User objects
203
+ friends.friends.each {|user|
204
+ puts &quot;user #{user.name} #{user.webUri}&quot;
205
+ }
206
+
207
+ # Mood
208
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
209
+ puts &quot;user id #{userId} mood &quot; + MySpace::Mood.get(userId).mood
210
+
211
+ # Get info on a user's videos
212
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
213
+ MySpace::Videos.get(userId).videos.each {|vid|
214
+ puts &quot;
215
+ Name: #{vid.description.empty? ? &quot;(no description)&quot; : vid.description} (id #{vid.id})
216
+ Runtime: #{vid.runtime} seconds
217
+ Rating: #{vid.totalrating}
218
+ Views: #{vid.totalviews}
219
+ Votes: #{vid.totalvotes}
220
+ </pre>
221
+ <p>
222
+ &quot;
223
+ </p>
224
+ <pre>
225
+ }
226
+
227
+ # Profile data detail
228
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
229
+ detail = MySpace::Detail.get(userId)
230
+ if detail.drink =~ /no/i &amp;&amp; detail.smoke =~ /no/
231
+ puts &quot;What *do* you do?&quot;
232
+ end
233
+ puts detail.instance_variables.collect {|d| &quot;#{d} = #{detail.instance_variable_get d}\n&quot; }
234
+
235
+ # User's status
236
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
237
+ puts &quot;User has status: #{MySpace::Status.get(userId).status}&quot;
238
+
239
+ # Kitchen sink
240
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
241
+ require &quot;pp&quot;
242
+
243
+ %w( Detail Friends Groups Interest Mood Photos Profile Status User Videos ).each {|klass|
244
+ puts &quot;\n+-+-+-+-+-+-+-+-+-+-+ #{klass} +-+-+-+-+-+-+-+-+-+-+-+-+&quot;
245
+ obj = eval(&quot;MySpace::#{klass}&quot;)
246
+ pp obj.send(:get,userId)
247
+ }
248
+ </pre>
249
+ <h2>Class Reference</h2>
250
+ <h1>Album</h1>
251
+ <ul>
252
+ <li>albumUri (String)
253
+
254
+ </li>
255
+ <li>defaultImage (String) (String)
256
+
257
+ </li>
258
+ <li>id (Fixnum)
259
+
260
+ </li>
261
+ <li>location (String)
262
+
263
+ </li>
264
+ <li>photoCount (Fixnum)
265
+
266
+ </li>
267
+ <li>photosUri (String)
268
+
269
+ </li>
270
+ <li>privacy (String)
271
+
272
+ </li>
273
+ <li>title (String)
274
+
275
+ </li>
276
+ <li>user (MySpace::User)
277
+
278
+ </li>
279
+ </ul>
280
+ <h1>Detail</h1>
281
+ <ul>
282
+ <li>user (MySpace::User)
283
+
284
+ </li>
285
+ <li>status (String)
286
+
287
+ </li>
288
+ <li>ethnicity (String)
289
+
290
+ </li>
291
+ <li>drink (String)
292
+
293
+ </li>
294
+ <li>zodiacsign (String)
295
+
296
+ </li>
297
+ <li>orientation (String)
298
+
299
+ </li>
300
+ <li>religion (String)
301
+
302
+ </li>
303
+ <li>herefor (String)
304
+
305
+ </li>
306
+ <li>smoke (String)
307
+
308
+ </li>
309
+ <li>education (String)
310
+
311
+ </li>
312
+ <li>income (String)
313
+
314
+ </li>
315
+ <li>children (String)
316
+
317
+ </li>
318
+ <li>hometown (String)
319
+
320
+ </li>
321
+ <li>bodyType (String)
322
+
323
+ </li>
324
+ </ul>
325
+ <h1>FriendStatus</h1>
326
+ <ul>
327
+ <li>friendId (Fixnum)
328
+
329
+ </li>
330
+ <li>areFriends (TrueClass FalseClass)
331
+
332
+ </li>
333
+ </ul>
334
+ <h1>Friendship</h1>
335
+ <ul>
336
+ <li>user (MySpace::User)
337
+
338
+ </li>
339
+ <li>friendship (Array MySpace::FriendStatus)
340
+
341
+ </li>
342
+ </ul>
343
+ <h1>Friends</h1>
344
+ <ul>
345
+ <li>user (MySpace::User)
346
+
347
+ </li>
348
+ <li>topFriends (Array MySpace::User)
349
+
350
+ </li>
351
+ <li>friends (Array MySpace::User)
352
+
353
+ </li>
354
+ <li>next (String)
355
+
356
+ </li>
357
+ <li>prev (String)
358
+
359
+ </li>
360
+ <li>count (Fixnum)
361
+
362
+ </li>
363
+ </ul>
364
+ <h1>Interest</h1>
365
+ <ul>
366
+ <li>user (MySpace::User)
367
+
368
+ </li>
369
+ <li>heroes (String)
370
+
371
+ </li>
372
+ <li>general (String)
373
+
374
+ </li>
375
+ <li>music (String)
376
+
377
+ </li>
378
+ <li>television (String)
379
+
380
+ </li>
381
+ <li>movies (String)
382
+
383
+ </li>
384
+ <li>books (String)
385
+
386
+ </li>
387
+ </ul>
388
+ <h1>Mood</h1>
389
+ <ul>
390
+ <li>user (MySpace::User)
391
+
392
+ </li>
393
+ <li>mood (String)
394
+
395
+ </li>
396
+ </ul>
397
+ <h1>Photos</h1>
398
+ <ul>
399
+ <li>user (MySpace::User)
400
+
401
+ </li>
402
+ <li>photos (Array MySpace::Photo)
403
+
404
+ </li>
405
+ <li>count (Fixnum)
406
+
407
+ </li>
408
+ </ul>
409
+ <h1>Photo</h1>
410
+ <ul>
411
+ <li>caption (String)
412
+
413
+ </li>
414
+ <li>id (Fixnum)
415
+
416
+ </li>
417
+ <li>imageUri (String)
418
+
419
+ </li>
420
+ <li>photoUri (String)
421
+
422
+ </li>
423
+ <li>user (MySpace::User)
424
+
425
+ </li>
426
+ </ul>
427
+ <h1>Profile</h1>
428
+ <ul>
429
+ <li>city (String)
430
+
431
+ </li>
432
+ <li>region (String)
433
+
434
+ </li>
435
+ <li>country (String)
436
+
437
+ </li>
438
+ <li>gender (String)
439
+
440
+ </li>
441
+ <li>postalcode (String)
442
+
443
+ </li>
444
+ <li>culture (String)
445
+
446
+ </li>
447
+ <li>basicprofile (String)
448
+
449
+ </li>
450
+ <li>age (Fixnum)
451
+
452
+ </li>
453
+ <li>aboutme (String)
454
+
455
+ </li>
456
+ <li>maritalstatus (String)
457
+
458
+ </li>
459
+ <li>hometown (String)
460
+
461
+ </li>
462
+ </ul>
463
+ <h1>Status</h1>
464
+ <ul>
465
+ <li>user (MySpace::User)
466
+
467
+ </li>
468
+ <li>status (String)
469
+
470
+ </li>
471
+ </ul>
472
+ <h1>User</h1>
473
+ <ul>
474
+ <li>name (String)
475
+
476
+ </li>
477
+ <li>uri (String)
478
+
479
+ </li>
480
+ <li>webUri (String)
481
+
482
+ </li>
483
+ <li>userType (String)
484
+
485
+ </li>
486
+ <li>userId (Fixnum)
487
+
488
+ </li>
489
+ <li>onlineNow (TrueClass FalseClass)
490
+
491
+ </li>
492
+ <li>image (String)
493
+
494
+ </li>
495
+ </ul>
496
+ <h1>Videos</h1>
497
+ <ul>
498
+ <li>videos (Array MySpace::Video)
499
+
500
+ </li>
501
+ <li>count (Fixnum)
502
+
503
+ </li>
504
+ <li>prev (String)
505
+
506
+ </li>
507
+ <li>next (String)
508
+
509
+ </li>
510
+ </ul>
511
+ <h1>Video</h1>
512
+ <ul>
513
+ <li>country (String)
514
+
515
+ </li>
516
+ <li>datecreated (String)
517
+
518
+ </li>
519
+ <li>dateupdated (String)
520
+
521
+ </li>
522
+ <li>description (String)
523
+
524
+ </li>
525
+ <li>id (Fixnum)
526
+
527
+ </li>
528
+ <li>image (String)
529
+
530
+ </li>
531
+ <li>language (String)
532
+
533
+ </li>
534
+ <li>mediastatus (String)
535
+
536
+ </li>
537
+ <li>mediatype (String)
538
+
539
+ </li>
540
+ <li>name (String)
541
+
542
+ </li>
543
+ <li>onlineNow (TrueClass FalseClass)
544
+
545
+ </li>
546
+ <li>privacy (String)
547
+
548
+ </li>
549
+ <li>resourceuserid (String)
550
+
551
+ </li>
552
+ <li>runtime (String)
553
+
554
+ </li>
555
+ <li>thumbnail (String)
556
+
557
+ </li>
558
+ <li>title (String)
559
+
560
+ </li>
561
+ <li>totalrating (String)
562
+
563
+ </li>
564
+ <li>totalviews (String)
565
+
566
+ </li>
567
+ <li>totalvotes (String)
568
+
569
+ </li>
570
+ <li>uri (String)
571
+
572
+ </li>
573
+ <li>user (MySpace::User)
574
+
575
+ </li>
576
+ <li>userId (Fixnum)
577
+
578
+ </li>
579
+ <li>userType (String)
580
+
581
+ </li>
582
+ <li>videoUri (String)
583
+
584
+ </li>
585
+ </ul>
586
+ <h1>License</h1>
587
+ <p>
588
+ myspace-ruby is copyright(c) 2008 <a href="MySpace.html">MySpace</a>. It is
589
+ free software, and is distributed under the MIT license.
590
+ </p>
591
+ <h1>Warranty</h1>
592
+ <p>
593
+ This software is provided &quot;as is&quot; and without any express or
594
+ implied warranties, including, without limitation, the implied warranties
595
+ of merchantibility and fitness for a particular purpose.
596
+ </p>
597
+ <h1>Author</h1>
598
+ <p>
599
+ Chris Bell, copyright (c) 2008, <a href="MySpace.html">MySpace</a>
600
+ </p>
601
+
602
+ </div>
603
+
604
+
605
+ </div>
606
+
607
+
608
+ </div>
609
+
610
+
611
+ <!-- if includes -->
612
+
613
+ <div id="section">
614
+
615
+
616
+ <div id="constants-list">
617
+ <h3 class="section-bar">Constants</h3>
618
+
619
+ <div class="name-list">
620
+ <table summary="Constants">
621
+ <tr class="top-aligned-row context-row">
622
+ <td class="context-item-name">VERSION</td>
623
+ <td>=</td>
624
+ <td class="context-item-value">&quot;0.7&quot;</td>
625
+ </tr>
626
+ <tr class="top-aligned-row context-row">
627
+ <td class="context-item-name">API_FORMATS</td>
628
+ <td>=</td>
629
+ <td class="context-item-value">[&quot;json&quot;,&quot;xml&quot;]</td>
630
+ </tr>
631
+ <tr class="top-aligned-row context-row">
632
+ <td class="context-item-name">API_HOST</td>
633
+ <td>=</td>
634
+ <td class="context-item-value">&quot;api.msappspace.com&quot;</td>
635
+ </tr>
636
+ <tr class="top-aligned-row context-row">
637
+ <td class="context-item-name">API_VERSION</td>
638
+ <td>=</td>
639
+ <td class="context-item-value">&quot;v1&quot;</td>
640
+ </tr>
641
+ <tr class="top-aligned-row context-row">
642
+ <td class="context-item-name">API_CONF</td>
643
+ <td>=</td>
644
+ <td class="context-item-value">if File.exist?(&quot;myspace.conf&quot;)</td>
645
+ </tr>
646
+ </table>
647
+ </div>
648
+ </div>
649
+
650
+
651
+
652
+
653
+
654
+
655
+ <!-- if method_list -->
656
+
657
+
658
+ </div>
659
+
660
+
661
+ <div id="validator-badges">
662
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
663
+ </div>
664
+
665
+ </body>
666
+ </html>