play 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- play (0.0.3)
4
+ play (0.0.4)
5
5
  SystemTimer
6
6
  activerecord
7
7
  mustache
@@ -42,16 +42,16 @@ GEM
42
42
  mocha (0.9.12)
43
43
  mp4info (1.7.3)
44
44
  multi_json (1.0.1)
45
+ multi_xml (0.2.2)
45
46
  multipart-post (1.1.0)
46
47
  mustache (0.99.3)
47
48
  mysql2 (0.2.7)
48
- nokogiri (1.4.4)
49
- oa-core (0.2.4)
50
- oa-oauth (0.2.4)
49
+ oa-core (0.2.5)
50
+ oa-oauth (0.2.5)
51
51
  faraday (~> 0.6.1)
52
- multi_json (>= 0.0.5)
53
- nokogiri (~> 1.4.2)
54
- oa-core (= 0.2.4)
52
+ multi_json (~> 1.0.0)
53
+ multi_xml (~> 0.2.2)
54
+ oa-core (= 0.2.5)
55
55
  oauth (~> 0.4.0)
56
56
  oauth2 (~> 0.4.1)
57
57
  oauth (0.4.4)
data/README.md CHANGED
@@ -109,6 +109,13 @@ unique identifier to associate back to Play's user accounts. In this example,
109
109
  I'd log into my account and change my `office_string` to be "holman" so I could
110
110
  match up. It could be anything, though; we actually use MAC addresses here.
111
111
 
112
+ ## API
113
+
114
+ Play has a full API that you can use to do tons of fun stuff. In fact, the API
115
+ is more feature-packed than the web UI. Because we're programmers. And baller.
116
+
117
+ Check out the [API docs on the wiki](https://github.com/holman/play/wiki/API).
118
+
112
119
  ## Local development
113
120
 
114
121
  If you're going to hack on this locally, you can use the normal process for
@@ -26,7 +26,7 @@ require 'play/vote'
26
26
 
27
27
  module Play
28
28
 
29
- VERSION = '0.0.4'
29
+ VERSION = '0.0.5'
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.
@@ -5,6 +5,11 @@ module Play
5
5
  music_response(song)
6
6
  end
7
7
 
8
+ get "/api/say" do
9
+ Play::Client.say(params[:message])
10
+ { :success => "Okay." }.to_json
11
+ end
12
+
8
13
  post "/api/user/add_alias" do
9
14
  user = User.find_by_login(params[:login])
10
15
  if user
@@ -79,7 +84,7 @@ module Play
79
84
  end
80
85
 
81
86
  post "/api/volume" do
82
- if Play::Client.volume(params[:level].to_i)
87
+ if Play::Client.volume(params[:level])
83
88
  { :success => 'true' }.to_json
84
89
  else
85
90
  error "There's a problem adjusting the volume."
@@ -54,6 +54,13 @@ module Play
54
54
  `kill \`ps ax | grep "play -d" | cut -d ' ' -f 1\``
55
55
  end
56
56
 
57
+ # Say things over the speakers, lol.
58
+ #
59
+ # Returns nothing.
60
+ def self.say(msg)
61
+ system "say #{msg}"
62
+ end
63
+
57
64
  # Set the volume level of the client.
58
65
  #
59
66
  # number - The Integer volume level. This should be a number between 0
@@ -13,8 +13,8 @@ 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.4'
17
- s.date = '2011-05-07'
16
+ s.version = '0.0.5'
17
+ s.date = '2011-05-27'
18
18
  s.rubyforge_project = 'play'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -24,6 +24,13 @@ context "Api" do
24
24
  assert_equal @album.name, now_playing[:album_name]
25
25
  end
26
26
 
27
+ test "/api/say" do
28
+ Play::Client.expects(:say).with("Holman is sexy").returns(true)
29
+ get "/api/say", { :message => "Holman is sexy" }
30
+ resp = parse_json(last_response.body.strip)
31
+ assert_equal "Okay.", resp[:success]
32
+ end
33
+
27
34
  test "/api requires user_login" do
28
35
  post "/api/add_song", {}
29
36
  user = parse_json(last_response.body.strip)
@@ -111,8 +118,15 @@ context "Api" do
111
118
  end
112
119
 
113
120
  test "/api/volume" do
114
- Play::Client.expects(:volume).with(3).returns(true)
115
- post "/api/volume", {:level => '3'}
121
+ Play::Client.expects(:volume).with('3').returns(true)
122
+ post "/api/volume", {:level => 3}
123
+ resp = parse_json(last_response.body.strip)
124
+ assert_equal 'true', resp[:success]
125
+ end
126
+
127
+ test "/api/volume with a float" do
128
+ Play::Client.expects(:volume).with("2.5").returns(true)
129
+ post "/api/volume", {:level => '2.5'}
116
130
  resp = parse_json(last_response.body.strip)
117
131
  assert_equal 'true', resp[:success]
118
132
  end
@@ -8,4 +8,9 @@ context "Client" do
8
8
  Client.stubs(:system).returns(true)
9
9
  Client.volume(1)
10
10
  end
11
+
12
+ test "say" do
13
+ Client.stubs(:system).returns(true)
14
+ Client.say("trololol")
15
+ end
11
16
  end
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zach Holman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-07 00:00:00 -07:00
18
+ date: 2011-05-27 00:00:00 -07:00
19
19
  default_executable: play
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency