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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- play (0.0.1)
4
+ play (0.0.2)
5
5
  SystemTimer
6
6
  activerecord
7
7
  mustache
data/lib/play.rb CHANGED
@@ -26,7 +26,7 @@ require 'play/vote'
26
26
 
27
27
  module Play
28
28
 
29
- VERSION = '0.0.2'
29
+ VERSION = '0.0.3'
30
30
 
31
31
  # The path to your music library. All of the music underneath this directory
32
32
  # will be added to the internal library.
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
- artist = Play::Artist.find_by_name(params[:artist_name])
56
- if artist
57
- album = artist.albums.find_by_name(params[:album_name])
58
- if album
59
- album.enqueue!(api_user)
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 artist.")
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.2'
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: play
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zach Holman