Class: Pandora::Station
- Inherits:
-
Object
- Object
- Pandora::Station
- Extended by:
- Forwardable
- Includes:
- Client
- Defined in:
- lib/pandora/station.rb
Instance Attribute Summary collapse
-
#allow_add_music ⇒ Object
readonly
Returns the value of attribute allow_add_music.
-
#allow_delete ⇒ Object
readonly
Returns the value of attribute allow_delete.
-
#allow_rename ⇒ Object
readonly
Returns the value of attribute allow_rename.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#quick_mix ⇒ Object
readonly
Returns the value of attribute quick_mix.
-
#quick_mix_station_ids ⇒ Object
readonly
Returns the value of attribute quick_mix_station_ids.
-
#shared ⇒ Object
readonly
Returns the value of attribute shared.
-
#sharing_url ⇒ Object
readonly
Returns the value of attribute sharing_url.
-
#token ⇒ Object
Returns the value of attribute token.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(user, data = nil) ⇒ Station
constructor
A new instance of Station.
- #next_songs(audio_formats = Song::DEFAULT_AUDIO_FORMATS) ⇒ Object
- #rename(new_name) ⇒ Object
Constructor Details
#initialize(user, data = nil) ⇒ Station
Returns a new instance of Station.
22 23 24 25 |
# File 'lib/pandora/station.rb', line 22 def initialize(user, data = nil) @user = user load_from_data(data) if data end |
Instance Attribute Details
#allow_add_music ⇒ Object (readonly)
Returns the value of attribute allow_add_music.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def allow_add_music @allow_add_music end |
#allow_delete ⇒ Object (readonly)
Returns the value of attribute allow_delete.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def allow_delete @allow_delete end |
#allow_rename ⇒ Object (readonly)
Returns the value of attribute allow_rename.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def allow_rename @allow_rename end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def name @name end |
#quick_mix ⇒ Object (readonly)
Returns the value of attribute quick_mix.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def quick_mix @quick_mix end |
#quick_mix_station_ids ⇒ Object (readonly)
Returns the value of attribute quick_mix_station_ids.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def quick_mix_station_ids @quick_mix_station_ids end |
#shared ⇒ Object (readonly)
Returns the value of attribute shared.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def shared @shared end |
#sharing_url ⇒ Object (readonly)
Returns the value of attribute sharing_url.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def sharing_url @sharing_url end |
#token ⇒ Object
Returns the value of attribute token.
14 15 16 |
# File 'lib/pandora/station.rb', line 14 def token @token end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/pandora/station.rb', line 10 def url @url end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
13 14 15 |
# File 'lib/pandora/station.rb', line 13 def user @user end |
Instance Method Details
#delete ⇒ Object
36 37 38 39 40 41 |
# File 'lib/pandora/station.rb', line 36 def delete # TODO: check allow_delete? force option? call 'station.deleteStation', { secure: false, encrypt: true }, { stationToken: @token } end |
#next_songs(audio_formats = Song::DEFAULT_AUDIO_FORMATS) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pandora/station.rb', line 43 def next_songs(audio_formats = Song::DEFAULT_AUDIO_FORMATS) result = call 'station.getPlaylist', { secure: true, encrypt: true }, { stationToken: @token, additionalAudioUrl: audio_formats.join(',') } result['items'].map do |song_data| Song.new(self, song_data, audio_formats) end end |
#rename(new_name) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/pandora/station.rb', line 27 def rename(new_name) # TODO: check allow_rename? force option? result = call 'station.renameStation', { secure: false, encrypt: true }, { stationToken: @token, stationName: new_name } load_from_data(result) end |