spotify-client 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7d5bcbac2b7f1892ea9b256eddacb21f963be42
4
- data.tar.gz: e1ed20dccb1395e60fa612ef230097fcf4354d42
3
+ metadata.gz: 41aaddaf711313958fbda73d3f50868b0ac9b4da
4
+ data.tar.gz: 7740dd06138e834eafc0349c12eb691fc4e2e8de
5
5
  SHA512:
6
- metadata.gz: d9c59c1aa145001010f8612d9b968e75d4af81348ef995cae4a381982b0b439802b6b77f57b76b8560be654b0b0eae2b08eaa9732bc1c0235dd1123349c2686c
7
- data.tar.gz: 00db9789740401f76cf06a308bcd5427e926835a82a4b9cd49ce6d7048aa44340ba509f39b8b873542ba696c99f8b9bceda7f17e2a3d4498fe7e65e1e282e3d0
6
+ metadata.gz: b7e48774a3caccb830217c99fba668e1b765ed37ea105f6046e483e4f6636af5cc9323696b7d77d7d11b9e9f8298cdaec76d889251e3f24623292636f743728b
7
+ data.tar.gz: d38b30d30f3354a8840937a5173a060fc60bfded6e2b641ea57b4025db69ad8427d3caa13c374c3eaf6b232405a4eea09fc5776c50316c263798ff0591f59c01
@@ -1,3 +1,3 @@
1
1
  module Spotify
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -52,12 +52,12 @@ module Spotify
52
52
  run(:get, "/v1/users/#{user_id}/playlists/#{playlist_id}", [200])
53
53
  end
54
54
 
55
- def user_playlist_tracks(user_id, playlist_id)
55
+ def user_playlist_tracks(user_id, playlist_id, params = {})
56
56
  tracks = { "items" => [] }
57
57
  path = "/v1/users/#{user_id}/playlists/#{playlist_id}/tracks"
58
58
 
59
59
  while path
60
- response = run(:get, path, [200])
60
+ response = run(:get, path, [200], params)
61
61
  tracks["items"].concat(response.delete("items"))
62
62
  tracks.merge!(response)
63
63
 
@@ -73,7 +73,7 @@ module Spotify
73
73
 
74
74
  # Create a playlist for a Spotify user. The playlist will be empty until you add tracks.
75
75
  #
76
- # Requires playlist-modify for a public playlist.
76
+ # Requires playlist-modify-public for a public playlist.
77
77
  # Requires playlist-modify-private for a private playlist.
78
78
  def create_user_playlist(user_id, name, is_public = true)
79
79
  run(:post, "/v1/users/#{user_id}/playlists", [201], JSON.dump({ :name => name, :public => is_public }), false)
@@ -81,7 +81,7 @@ module Spotify
81
81
 
82
82
  # Add an Array of track uris to an existing playlist.
83
83
  #
84
- # Adding tracks to a user's public playlist requires authorization of the playlist-modify scope;
84
+ # Adding tracks to a user's public playlist requires authorization of the playlist-modify-public scope;
85
85
  # adding tracks to a private playlist requires the playlist-modify-private scope.
86
86
  #
87
87
  # client.add_user_tracks_to_playlist('1181346016', '7i3thJWDtmX04dJhFwYb0x', %w(spotify:track:4iV5W9uYEdYUVa79Axb7Rh spotify:track:2lzEz3A3XIFyhMDqzMdcss))
@@ -93,6 +93,27 @@ module Spotify
93
93
  run(:post, "/v1/users/#{user_id}/playlists/#{playlist_id}/tracks", [201], params, false)
94
94
  end
95
95
 
96
+ # Removes tracks from playlist
97
+ #
98
+ # client.remove_user_tracks_from_playlist('1181346016', '7i3thJWDtmX04dJhFwYb0x', [{ uri: spotify:track:4iV5W9uYEdYUVa79Axb7Rh, positions: [0]}])
99
+ def remove_user_tracks_from_playlist(user_id, playlist_id, tracks)
100
+ run(:delete, "/v1/users/#{user_id}/playlists/#{playlist_id}/tracks", [200], JSON.dump({ :tracks => tracks }))
101
+ end
102
+
103
+ # Replaces all occurrences of tracks with what's in the playlist
104
+ #
105
+ # client.replace_user_tracks_in_playlist('1181346016', '7i3thJWDtmX04dJhFwYb0x', %w(spotify:track:4iV5W9uYEdYUVa79Axb7Rh spotify:track:2lzEz3A3XIFyhMDqzMdcss))
106
+ def replace_user_tracks_in_playlist(user_id, playlist_id, tracks)
107
+ run(:put, "/v1/users/#{user_id}/playlists/#{playlist_id}/tracks", [201], JSON.dump({ :uris => tracks }))
108
+ end
109
+
110
+ # Removes all tracks in playlist
111
+ #
112
+ # client.truncate_user_playlist('1181346016', '7i3thJWDtmX04dJhFwYb0x')
113
+ def truncate_user_playlist(user_id, playlist_id)
114
+ replace_user_tracks_in_playlist(user_id, playlist_id, [])
115
+ end
116
+
96
117
  def album(album_id)
97
118
  run(:get, "/v1/albums/#{album_id}", [200])
98
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotify-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-20 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -83,8 +83,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project: "[none]"
86
- rubygems_version: 2.4.1
86
+ rubygems_version: 2.2.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Ruby client for the Spotify Web API
90
90
  test_files: []
91
+ has_rdoc: