Class: Pandoru::Models::PlaylistItem
- Inherits:
-
Base
- Object
- Base
- Pandoru::Models::PlaylistItem
show all
- Defined in:
- lib/pandoru/models/playlist.rb
Direct Known Subclasses
AdItem
Instance Attribute Summary
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from Base
date_field, field, fields, from_json, from_json_list, #inspect, #populate_from_json, #to_h
Constructor Details
#initialize(data = {}, api_client = nil) ⇒ PlaylistItem
Returns a new instance of PlaylistItem.
17
18
19
|
# File 'lib/pandoru/models/playlist.rb', line 17
def initialize(data = {}, api_client = nil)
super(data, api_client)
end
|
Instance Method Details
#audio_url(quality = nil) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/pandoru/models/playlist.rb', line 25
def audio_url(quality = nil)
return nil unless @audio_url_map
quality ||= @api_client&.default_audio_quality || "mediumQuality"
@audio_url_map[quality]
end
|
#bookmark_artist ⇒ Object
47
48
49
50
|
# File 'lib/pandoru/models/playlist.rb', line 47
def bookmark_artist
return unless @api_client
@api_client.add_artist_bookmark(@track_token)
end
|
#bookmark_song ⇒ Object
42
43
44
45
|
# File 'lib/pandoru/models/playlist.rb', line 42
def bookmark_song
return unless @api_client
@api_client.add_song_bookmark(@track_token)
end
|
#is_ad? ⇒ Boolean
21
22
23
|
# File 'lib/pandoru/models/playlist.rb', line 21
def is_ad?
@is_ad || false
end
|
#sleep ⇒ Object
52
53
54
55
|
# File 'lib/pandoru/models/playlist.rb', line 52
def sleep
return unless @api_client
@api_client.sleep_song(@track_token)
end
|
#thumbs_down ⇒ Object
37
38
39
40
|
# File 'lib/pandoru/models/playlist.rb', line 37
def thumbs_down
return unless @api_client && @allow_feedback
@api_client.add_feedback(@track_token, false)
end
|
#thumbs_up ⇒ Object
32
33
34
35
|
# File 'lib/pandoru/models/playlist.rb', line 32
def thumbs_up
return unless @api_client && @allow_feedback
@api_client.add_feedback(@track_token, true)
end
|