lib/grooveshark/broadcast.rb in grooveshark-0.2.11 vs lib/grooveshark/broadcast.rb in grooveshark-0.2.12
- old
+ new
@@ -1,18 +1,20 @@
+# Grooveshark module
module Grooveshark
+ # Broadcast class
class Broadcast
attr_reader :id, :user_ids
attr_reader :is_active, :is_playing
attr_reader :name, :usernames
attr_reader :active_song, :next_song
- def initialize(client, broadcast_id=nil, data=nil)
+ def initialize(client, broadcast_id = nil, data = nil)
@client = client
if broadcast_id
@id = broadcast_id
- reload_status()
+ reload_status
elsif data
@id = data['broadcast_id'] || broadcast_id
@name = data['name']
@is_playing = data['is_playing'] == 1 ? true : false
@is_active = data['is_active']
@@ -26,10 +28,10 @@
# Reload broadcast status
# Returns true on success. Otherwise false.
def reload_status
initialize(
@client, nil,
- @client.request('broadcastStatusPoll', {:broadcastID => id})
+ @client.request('broadcastStatusPoll', broadcastID: @id)
)
true
rescue
false
end