play 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/play.rb +1 -1
- data/lib/play/app/api.rb +6 -13
- data/play.gemspec +1 -1
- data/test/test_api.rb +8 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/play.rb
CHANGED
data/lib/play/app/api.rb
CHANGED
@@ -52,20 +52,13 @@ module Play
|
|
52
52
|
|
53
53
|
post "/api/add_album" do
|
54
54
|
api_authenticate
|
55
|
-
|
56
|
-
if
|
57
|
-
album
|
58
|
-
|
59
|
-
|
60
|
-
{
|
61
|
-
'artist_name' => artist.name,
|
62
|
-
'album_name' => album.name
|
63
|
-
}.to_json
|
64
|
-
else
|
65
|
-
error("Sorry, but we couldn't find that album.")
|
66
|
-
end
|
55
|
+
album = Play::Album.find_by_name(params[:name])
|
56
|
+
if album
|
57
|
+
album.enqueue!(api_user)
|
58
|
+
{:artist_name => album.artist.name,
|
59
|
+
:album_name => album.name}.to_json
|
67
60
|
else
|
68
|
-
error("Sorry, but we couldn't find that
|
61
|
+
error("Sorry, but we couldn't find that album.")
|
69
62
|
end
|
70
63
|
end
|
71
64
|
|
data/play.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'play'
|
16
|
-
s.version = '0.0.
|
16
|
+
s.version = '0.0.3'
|
17
17
|
s.date = '2011-05-06'
|
18
18
|
s.rubyforge_project = 'play'
|
19
19
|
|
data/test/test_api.rb
CHANGED
@@ -68,6 +68,14 @@ context "Api" do
|
|
68
68
|
assert_equal [@song.title], song[:song_titles]
|
69
69
|
end
|
70
70
|
|
71
|
+
test "/api/add_album" do
|
72
|
+
post "/api/add_album", { :name => @album.name,
|
73
|
+
:user_login => @user.login }
|
74
|
+
response = parse_json(last_response.body.strip)
|
75
|
+
assert_equal @artist.name, response[:artist_name]
|
76
|
+
assert_equal @album.name, response[:album_name]
|
77
|
+
end
|
78
|
+
|
71
79
|
test "/api/remove" do
|
72
80
|
post "/api/remove"
|
73
81
|
resp = parse_json(last_response.body.strip)
|
metadata
CHANGED