Sha256: 88dbca9a6f31be2390e94c1d7481248946c8586b828915218f337da2e8394fb8
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# 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) @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 # Reload broadcast status # Returns true on success. Otherwise false. def reload_status initialize( @client, nil, @client.request('broadcastStatusPoll', broadcastID: @id) ) true rescue false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grooveshark-0.2.14 | lib/grooveshark/broadcast.rb |
grooveshark-0.2.13 | lib/grooveshark/broadcast.rb |
grooveshark-0.2.12 | lib/grooveshark/broadcast.rb |