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.
- data/README +284 -0
- data/doc/classes/MySpace.html +666 -0
- data/doc/classes/MySpace/Album.html +225 -0
- data/doc/classes/MySpace/Connection.html +427 -0
- data/doc/classes/MySpace/Detail.html +191 -0
- data/doc/classes/MySpace/FriendStatus.html +131 -0
- data/doc/classes/MySpace/Friends.html +141 -0
- data/doc/classes/MySpace/Friendship.html +205 -0
- data/doc/classes/MySpace/Group.html +301 -0
- data/doc/classes/MySpace/Groups.html +146 -0
- data/doc/classes/MySpace/Interest.html +156 -0
- data/doc/classes/MySpace/InvalidClassDefinition.html +111 -0
- data/doc/classes/MySpace/InvalidCredentials.html +111 -0
- data/doc/classes/MySpace/InvalidDataFormat.html +111 -0
- data/doc/classes/MySpace/InvalidObjectMap.html +111 -0
- data/doc/classes/MySpace/InvalidRequest.html +111 -0
- data/doc/classes/MySpace/InvalidRequestParams.html +111 -0
- data/doc/classes/MySpace/InvalidResponse.html +111 -0
- data/doc/classes/MySpace/Mood.html +131 -0
- data/doc/classes/MySpace/Object.html +348 -0
- data/doc/classes/MySpace/Photo.html +146 -0
- data/doc/classes/MySpace/Photos.html +136 -0
- data/doc/classes/MySpace/Profile.html +176 -0
- data/doc/classes/MySpace/Status.html +131 -0
- data/doc/classes/MySpace/UnknownDataType.html +111 -0
- data/doc/classes/MySpace/User.html +162 -0
- data/doc/classes/MySpace/Video.html +256 -0
- data/doc/classes/MySpace/Videos.html +126 -0
- data/doc/classes/MySpaceAPITest.html +916 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/myspace_rb.html +185 -0
- data/doc/files/tests/test_rb.html +109 -0
- data/doc/fr_class_index.html +28 -0
- data/doc/fr_file_index.html +29 -0
- data/doc/fr_method_index.html +54 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/myspace.rb +45 -0
- data/lib/myspace/classes/album.rb +25 -0
- data/lib/myspace/classes/detail.rb +22 -0
- data/lib/myspace/classes/friends.rb +16 -0
- data/lib/myspace/classes/friendship.rb +27 -0
- data/lib/myspace/classes/group.rb +55 -0
- data/lib/myspace/classes/interest.rb +16 -0
- data/lib/myspace/classes/mood.rb +9 -0
- data/lib/myspace/classes/photo.rb +21 -0
- data/lib/myspace/classes/profile.rb +22 -0
- data/lib/myspace/classes/status.rb +9 -0
- data/lib/myspace/classes/user.rb +17 -0
- data/lib/myspace/classes/video.rb +41 -0
- data/lib/myspace/connection.rb +110 -0
- data/lib/myspace/error.rb +12 -0
- data/lib/myspace/loader.rb +74 -0
- data/lib/myspace/object.rb +116 -0
- data/tests/test.rb +148 -0
- metadata +108 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: MySpace::Album</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">MySpace::Album</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/myspace/classes/album_rb.html">
|
|
59
|
+
lib/myspace/classes/album.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Object.html">
|
|
69
|
+
MySpace::Object
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div id="method-list">
|
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
|
89
|
+
|
|
90
|
+
<div class="name-list">
|
|
91
|
+
<a href="#M000020">get</a>
|
|
92
|
+
<a href="#M000021">get_raw</a>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<!-- if includes -->
|
|
100
|
+
|
|
101
|
+
<div id="section">
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
<div id="attribute-list">
|
|
108
|
+
<h3 class="section-bar">Attributes</h3>
|
|
109
|
+
|
|
110
|
+
<div class="name-list">
|
|
111
|
+
<table>
|
|
112
|
+
<tr class="top-aligned-row context-row">
|
|
113
|
+
<td class="context-item-name">albumUri</td>
|
|
114
|
+
<td class="context-item-value"> [RW] </td>
|
|
115
|
+
<td class="context-item-desc"></td>
|
|
116
|
+
</tr>
|
|
117
|
+
<tr class="top-aligned-row context-row">
|
|
118
|
+
<td class="context-item-name">defaultImage</td>
|
|
119
|
+
<td class="context-item-value"> [RW] </td>
|
|
120
|
+
<td class="context-item-desc"></td>
|
|
121
|
+
</tr>
|
|
122
|
+
<tr class="top-aligned-row context-row">
|
|
123
|
+
<td class="context-item-name">id</td>
|
|
124
|
+
<td class="context-item-value"> [RW] </td>
|
|
125
|
+
<td class="context-item-desc"></td>
|
|
126
|
+
</tr>
|
|
127
|
+
<tr class="top-aligned-row context-row">
|
|
128
|
+
<td class="context-item-name">location</td>
|
|
129
|
+
<td class="context-item-value"> [RW] </td>
|
|
130
|
+
<td class="context-item-desc"></td>
|
|
131
|
+
</tr>
|
|
132
|
+
<tr class="top-aligned-row context-row">
|
|
133
|
+
<td class="context-item-name">photoCount</td>
|
|
134
|
+
<td class="context-item-value"> [RW] </td>
|
|
135
|
+
<td class="context-item-desc"></td>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr class="top-aligned-row context-row">
|
|
138
|
+
<td class="context-item-name">photosUri</td>
|
|
139
|
+
<td class="context-item-value"> [RW] </td>
|
|
140
|
+
<td class="context-item-desc"></td>
|
|
141
|
+
</tr>
|
|
142
|
+
<tr class="top-aligned-row context-row">
|
|
143
|
+
<td class="context-item-name">privacy</td>
|
|
144
|
+
<td class="context-item-value"> [RW] </td>
|
|
145
|
+
<td class="context-item-desc"></td>
|
|
146
|
+
</tr>
|
|
147
|
+
<tr class="top-aligned-row context-row">
|
|
148
|
+
<td class="context-item-name">title</td>
|
|
149
|
+
<td class="context-item-value"> [RW] </td>
|
|
150
|
+
<td class="context-item-desc"></td>
|
|
151
|
+
</tr>
|
|
152
|
+
<tr class="top-aligned-row context-row">
|
|
153
|
+
<td class="context-item-name">user</td>
|
|
154
|
+
<td class="context-item-value"> [RW] </td>
|
|
155
|
+
<td class="context-item-desc"></td>
|
|
156
|
+
</tr>
|
|
157
|
+
</table>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<!-- if method_list -->
|
|
164
|
+
<div id="methods">
|
|
165
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
166
|
+
|
|
167
|
+
<div id="method-M000020" class="method-detail">
|
|
168
|
+
<a name="M000020"></a>
|
|
169
|
+
|
|
170
|
+
<div class="method-heading">
|
|
171
|
+
<a href="#M000020" class="method-signature">
|
|
172
|
+
<span class="method-name">get</span><span class="method-args">(userId,albumId)</span>
|
|
173
|
+
</a>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div class="method-description">
|
|
177
|
+
<p><a class="source-toggle" href="#"
|
|
178
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
|
179
|
+
<div class="method-source-code" id="M000020-source">
|
|
180
|
+
<pre>
|
|
181
|
+
<span class="ruby-comment cmt"># File lib/myspace/classes/album.rb, line 16</span>
|
|
182
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">userId</span>,<span class="ruby-identifier">albumId</span>)
|
|
183
|
+
<span class="ruby-keyword kw">super</span>([<span class="ruby-identifier">userId</span>,<span class="ruby-identifier">albumId</span>])
|
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
|
185
|
+
</pre>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div id="method-M000021" class="method-detail">
|
|
191
|
+
<a name="M000021"></a>
|
|
192
|
+
|
|
193
|
+
<div class="method-heading">
|
|
194
|
+
<a href="#M000021" class="method-signature">
|
|
195
|
+
<span class="method-name">get_raw</span><span class="method-args">(userId,albumId,format="json")</span>
|
|
196
|
+
</a>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="method-description">
|
|
200
|
+
<p><a class="source-toggle" href="#"
|
|
201
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
|
202
|
+
<div class="method-source-code" id="M000021-source">
|
|
203
|
+
<pre>
|
|
204
|
+
<span class="ruby-comment cmt"># File lib/myspace/classes/album.rb, line 20</span>
|
|
205
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_raw</span>(<span class="ruby-identifier">userId</span>,<span class="ruby-identifier">albumId</span>,<span class="ruby-identifier">format</span>=<span class="ruby-value str">"json"</span>)
|
|
206
|
+
<span class="ruby-keyword kw">super</span>([<span class="ruby-identifier">userId</span>,<span class="ruby-identifier">albumId</span>],<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">format</span>)
|
|
207
|
+
<span class="ruby-keyword kw">end</span>
|
|
208
|
+
</pre>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<div id="validator-badges">
|
|
221
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
</body>
|
|
225
|
+
</html>
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: MySpace::Connection</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">MySpace::Connection</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/myspace/connection_rb.html">
|
|
59
|
+
lib/myspace/connection.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Object.html">
|
|
69
|
+
Object
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
<div id="description">
|
|
84
|
+
<p>
|
|
85
|
+
<a href="Connection.html">MySpace::Connection</a> connects to the <a
|
|
86
|
+
href="../MySpace.html">MySpace</a> API servers, and performs connection
|
|
87
|
+
oriented tasks. Most attributes map directly to their configuration file
|
|
88
|
+
counterparts unless they‘re specified during initialization.
|
|
89
|
+
</p>
|
|
90
|
+
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div id="method-list">
|
|
97
|
+
<h3 class="section-bar">Methods</h3>
|
|
98
|
+
|
|
99
|
+
<div class="name-list">
|
|
100
|
+
<a href="#M000025">connect</a>
|
|
101
|
+
<a href="#M000024">consumer</a>
|
|
102
|
+
<a href="#M000028">get</a>
|
|
103
|
+
<a href="#M000027">get_body</a>
|
|
104
|
+
<a href="#M000022">new</a>
|
|
105
|
+
<a href="#M000026">post</a>
|
|
106
|
+
<a href="#M000023">timestamp</a>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<!-- if includes -->
|
|
114
|
+
<div id="includes">
|
|
115
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
116
|
+
|
|
117
|
+
<div id="includes-list">
|
|
118
|
+
<span class="include-name">Net</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div id="section">
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<div id="attribute-list">
|
|
129
|
+
<h3 class="section-bar">Attributes</h3>
|
|
130
|
+
|
|
131
|
+
<div class="name-list">
|
|
132
|
+
<table>
|
|
133
|
+
<tr class="top-aligned-row context-row">
|
|
134
|
+
<td class="context-item-name">apiKey</td>
|
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
|
136
|
+
<td class="context-item-desc">
|
|
137
|
+
API key
|
|
138
|
+
|
|
139
|
+
</td>
|
|
140
|
+
</tr>
|
|
141
|
+
<tr class="top-aligned-row context-row">
|
|
142
|
+
<td class="context-item-name">apiSecret</td>
|
|
143
|
+
<td class="context-item-value"> [RW] </td>
|
|
144
|
+
<td class="context-item-desc">
|
|
145
|
+
API password
|
|
146
|
+
|
|
147
|
+
</td>
|
|
148
|
+
</tr>
|
|
149
|
+
<tr class="top-aligned-row context-row">
|
|
150
|
+
<td class="context-item-name">format</td>
|
|
151
|
+
<td class="context-item-value"> [RW] </td>
|
|
152
|
+
<td class="context-item-desc">
|
|
153
|
+
preferred output format
|
|
154
|
+
|
|
155
|
+
</td>
|
|
156
|
+
</tr>
|
|
157
|
+
<tr class="top-aligned-row context-row">
|
|
158
|
+
<td class="context-item-name">host</td>
|
|
159
|
+
<td class="context-item-value"> [RW] </td>
|
|
160
|
+
<td class="context-item-desc">
|
|
161
|
+
host to <a href="Connection.html#M000025">connect</a>
|
|
162
|
+
|
|
163
|
+
</td>
|
|
164
|
+
</tr>
|
|
165
|
+
<tr class="top-aligned-row context-row">
|
|
166
|
+
<td class="context-item-name">username</td>
|
|
167
|
+
<td class="context-item-value"> [RW] </td>
|
|
168
|
+
<td class="context-item-desc">
|
|
169
|
+
API username
|
|
170
|
+
|
|
171
|
+
</td>
|
|
172
|
+
</tr>
|
|
173
|
+
</table>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<!-- if method_list -->
|
|
180
|
+
<div id="methods">
|
|
181
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
182
|
+
|
|
183
|
+
<div id="method-M000022" class="method-detail">
|
|
184
|
+
<a name="M000022"></a>
|
|
185
|
+
|
|
186
|
+
<div class="method-heading">
|
|
187
|
+
<a href="#M000022" class="method-signature">
|
|
188
|
+
<span class="method-name">new</span><span class="method-args">(attributes={}) {|self if block_given?| ...}</span>
|
|
189
|
+
</a>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<div class="method-description">
|
|
193
|
+
<p>
|
|
194
|
+
Constructor for the <a href="Connection.html">MySpace::Connection</a> class
|
|
195
|
+
</p>
|
|
196
|
+
<p><a class="source-toggle" href="#"
|
|
197
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
|
198
|
+
<div class="method-source-code" id="M000022-source">
|
|
199
|
+
<pre>
|
|
200
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 23</span>
|
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>={})
|
|
202
|
+
<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">:apiSecret</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">CONF</span>[<span class="ruby-value str">"secretKey"</span>]
|
|
204
|
+
<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
|
+
<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
|
+
|
|
207
|
+
<span class="ruby-ivar">@oauthOptions</span> = {
|
|
208
|
+
<span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:query_string</span>,
|
|
209
|
+
<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>,
|
|
210
|
+
<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>,
|
|
211
|
+
<span class="ruby-identifier">:site</span> =<span class="ruby-operator">></span> <span class="ruby-node">"http://#{API_HOST}"</span>,
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
<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>
|
|
215
|
+
<span class="ruby-keyword kw">end</span>
|
|
216
|
+
</pre>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
222
|
+
|
|
223
|
+
<div id="method-M000025" class="method-detail">
|
|
224
|
+
<a name="M000025"></a>
|
|
225
|
+
|
|
226
|
+
<div class="method-heading">
|
|
227
|
+
<a href="#M000025" class="method-signature">
|
|
228
|
+
<span class="method-name">connect</span><span class="method-args">() {|@http if block_given?| ...}</span>
|
|
229
|
+
</a>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div class="method-description">
|
|
233
|
+
<p>
|
|
234
|
+
Connects to the MySapce API servers, returning a Net::HTTP class instance.
|
|
235
|
+
If a block is given, then that instance is yielded.
|
|
236
|
+
</p>
|
|
237
|
+
<p><a class="source-toggle" href="#"
|
|
238
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
|
239
|
+
<div class="method-source-code" id="M000025-source">
|
|
240
|
+
<pre>
|
|
241
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 50</span>
|
|
242
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span>
|
|
243
|
+
<span class="ruby-comment cmt"># require "net/https"</span>
|
|
244
|
+
<span class="ruby-comment cmt"># http = Net::HTTP.new(MYSPACE_API_HOST, 443)</span>
|
|
245
|
+
<span class="ruby-comment cmt"># http.use_ssl = true</span>
|
|
246
|
+
<span class="ruby-ivar">@http</span> = <span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@host</span>)
|
|
247
|
+
<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>
|
|
248
|
+
<span class="ruby-keyword kw">end</span>
|
|
249
|
+
</pre>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div id="method-M000024" class="method-detail">
|
|
255
|
+
<a name="M000024"></a>
|
|
256
|
+
|
|
257
|
+
<div class="method-heading">
|
|
258
|
+
<a href="#M000024" class="method-signature">
|
|
259
|
+
<span class="method-name">consumer</span><span class="method-args">()</span>
|
|
260
|
+
</a>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div class="method-description">
|
|
264
|
+
<p><a class="source-toggle" href="#"
|
|
265
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
|
266
|
+
<div class="method-source-code" id="M000024-source">
|
|
267
|
+
<pre>
|
|
268
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 44</span>
|
|
269
|
+
<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-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-ivar">@apiKey</span>),<span class="ruby-ivar">@secretKey</span>,<span class="ruby-ivar">@oauthOptions</span>)
|
|
271
|
+
<span class="ruby-keyword kw">end</span>
|
|
272
|
+
</pre>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div id="method-M000028" class="method-detail">
|
|
278
|
+
<a name="M000028"></a>
|
|
279
|
+
|
|
280
|
+
<div class="method-heading">
|
|
281
|
+
<a href="#M000028" class="method-signature">
|
|
282
|
+
<span class="method-name">get</span><span class="method-args">(path="/") {|la.call if block_given?| ...}</span>
|
|
283
|
+
</a>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div class="method-description">
|
|
287
|
+
<p>
|
|
288
|
+
Performs a GET request against the <a href="../MySpace.html">MySpace</a>
|
|
289
|
+
API servers. The ‘path’ is the first argument, and the second
|
|
290
|
+
argument ‘http’ is an optional, existing Net::HTTP connection.
|
|
291
|
+
Returns or yields a Net::HTTP::Response instance, depending on how
|
|
292
|
+
it‘s called.
|
|
293
|
+
</p>
|
|
294
|
+
<p><a class="source-toggle" href="#"
|
|
295
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
|
296
|
+
<div class="method-source-code" id="M000028-source">
|
|
297
|
+
<pre>
|
|
298
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 97</span>
|
|
299
|
+
<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>)
|
|
300
|
+
<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>)
|
|
301
|
+
|
|
302
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
303
|
+
|
|
304
|
+
<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>)
|
|
305
|
+
<span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>) }
|
|
306
|
+
|
|
307
|
+
<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>
|
|
308
|
+
<span class="ruby-keyword kw">end</span>
|
|
309
|
+
</pre>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div id="method-M000027" class="method-detail">
|
|
315
|
+
<a name="M000027"></a>
|
|
316
|
+
|
|
317
|
+
<div class="method-heading">
|
|
318
|
+
<a href="#M000027" class="method-signature">
|
|
319
|
+
<span class="method-name">get_body</span><span class="method-args">(path)</span>
|
|
320
|
+
</a>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div class="method-description">
|
|
324
|
+
<p>
|
|
325
|
+
Fetches the response body from the API servers
|
|
326
|
+
</p>
|
|
327
|
+
<p><a class="source-toggle" href="#"
|
|
328
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
|
329
|
+
<div class="method-source-code" id="M000027-source">
|
|
330
|
+
<pre>
|
|
331
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 75</span>
|
|
332
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_body</span>(<span class="ruby-identifier">path</span>)
|
|
333
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
334
|
+
|
|
335
|
+
<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>
|
|
336
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span>
|
|
337
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"200"</span>
|
|
338
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>
|
|
339
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"401"</span>
|
|
340
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCredentials</span>,
|
|
341
|
+
<span class="ruby-node">"Access denied. (#{res.code})\n#{res.body}"</span>
|
|
342
|
+
<span class="ruby-keyword kw">else</span>
|
|
343
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidResponse</span>,<span class="ruby-node">"(#{res.code})\n#{res.body}"</span>
|
|
344
|
+
<span class="ruby-keyword kw">end</span>
|
|
345
|
+
}
|
|
346
|
+
<span class="ruby-keyword kw">end</span>
|
|
347
|
+
</pre>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
<div id="method-M000026" class="method-detail">
|
|
353
|
+
<a name="M000026"></a>
|
|
354
|
+
|
|
355
|
+
<div class="method-heading">
|
|
356
|
+
<a href="#M000026" class="method-signature">
|
|
357
|
+
<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
|
+
</a>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<div class="method-description">
|
|
362
|
+
<p>
|
|
363
|
+
Perform a POST operation against the <a href="../MySpace.html">MySpace</a>
|
|
364
|
+
API servers. You can pass a ‘path’, <a
|
|
365
|
+
href="Connection.html#M000026">post</a> data ‘data’ and a
|
|
366
|
+
‘content_type’ optionally. application/x-www-form-urlencoded
|
|
367
|
+
text/xml; charset=utf-8
|
|
368
|
+
</p>
|
|
369
|
+
<p><a class="source-toggle" href="#"
|
|
370
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
|
371
|
+
<div class="method-source-code" id="M000026-source">
|
|
372
|
+
<pre>
|
|
373
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 63</span>
|
|
374
|
+
<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>)
|
|
375
|
+
<span class="ruby-identifier">connect</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@http</span>
|
|
376
|
+
|
|
377
|
+
<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>)
|
|
378
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">set_form_data</span>({ }, <span class="ruby-value str">';'</span>)
|
|
379
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">data</span>
|
|
380
|
+
<span class="ruby-identifier">req</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">content_type</span>
|
|
381
|
+
|
|
382
|
+
<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>
|
|
383
|
+
<span class="ruby-keyword kw">end</span>
|
|
384
|
+
</pre>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
<div id="method-M000023" class="method-detail">
|
|
390
|
+
<a name="M000023"></a>
|
|
391
|
+
|
|
392
|
+
<div class="method-heading">
|
|
393
|
+
<a href="#M000023" class="method-signature">
|
|
394
|
+
<span class="method-name">timestamp</span><span class="method-args">()</span>
|
|
395
|
+
</a>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div class="method-description">
|
|
399
|
+
<p>
|
|
400
|
+
Returns an rfc1123 format string
|
|
401
|
+
</p>
|
|
402
|
+
<p><a class="source-toggle" href="#"
|
|
403
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
|
404
|
+
<div class="method-source-code" id="M000023-source">
|
|
405
|
+
<pre>
|
|
406
|
+
<span class="ruby-comment cmt"># File lib/myspace/connection.rb, line 40</span>
|
|
407
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">timestamp</span>
|
|
408
|
+
<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>)
|
|
409
|
+
<span class="ruby-keyword kw">end</span>
|
|
410
|
+
</pre>
|
|
411
|
+
</div>
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
<div id="validator-badges">
|
|
423
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
</body>
|
|
427
|
+
</html>
|