myspaceid-sdk 0.1.8
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 +30 -0
- data/lib/myspace.rb +15 -0
- data/lib/myspace/exceptions.rb +31 -0
- data/lib/myspace/myspace.rb +565 -0
- data/lib/myspace/oauth.rb +62 -0
- data/lib/patches.rb +42 -0
- data/samples/rails/README +83 -0
- data/samples/rails/consumer_key.rb +4 -0
- data/samples/rails/consumer_key.rb-copyme +4 -0
- data/samples/rails/sample/README +256 -0
- data/samples/rails/sample/Rakefile +10 -0
- data/samples/rails/sample/app/controllers/application.rb +15 -0
- data/samples/rails/sample/app/controllers/oauth_controller.rb +68 -0
- data/samples/rails/sample/app/controllers/openid_controller.rb +105 -0
- data/samples/rails/sample/app/controllers/user_controller.rb +96 -0
- data/samples/rails/sample/app/helpers/application_helper.rb +3 -0
- data/samples/rails/sample/app/helpers/oauth_helper.rb +2 -0
- data/samples/rails/sample/app/helpers/openid_helper.rb +2 -0
- data/samples/rails/sample/app/helpers/user_helper.rb +90 -0
- data/samples/rails/sample/app/views/oauth/error.rhtml +8 -0
- data/samples/rails/sample/app/views/oauth/index.rhtml +8 -0
- data/samples/rails/sample/app/views/oauth/profile.rhtml +74 -0
- data/samples/rails/sample/app/views/openid/index.rhtml +125 -0
- data/samples/rails/sample/app/views/user/complete.rhtml +59 -0
- data/samples/rails/sample/app/views/user/index.rhtml +157 -0
- data/samples/rails/sample/config/boot.rb +109 -0
- data/samples/rails/sample/config/database.yml +22 -0
- data/samples/rails/sample/config/environment.rb +75 -0
- data/samples/rails/sample/config/environments/development.rb +17 -0
- data/samples/rails/sample/config/environments/production.rb +24 -0
- data/samples/rails/sample/config/environments/test.rb +22 -0
- data/samples/rails/sample/config/initializers/inflections.rb +10 -0
- data/samples/rails/sample/config/initializers/mime_types.rb +5 -0
- data/samples/rails/sample/config/initializers/new_rails_defaults.rb +17 -0
- data/samples/rails/sample/config/locales/en.yml +5 -0
- data/samples/rails/sample/config/routes.rb +43 -0
- data/samples/rails/sample/db/development.sqlite3 +0 -0
- data/samples/rails/sample/doc/README_FOR_APP +5 -0
- data/samples/rails/sample/public/404.html +30 -0
- data/samples/rails/sample/public/422.html +30 -0
- data/samples/rails/sample/public/500.html +33 -0
- data/samples/rails/sample/public/dispatch.cgi +10 -0
- data/samples/rails/sample/public/dispatch.fcgi +24 -0
- data/samples/rails/sample/public/dispatch.rb +10 -0
- data/samples/rails/sample/public/favicon.ico +0 -0
- data/samples/rails/sample/public/images/8b_Home.jpg +0 -0
- data/samples/rails/sample/public/images/8b_homecomp_200.jpg +0 -0
- data/samples/rails/sample/public/images/8b_profile_page_201.jpg +0 -0
- data/samples/rails/sample/public/images/LArge_150x35_myspaceID.png +0 -0
- data/samples/rails/sample/public/images/MySpaceID-loginwith-156x28.png +0 -0
- data/samples/rails/sample/public/images/appengine_button_noborder.gif +0 -0
- data/samples/rails/sample/public/images/background.png +0 -0
- data/samples/rails/sample/public/images/blue_150_Loginwithmyspaceid.png +0 -0
- data/samples/rails/sample/public/images/blue_150_signupwithmyspaceid.png +0 -0
- data/samples/rails/sample/public/images/blue_90_myspaceid.png +0 -0
- data/samples/rails/sample/public/images/button-background.gif +0 -0
- data/samples/rails/sample/public/images/grey_150_Loginwithmyspaceid.png +0 -0
- data/samples/rails/sample/public/images/grey_180_signupwithmyspaceid.png +0 -0
- data/samples/rails/sample/public/images/grey_90_myspaceid.png +0 -0
- data/samples/rails/sample/public/images/image.gif +0 -0
- data/samples/rails/sample/public/images/keyhole_buttons_only.png +0 -0
- data/samples/rails/sample/public/images/level_icon.png +0 -0
- data/samples/rails/sample/public/images/myspaceid.png +0 -0
- data/samples/rails/sample/public/images/nav_select.png +0 -0
- data/samples/rails/sample/public/images/openid-16x16.gif +0 -0
- data/samples/rails/sample/public/images/openid-icon.png +0 -0
- data/samples/rails/sample/public/images/openid-logo.png +0 -0
- data/samples/rails/sample/public/images/profile_icon.png +0 -0
- data/samples/rails/sample/public/images/profile_pic.png +0 -0
- data/samples/rails/sample/public/images/rails.png +0 -0
- data/samples/rails/sample/public/images/ranking_badge.png +0 -0
- data/samples/rails/sample/public/images/song_play.png +0 -0
- data/samples/rails/sample/public/images/song_sound.png +0 -0
- data/samples/rails/sample/public/images/star_grey.png +0 -0
- data/samples/rails/sample/public/images/star_yellow.png +0 -0
- data/samples/rails/sample/public/index.html +19 -0
- data/samples/rails/sample/public/index.html.orig +274 -0
- data/samples/rails/sample/public/javascripts/application.js +2 -0
- data/samples/rails/sample/public/javascripts/controls.js +963 -0
- data/samples/rails/sample/public/javascripts/dragdrop.js +973 -0
- data/samples/rails/sample/public/javascripts/effects.js +1128 -0
- data/samples/rails/sample/public/javascripts/myspaceid.rev.0.js +103 -0
- data/samples/rails/sample/public/javascripts/prototype.js +4320 -0
- data/samples/rails/sample/public/robots.txt +5 -0
- data/samples/rails/sample/public/stylesheets/base.css +46 -0
- data/samples/rails/sample/public/stylesheets/main.css +65 -0
- data/samples/rails/sample/public/stylesheets/openid.css +119 -0
- data/samples/rails/sample/script/about +4 -0
- data/samples/rails/sample/script/console +3 -0
- data/samples/rails/sample/script/dbconsole +3 -0
- data/samples/rails/sample/script/destroy +3 -0
- data/samples/rails/sample/script/generate +3 -0
- data/samples/rails/sample/script/performance/benchmarker +3 -0
- data/samples/rails/sample/script/performance/profiler +3 -0
- data/samples/rails/sample/script/performance/request +3 -0
- data/samples/rails/sample/script/plugin +3 -0
- data/samples/rails/sample/script/process/inspector +3 -0
- data/samples/rails/sample/script/process/reaper +3 -0
- data/samples/rails/sample/script/process/spawner +3 -0
- data/samples/rails/sample/script/runner +3 -0
- data/samples/rails/sample/script/server +3 -0
- data/samples/rails/sample/test/functional/oauth_controller_test.rb +8 -0
- data/samples/rails/sample/test/functional/openid_controller_test.rb +8 -0
- data/samples/rails/sample/test/functional/user_controller_test.rb +8 -0
- data/samples/rails/sample/test/performance/browsing_test.rb +9 -0
- data/samples/rails/sample/test/test_helper.rb +38 -0
- data/test/data.rb +8 -0
- data/test/myspace_test.rb +13 -0
- data/test/tc_albums.rb +126 -0
- data/test/tc_friends.rb +96 -0
- data/test/tc_profile.rb +107 -0
- data/test/tc_videos.rb +125 -0
- data/test/test_data.rb +14 -0
- data/test/ts_alltests.rb +7 -0
- metadata +222 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
* {
|
|
2
|
+
font-family: verdana,sans-serif;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
width: 60em;
|
|
7
|
+
margin: 1em;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
div {
|
|
11
|
+
padding: .5em;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
table {
|
|
15
|
+
margin: none;
|
|
16
|
+
padding: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.alert {
|
|
20
|
+
border: 1px solid #e7dc2b;
|
|
21
|
+
background: #fff888;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.success {
|
|
25
|
+
border: 1px solid #669966;
|
|
26
|
+
background: #88ff88;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.error {
|
|
30
|
+
border: 1px solid #ff0000;
|
|
31
|
+
background: #ffaaaa;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#verify-form {
|
|
35
|
+
border: 1px solid #777777;
|
|
36
|
+
background: #dddddd;
|
|
37
|
+
margin-top: 1em;
|
|
38
|
+
padding-bottom: 0em;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#MySpaceTabs {
|
|
42
|
+
margin:4em auto;
|
|
43
|
+
min-width:970px;
|
|
44
|
+
width:74.6em;
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
html { background: #5b82f3 url(/images/background.png) scroll repeat-x top left; }
|
|
3
|
+
body { padding: 0 0 50px 60px; width: 860px; font-family: ArcadeClassic, Tahoma; }
|
|
4
|
+
#branding { text-align: center; background-color: #fff; width: 160px; line-height: 200%;}
|
|
5
|
+
|
|
6
|
+
#nav { margin-top: 25px; float: left; }
|
|
7
|
+
#nav li { display: inline; margin-right: 20px; }
|
|
8
|
+
#nav a { color: #fff; text-decoration: none; font-size: 110%; }
|
|
9
|
+
|
|
10
|
+
#login {padding-bottom:15px; padding-top:15px; background-color: #e6e6e6; text-align:center; width: 260px; float: right; }
|
|
11
|
+
#login .logout a { font-size: 22px; line-height: 22px; color:#aaa; text-decoration: none; }
|
|
12
|
+
|
|
13
|
+
#login .logout .logout_isSignedin { display: block; }
|
|
14
|
+
#login .logout .logout_isSignedout { display: none; }
|
|
15
|
+
|
|
16
|
+
#login .login .login_isSignedin { display: none; }
|
|
17
|
+
#login .login .login_isSignedout { display: block; }
|
|
18
|
+
|
|
19
|
+
#cols { margin-top: 80px; overflow: auto; }
|
|
20
|
+
#cols>li { display: block; float: left; width: 260px; padding: 15px; padding-top:20px; background-color: #fff; height: 500px; overflow: auto; }
|
|
21
|
+
#cols>li h1 { font-size: 140%; font-weight: normal; }
|
|
22
|
+
#cols>li h2 { font-size: 120%; }
|
|
23
|
+
#cols #profile { background-color: #e6e6e6; width: 250px; }
|
|
24
|
+
|
|
25
|
+
#content p { font-size: 90%; }
|
|
26
|
+
#content h2 { margin-top: 15px; }
|
|
27
|
+
|
|
28
|
+
#profile-view { text-align: center; }
|
|
29
|
+
#profile-view a { text-decoration: none; }
|
|
30
|
+
#profile-pic { border: 2px solid #a9a9a9; }
|
|
31
|
+
#caption { overflow: auto; }
|
|
32
|
+
#caption-left { width: 66%; float: left; }
|
|
33
|
+
#caption-right { width: 32%; float: right; }
|
|
34
|
+
|
|
35
|
+
#profile h1 { color: #000; margin-top: 15px; }
|
|
36
|
+
#basic-info h1 { color: #6da54a; }
|
|
37
|
+
#activities>h1 { color: #2665ac; }
|
|
38
|
+
#activities>li { width:115px; }
|
|
39
|
+
#activities>li>h1 { color: #2665ac; }
|
|
40
|
+
#activities>li content{ display:block; width:100%; }
|
|
41
|
+
#activities>li div{ width:100%; text-align:center; margin:5px; padding:5px; }
|
|
42
|
+
#activities>li h5 {}
|
|
43
|
+
#activities>li img {height:85px;}
|
|
44
|
+
#profile h2 { color: #000; }
|
|
45
|
+
#profile h3 { color: #a9a9a9; font-size: 110%; margin-top: 10px; }
|
|
46
|
+
#member-since { color: #000; font-size: 110%; }
|
|
47
|
+
#headline { color: #424242; }
|
|
48
|
+
#about-me { margin-top: 20px; color: #424242; font-size: 90%; }
|
|
49
|
+
|
|
50
|
+
/* li#activities-map {width:600px;} */
|
|
51
|
+
div#copyright { text-align: center; margin-top: 30px; color: #FFFFFF;}
|
|
52
|
+
|
|
53
|
+
.content_loggedOut { display: none; }
|
|
54
|
+
.content_loggedIn { display: block; }
|
|
55
|
+
|
|
56
|
+
.welcome_LoggedOut { display: block; margin-top: 90px; width: 450px; font-size: large; font-weight: bold; padding-left: 210px; }
|
|
57
|
+
.welcome_LoggedIn { display: none; }
|
|
58
|
+
|
|
59
|
+
.rounded-corner-top {-moz-border-radius-topleft:5px; -webkit-border-top-left-radius:5px; -moz-border-radius-topright:5px; -webkit-border-top-right-radius:5px;}
|
|
60
|
+
.rounded-corner-left {-moz-border-radius-topleft:5px; -moz-border-radius-bottomleft:5px; -webkit-border-top-left-radius:5px; -webkit-border-bottom-left-radius:5px; }
|
|
61
|
+
.rounded-corner-right {-moz-border-radius-topright:5px; -moz-border-radius-bottomright:5px; -webkit-border-top-right-radius:5px; -webkit-border-bottom-right-radius:5px; }
|
|
62
|
+
.rounded-corner-bottom {-moz-border-radius-bottomleft:5px; -webkit-border-bottom-left-radius:5px; -moz-border-radius-bottomright:5px; -webkit-border-bottom-right-radius:5px;}
|
|
63
|
+
|
|
64
|
+
.activitiesContainer{margin:0px; margin-top:15px; font-size:85%;}
|
|
65
|
+
.activitiesContainer .activityItem {margin:0px; margin-bottom:20px;}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* Copyright 2007 Google Inc.
|
|
2
|
+
*
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
background-color: white;
|
|
18
|
+
color: black;
|
|
19
|
+
margin: 10px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body, input, textarea {
|
|
23
|
+
font-family: Arial, sans-serif;
|
|
24
|
+
font-size: medium;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#body {
|
|
28
|
+
clear: both;
|
|
29
|
+
margin: 1em 0 0 1em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#header {
|
|
33
|
+
margin: 1.5em 0 0 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#title, .top, .bottom {
|
|
37
|
+
background-color: #c3d9ff;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.top {
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#title {
|
|
46
|
+
font-weight: bold;
|
|
47
|
+
padding: .3em;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#navbar {
|
|
51
|
+
font-size: 80%;
|
|
52
|
+
text-align: right;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Links
|
|
58
|
+
*/
|
|
59
|
+
a img {
|
|
60
|
+
border: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* Misc
|
|
65
|
+
*/
|
|
66
|
+
img.icon {
|
|
67
|
+
vertical-align: middle;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
img#openid-logo {
|
|
71
|
+
float: left;
|
|
72
|
+
background-color: white;
|
|
73
|
+
margin-right: .5em;
|
|
74
|
+
padding-right: .5em;
|
|
75
|
+
margin-top: -1.5em;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.error {
|
|
79
|
+
color: red;
|
|
80
|
+
font-style: italic;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
span.success {
|
|
84
|
+
color: #55aa55;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
span.cancel {
|
|
88
|
+
color: #aaaa55;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* Forms
|
|
93
|
+
*/
|
|
94
|
+
form {
|
|
95
|
+
margin: 0 0 1em 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
input#openid {
|
|
100
|
+
background: #fff url("/images/openid-icon.png") no-repeat 2px 2px;
|
|
101
|
+
padding-left: 1.5em;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
a.button, input[type^="submit"], input[type^="button"] {
|
|
105
|
+
margin: 0;
|
|
106
|
+
padding: 2px 5px 2px 5px;
|
|
107
|
+
font-family: Arial, Sans-serif;
|
|
108
|
+
font-size: 12px;
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
color: #222;
|
|
111
|
+
cursor: default;
|
|
112
|
+
background: #ddd url("/images/button-background.gif") repeat-x 0 0;
|
|
113
|
+
border: 1px solid #aaa;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
a.button:hover, input[type^="submit"]:hover, input[type^="button"]:hover {
|
|
117
|
+
border-color: #9cf #69e #69e #7af;
|
|
118
|
+
}
|
|
119
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
3
|
+
require 'test_help'
|
|
4
|
+
|
|
5
|
+
class Test::Unit::TestCase
|
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
|
10
|
+
#
|
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
13
|
+
#
|
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
17
|
+
# is recommended.
|
|
18
|
+
#
|
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
|
22
|
+
self.use_transactional_fixtures = true
|
|
23
|
+
|
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
|
28
|
+
# then set this back to true.
|
|
29
|
+
self.use_instantiated_fixtures = false
|
|
30
|
+
|
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
32
|
+
#
|
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
34
|
+
# -- they do not yet inherit this setting
|
|
35
|
+
fixtures :all
|
|
36
|
+
|
|
37
|
+
# Add more helper methods to be used by all tests here...
|
|
38
|
+
end
|
data/test/data.rb
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module TestData
|
|
2
|
+
CONSUMER_KEY = '5796bcaafb2a4e48a94f4c1849bb2058' unless const_defined?('CONSUMER_KEY')
|
|
3
|
+
CONSUMER_SECRET = '5311c1fbe72b47298d4db5a098ce26d0' unless const_defined?('CONSUMER_SECRET')
|
|
4
|
+
|
|
5
|
+
TOKEN = 'BFKvhXYYsrP88LvZ+Yi3qJ2syRnUkwRUB2wfWL9jROL+MFVWOXSZfg7pi37DlCSkYoHtxLiapKMQRMXFh4mvJi9ze3t9lvKAMm85WMKPka0=' unless const_defined?('TOKEN')
|
|
6
|
+
SECRET = 'a062817544804c8da349e7621a8a26cb' unless const_defined?('SECRET')
|
|
7
|
+
USER_ID = '456073223' unless const_defined?('USER_ID')
|
|
8
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
|
|
3
|
+
require 'myspace'
|
|
4
|
+
|
|
5
|
+
require 'test_data'
|
|
6
|
+
|
|
7
|
+
module MySpaceTest
|
|
8
|
+
include TestData
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@myspace = MySpace::MySpace.new(CONSUMER_KEY, CONSUMER_SECRET, :access_token => TOKEN, :access_token_secret => SECRET)
|
|
12
|
+
end
|
|
13
|
+
end
|
data/test/tc_albums.rb
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
require 'myspace'
|
|
3
|
+
|
|
4
|
+
class TC_Albums < Test::Unit::TestCase
|
|
5
|
+
include MySpaceTest
|
|
6
|
+
|
|
7
|
+
def test_albums
|
|
8
|
+
obj = nil
|
|
9
|
+
BAD_IDS.each do |value|
|
|
10
|
+
assert_raise(MySpace::BadIdentifier) do
|
|
11
|
+
obj = @myspace.get_albums(value)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
assert_nothing_raised do
|
|
15
|
+
obj = @myspace.get_albums(USER_ID)
|
|
16
|
+
end
|
|
17
|
+
assert_equal(1, obj['count'])
|
|
18
|
+
albums = obj['albums']
|
|
19
|
+
assert_instance_of(Array, albums)
|
|
20
|
+
assert_equal(1, albums.length)
|
|
21
|
+
album = albums[0]
|
|
22
|
+
assert_instance_of(Hash, album)
|
|
23
|
+
album_id = album['id'].to_s
|
|
24
|
+
assert_equal('40418', album_id)
|
|
25
|
+
title = album['title']
|
|
26
|
+
assert_instance_of(String, title)
|
|
27
|
+
assert_equal('My Photos', title)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# {"albums"=>
|
|
31
|
+
# [{"photosUri"=>
|
|
32
|
+
# "http://api.myspace.com/v1/users/456073223/albums/40418/photos",
|
|
33
|
+
# "photoCount"=>1,
|
|
34
|
+
# "location"=>"",
|
|
35
|
+
# "title"=>"My Photos",
|
|
36
|
+
# "id"=>40418,
|
|
37
|
+
# "defaultImage"=>
|
|
38
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/m_f820313641924f0f90004932c8bc310c.jpg",
|
|
39
|
+
# "privacy"=>"Everyone",
|
|
40
|
+
# "user"=>
|
|
41
|
+
# {"name"=>"Bob",
|
|
42
|
+
# "uri"=>"http://api.myspace.com/v1/users/456073223",
|
|
43
|
+
# "webUri"=>"http://www.myspace.com/bobvontestacount",
|
|
44
|
+
# "largeImage"=>
|
|
45
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/l_f820313641924f0f90004932c8bc310c.jpg",
|
|
46
|
+
# "userType"=>"RegularUser",
|
|
47
|
+
# "userId"=>456073223,
|
|
48
|
+
# "image"=>
|
|
49
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/s_f820313641924f0f90004932c8bc310c.jpg"},
|
|
50
|
+
# "albumUri"=>"http://api.myspace.com/v1/users/456073223/albums/40418"}],
|
|
51
|
+
# "count"=>1,
|
|
52
|
+
# "user"=>
|
|
53
|
+
# {"name"=>"Bob",
|
|
54
|
+
# "uri"=>"http://api.myspace.com/v1/users/456073223",
|
|
55
|
+
# "webUri"=>"http://www.myspace.com/bobvontestacount",
|
|
56
|
+
# "largeImage"=>
|
|
57
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/l_f820313641924f0f90004932c8bc310c.jpg",
|
|
58
|
+
# "userType"=>"RegularUser",
|
|
59
|
+
# "userId"=>456073223,
|
|
60
|
+
# "image"=>
|
|
61
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/s_f820313641924f0f90004932c8bc310c.jpg"}}
|
|
62
|
+
|
|
63
|
+
def test_album
|
|
64
|
+
obj = nil
|
|
65
|
+
BAD_IDS.each do |value|
|
|
66
|
+
assert_raise(MySpace::BadIdentifier) do
|
|
67
|
+
obj = @myspace.get_album(value, ALBUM_ID)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
BAD_IDS.each do |value|
|
|
71
|
+
assert_raise(MySpace::BadIdentifier) do
|
|
72
|
+
obj = @myspace.get_album(USER_ID, value)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
assert_raise(MySpace::RestException) do
|
|
76
|
+
obj = @myspace.get_album(USER_ID, "1234")
|
|
77
|
+
end
|
|
78
|
+
assert_nothing_raised do
|
|
79
|
+
obj = @myspace.get_album(USER_ID, ALBUM_ID)
|
|
80
|
+
end
|
|
81
|
+
assert_equal(1, obj['count'])
|
|
82
|
+
photos = obj['photos']
|
|
83
|
+
assert_instance_of(Array, photos)
|
|
84
|
+
assert_equal(1, photos.length)
|
|
85
|
+
photo = photos[0]
|
|
86
|
+
assert_instance_of(Hash, photo)
|
|
87
|
+
photo_id = photo['id'].to_s
|
|
88
|
+
assert_equal('100809', photo_id)
|
|
89
|
+
caption = photo['caption']
|
|
90
|
+
assert_instance_of(String, caption)
|
|
91
|
+
assert_equal('', caption)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# {"photos"=>
|
|
95
|
+
# [{"smallImageUri"=>
|
|
96
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/s_f820313641924f0f90004932c8bc310c.jpg",
|
|
97
|
+
# "photoUri"=>
|
|
98
|
+
# "http://api.myspace.com/v1/users/456073223/albums/40418/photos/100809",
|
|
99
|
+
# "id"=>100809,
|
|
100
|
+
# "uploadDate"=>"2/27/2009 10:14:12 AM",
|
|
101
|
+
# "caption"=>"",
|
|
102
|
+
# "lastUpdatedDate"=>"",
|
|
103
|
+
# "imageUri"=>
|
|
104
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/l_f820313641924f0f90004932c8bc310c.jpg",
|
|
105
|
+
# "user"=>
|
|
106
|
+
# {"name"=>"Bob",
|
|
107
|
+
# "uri"=>"http://api.myspace.com/v1/users/456073223",
|
|
108
|
+
# "webUri"=>"http://www.myspace.com/bobvontestacount",
|
|
109
|
+
# "largeImage"=>
|
|
110
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/l_f820313641924f0f90004932c8bc310c.jpg",
|
|
111
|
+
# "userType"=>"RegularUser",
|
|
112
|
+
# "userId"=>456073223,
|
|
113
|
+
# "image"=>
|
|
114
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/s_f820313641924f0f90004932c8bc310c.jpg"}}],
|
|
115
|
+
# "count"=>1,
|
|
116
|
+
# "user"=>
|
|
117
|
+
# {"name"=>"Bob",
|
|
118
|
+
# "uri"=>"http://api.myspace.com/v1/users/456073223",
|
|
119
|
+
# "webUri"=>"http://www.myspace.com/bobvontestacount",
|
|
120
|
+
# "largeImage"=>
|
|
121
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/l_f820313641924f0f90004932c8bc310c.jpg",
|
|
122
|
+
# "userType"=>"RegularUser",
|
|
123
|
+
# "userId"=>456073223,
|
|
124
|
+
# "image"=>
|
|
125
|
+
# "http://c1.ac-images.myspacecdn.com/images02/45/s_f820313641924f0f90004932c8bc310c.jpg"}}
|
|
126
|
+
end
|