Class: SimpleSpotify::Model::Playlist
- Inherits:
-
Object
- Object
- SimpleSpotify::Model::Playlist
- Includes:
- Resource
- Defined in:
- lib/simplespotify/models/playlist.rb
Class Method Summary collapse
-
.create(user, name, client = nil, public: true) ⇒ Object
————– Create ————–.
Instance Method Summary collapse
- #add_tracks(tracks, position = nil, client = nil) ⇒ Object
- #change_details!(client = nil) ⇒ Object
-
#follow(client = nil, public: true) ⇒ Object
————– Follows ————–.
- #public? ⇒ Boolean
- #remove_tracks(client = nil, tracks: nil, positions: nil, snapshot_id: nil) ⇒ Object
- #reorder_tracks(client = nil, payload) ⇒ Object
- #replace_tracks(client = nil, tracks: []) ⇒ Object
-
#tracks!(client = nil, options = {}) ⇒ Object
————– Tracks ————–.
- #unfollow ⇒ Object
Methods included from Resource
Class Method Details
.create(user, name, client = nil, public: true) ⇒ Object
Create
76 77 78 79 |
# File 'lib/simplespotify/models/playlist.rb', line 76 def self.create user, name, client=nil, public:true client ||= SimpleSpotify.default_client client.playlist_create(user, name, public: public) end |
Instance Method Details
#add_tracks(tracks, position = nil, client = nil) ⇒ Object
37 38 39 40 |
# File 'lib/simplespotify/models/playlist.rb', line 37 def add_tracks tracks, position=nil, client=nil client ||= SimpleSpotify.default_client client.playlist_tracks_add(self, tracks: tracks, position: position) end |
#change_details!(client = nil) ⇒ Object
24 25 26 27 |
# File 'lib/simplespotify/models/playlist.rb', line 24 def change_details! client=nil client ||= SimpleSpotify.default_client client.change_details(self, name: name, public: @public) end |
#follow(client = nil, public: true) ⇒ Object
Follows
62 63 64 65 |
# File 'lib/simplespotify/models/playlist.rb', line 62 def follow client=nil, public: true client ||= SimpleSpotify.default_client client.playlist_follow(self, public: public) end |
#public? ⇒ Boolean
19 20 21 |
# File 'lib/simplespotify/models/playlist.rb', line 19 def public? @public == true end |
#remove_tracks(client = nil, tracks: nil, positions: nil, snapshot_id: nil) ⇒ Object
42 43 44 45 46 |
# File 'lib/simplespotify/models/playlist.rb', line 42 def remove_tracks client=nil, tracks: nil, positions: nil, snapshot_id: nil client ||= SimpleSpotify.default_client snapshot_id ||= @snapshot_id unless positions.nil? client.playlist_tracks_remove(self, tracks: tracks, positions: positions, snapshot_id: snapshot_id) end |
#reorder_tracks(client = nil, payload) ⇒ Object
48 49 50 51 |
# File 'lib/simplespotify/models/playlist.rb', line 48 def reorder_tracks client=nil, payload client ||= SimpleSpotify.default_client client.playlist_tracks_reorder(self, payload) end |
#replace_tracks(client = nil, tracks: []) ⇒ Object
53 54 55 56 |
# File 'lib/simplespotify/models/playlist.rb', line 53 def replace_tracks client=nil, tracks: [] client ||= SimpleSpotify.default_client client.playlist_tracks_reorder(self, tracks: tracks) end |
#tracks!(client = nil, options = {}) ⇒ Object
Tracks
32 33 34 35 |
# File 'lib/simplespotify/models/playlist.rb', line 32 def tracks! client=nil, ={} client ||= SimpleSpotify.default_client client.playlist_tracks(self, ) end |
#unfollow ⇒ Object
67 68 69 70 |
# File 'lib/simplespotify/models/playlist.rb', line 67 def unfollow client ||= SimpleSpotify.default_client client.playlist_unfollow(self) end |