Class: Grooveshark::Broadcast
- Inherits:
-
Object
- Object
- Grooveshark::Broadcast
- Defined in:
- lib/grooveshark/broadcast.rb
Instance Attribute Summary collapse
-
#active_song ⇒ Object
readonly
Returns the value of attribute active_song.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_active ⇒ Object
readonly
Returns the value of attribute is_active.
-
#is_playing ⇒ Object
readonly
Returns the value of attribute is_playing.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#next_song ⇒ Object
readonly
Returns the value of attribute next_song.
-
#user_ids ⇒ Object
readonly
Returns the value of attribute user_ids.
-
#usernames ⇒ Object
readonly
Returns the value of attribute usernames.
Instance Method Summary collapse
-
#initialize(client, broadcast_id = nil, data = nil) ⇒ Broadcast
constructor
A new instance of Broadcast.
-
#reload_status ⇒ Object
Reload broadcast status Returns true on success.
Constructor Details
#initialize(client, broadcast_id = nil, data = nil) ⇒ Broadcast
Returns a new instance of Broadcast.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/grooveshark/broadcast.rb', line 8 def initialize(client, broadcast_id=nil, data=nil) @client = client if broadcast_id @id = broadcast_id 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'] @active_song = Song.new(data['active_song']) @next_song = Song.new(data['next_song']) @usernames = data['usernames'] @user_ids = data['owner_user_i_ds'] end end |
Instance Attribute Details
#active_song ⇒ Object (readonly)
Returns the value of attribute active_song.
6 7 8 |
# File 'lib/grooveshark/broadcast.rb', line 6 def active_song @active_song end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/grooveshark/broadcast.rb', line 3 def id @id end |
#is_active ⇒ Object (readonly)
Returns the value of attribute is_active.
4 5 6 |
# File 'lib/grooveshark/broadcast.rb', line 4 def is_active @is_active end |
#is_playing ⇒ Object (readonly)
Returns the value of attribute is_playing.
4 5 6 |
# File 'lib/grooveshark/broadcast.rb', line 4 def @is_playing end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/grooveshark/broadcast.rb', line 5 def name @name end |
#next_song ⇒ Object (readonly)
Returns the value of attribute next_song.
6 7 8 |
# File 'lib/grooveshark/broadcast.rb', line 6 def next_song @next_song end |
#user_ids ⇒ Object (readonly)
Returns the value of attribute user_ids.
3 4 5 |
# File 'lib/grooveshark/broadcast.rb', line 3 def user_ids @user_ids end |
#usernames ⇒ Object (readonly)
Returns the value of attribute usernames.
5 6 7 |
# File 'lib/grooveshark/broadcast.rb', line 5 def usernames @usernames end |
Instance Method Details
#reload_status ⇒ Object
Reload broadcast status Returns true on success. Otherwise false.
28 29 30 31 32 33 34 35 36 |
# File 'lib/grooveshark/broadcast.rb', line 28 def reload_status initialize( @client, nil, @client.request('broadcastStatusPoll', {:broadcastID => id}) ) true rescue false end |