rspotify 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/README.md +1 -1
- data/lib/rspotify/base.rb +3 -3
- data/lib/rspotify/playlist.rb +7 -2
- data/lib/rspotify/user.rb +1 -1
- data/lib/rspotify/version.rb +1 -1
- data/rspotify.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c38e76877f674bd0d2b288bcb718bd9ceeb6c1c4
|
4
|
+
data.tar.gz: 6f278aeac2bc1e6c7af4c4b4fb0e25b6435cfbb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 843549feffdc3a350760d2a3348c4d8b5790b5be60bfd00437ea12ee57eb4dd95c0ecb968c2c798486cfaeed34ac4e0f025bcee3540ace68be64a96b3110476f
|
7
|
+
data.tar.gz: 077a6a37500bb4966db1fccee08e7119b23ce9839747153380b4728c85e4dd9b890286cb880e033414a1435ebc642cb7ef6d9bb33ee30b73136aaeba3b394a89
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -135,7 +135,7 @@ recommendations.tracks #=> (Track array)
|
|
135
135
|
|
136
136
|
You might want your application to access a user's Spotify account.
|
137
137
|
|
138
|
-
For instance, suppose you want your app to create playlists for the user based on
|
138
|
+
For instance, suppose you want your app to create playlists for the user based on their taste, or to add a feature that syncs user's playlists with some external app.
|
139
139
|
|
140
140
|
If so, add the following to your application (Remember to [get your credentials](https://developer.spotify.com/my-applications))
|
141
141
|
|
data/lib/rspotify/base.rb
CHANGED
@@ -187,7 +187,7 @@ module RSpotify
|
|
187
187
|
# track.instance_variable_get("@popularity") #=> 62
|
188
188
|
def method_missing(method_name, *args)
|
189
189
|
attr = "@#{method_name}"
|
190
|
-
super
|
190
|
+
return super if method_name.match(/[\?!]$/) || !instance_variable_defined?(attr)
|
191
191
|
|
192
192
|
attr_value = instance_variable_get attr
|
193
193
|
return attr_value if !attr_value.nil? || @id.nil?
|
@@ -199,8 +199,8 @@ module RSpotify
|
|
199
199
|
# Overrides Object#respond_to? to also consider methods dynamically generated by {#method_missing}
|
200
200
|
def respond_to?(method_name, include_private_methods = false)
|
201
201
|
attr = "@#{method_name}"
|
202
|
-
return
|
203
|
-
|
202
|
+
return super if method_name.match(/[\?!]$/) || !instance_variable_defined?(attr)
|
203
|
+
true
|
204
204
|
end
|
205
205
|
|
206
206
|
protected
|
data/lib/rspotify/playlist.rb
CHANGED
@@ -115,7 +115,7 @@ module RSpotify
|
|
115
115
|
# Adds one or more tracks to a playlist in user's Spotify account. This method is only available when the
|
116
116
|
# current user has granted access to the *playlist-modify-public* and *playlist-modify-private* scopes.
|
117
117
|
#
|
118
|
-
# @param tracks [Array<Track>] Tracks to be added. Maximum: 100 per request
|
118
|
+
# @param tracks [Array<Track>, Array<String>] Tracks to be added. Either array of Tracks or strings where each string is a valid spotify track uri. Maximum: 100 per request
|
119
119
|
# @param position [Integer, NilClass] The position to insert the tracks, a zero-based index. Default: tracks are appended to the playlist
|
120
120
|
# @return [Array<Track>] The tracks added
|
121
121
|
#
|
@@ -130,7 +130,12 @@ module RSpotify
|
|
130
130
|
# playlist.add_tracks!(tracks, position: 20)
|
131
131
|
# playlist.tracks[20].name #=> "Somebody That I Used To Know"
|
132
132
|
def add_tracks!(tracks, position: nil)
|
133
|
-
track_uris =
|
133
|
+
track_uris = nil
|
134
|
+
if tracks.first.is_a? String
|
135
|
+
track_uris = tracks.join(',')
|
136
|
+
else
|
137
|
+
track_uris = tracks.map(&:uri).join(',')
|
138
|
+
end
|
134
139
|
url = "#{@path}/tracks?uris=#{track_uris}"
|
135
140
|
url << "&position=#{position}" if position
|
136
141
|
|
data/lib/rspotify/user.rb
CHANGED
@@ -168,7 +168,7 @@ module RSpotify
|
|
168
168
|
|
169
169
|
response = User.oauth_get(@id, url)
|
170
170
|
return response if RSpotify.raw_response
|
171
|
-
response["#{type}s"]['items'].map { |i| type_class.new i }
|
171
|
+
response["#{type}s"]['items'].compact.map { |i| type_class.new i }
|
172
172
|
end
|
173
173
|
|
174
174
|
# Check if the current user is following one or more artists or other Spotify users. This method
|
data/lib/rspotify/version.rb
CHANGED
data/rspotify.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
19
|
spec.add_dependency 'omniauth-oauth2', '~> 1.3.1'
|
20
|
-
spec.add_dependency 'rest-client', '~> 1.
|
20
|
+
spec.add_dependency 'rest-client', '~> 1.8'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler'
|
23
23
|
spec.add_development_dependency 'fakeweb', '~> 1.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|