rspotify 2.12.1 → 2.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rspotify/connection.rb +6 -1
- data/lib/rspotify/user.rb +6 -3
- data/lib/rspotify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6f915ef11f29687a365e01664b314776a128d64334583fdf5ca7634ff1f055
|
4
|
+
data.tar.gz: 381a6c51e86f09e4876d49952ab31d934b889ed8c39beebf06a3ae9bfcf6eb1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c40c6cb3f239d519ceafe3f93249ecbd365986725b12bff2eb6a4292d3b5024dec7b06ad7a48b79734dff86095b95443d679a1a4d6523447e56f3006861281
|
7
|
+
data.tar.gz: 05f9104b6827f46400c970374cbcb407fec7a76f93f8d3fe1894197a70994fb03e4a301025fe2d5a776482033f28ce4037fc5119e7203ee92db4f1ddf91e285b
|
data/lib/rspotify/connection.rb
CHANGED
@@ -78,7 +78,12 @@ module RSpotify
|
|
78
78
|
end
|
79
79
|
|
80
80
|
return response if raw_response
|
81
|
-
|
81
|
+
|
82
|
+
begin
|
83
|
+
JSON.parse(response) unless response.nil? || response.empty?
|
84
|
+
rescue JSON::ParserError, TypeError => e
|
85
|
+
response.to_s # Fall back to raw body when the response is not actually a valid JSON response
|
86
|
+
end
|
82
87
|
end
|
83
88
|
|
84
89
|
# Added this method for testing
|
data/lib/rspotify/user.rb
CHANGED
@@ -61,8 +61,11 @@ module RSpotify
|
|
61
61
|
private_class_method :extract_custom_headers
|
62
62
|
|
63
63
|
def self.oauth_header(user_id)
|
64
|
+
token = @@users_credentials.dig(user_id, 'token')
|
65
|
+
# Fallback for playlist.add_tracks! if no credentials for the playlist owner exist
|
66
|
+
token ||= @@users_credentials.values.dig(0, 'token')
|
64
67
|
{
|
65
|
-
'Authorization' => "Bearer #{
|
68
|
+
'Authorization' => "Bearer #{token}",
|
66
69
|
'Content-Type' => 'application/json'
|
67
70
|
}
|
68
71
|
end
|
@@ -314,8 +317,8 @@ module RSpotify
|
|
314
317
|
def save_tracks!(tracks)
|
315
318
|
tracks_ids = tracks.map(&:id)
|
316
319
|
url = "me/tracks"
|
317
|
-
request_body = tracks_ids
|
318
|
-
User.oauth_put(@id, url, request_body)
|
320
|
+
request_body = { ids: tracks_ids }
|
321
|
+
User.oauth_put(@id, url, request_body.to_json)
|
319
322
|
tracks
|
320
323
|
end
|
321
324
|
|
data/lib/rspotify/version.rb
CHANGED
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: 2.12.
|
4
|
+
version: 2.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.3.27
|
305
305
|
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: A ruby wrapper for the Spotify Web API
|