Class: Grooveshark::Broadcast
- Inherits:
-
Object
- Object
- Grooveshark::Broadcast
- Defined in:
- lib/grooveshark/broadcast.rb
Overview
Broadcast class
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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/grooveshark/broadcast.rb', line 10 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'] = 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.
8 9 10 |
# File 'lib/grooveshark/broadcast.rb', line 8 def active_song @active_song end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/grooveshark/broadcast.rb', line 5 def id @id end |
#is_active ⇒ Object (readonly)
Returns the value of attribute is_active.
6 7 8 |
# File 'lib/grooveshark/broadcast.rb', line 6 def is_active @is_active end |
#is_playing ⇒ Object (readonly)
Returns the value of attribute is_playing.
6 7 8 |
# File 'lib/grooveshark/broadcast.rb', line 6 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/grooveshark/broadcast.rb', line 7 def name @name end |
#next_song ⇒ Object (readonly)
Returns the value of attribute next_song.
8 9 10 |
# File 'lib/grooveshark/broadcast.rb', line 8 def next_song @next_song end |
#user_ids ⇒ Object (readonly)
Returns the value of attribute user_ids.
5 6 7 |
# File 'lib/grooveshark/broadcast.rb', line 5 def user_ids @user_ids end |
#usernames ⇒ Object (readonly)
Returns the value of attribute usernames.
7 8 9 |
# File 'lib/grooveshark/broadcast.rb', line 7 def usernames @usernames end |
Instance Method Details
#reload_status ⇒ Object
Reload broadcast status Returns true on success. Otherwise false.
30 31 32 33 34 35 36 37 38 |
# File 'lib/grooveshark/broadcast.rb', line 30 def reload_status initialize( @client, nil, @client.request('broadcastStatusPoll', broadcastID: @id) ) true rescue false end |